File Common.php
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Envms\FluentPDO\Queries;
use Envms\FluentPDO\{Exception, Literal, Utilities};
Function where
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function where($condition, $parameters = [], $separator = 'AND')
{
if ($condition === null) {
return $this->resetClause('WHERE');
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function createUndefinedJoins
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function createUndefinedJoins($statement)
{
if ($this->isEscapedJoin($statement)) {
return $statement;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method where
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function where($condition, $parameters = [], $separator = 'AND')
{
if ($condition === null) {
return $this->resetClause('WHERE');
}
Method createUndefinedJoins
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createUndefinedJoins($statement)
{
if ($this->isEscapedJoin($statement)) {
return $statement;
}
Function addJoinStatements
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function addJoinStatements($clause, $statement, $parameters = [])
{
if ($statement === null) {
$this->joins = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method applyTableJoin
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function applyTableJoin($clause, $parameters, $mainTable, $joinItem, $lastItem, $joinAlias)
Method addRawJoins
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function addRawJoins($clause, $statement, $parameters, $joinAlias, $joinTable)
Function createJoinStatement
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function createJoinStatement($clause, $mainTable, $joinTable, $joinAlias = '')
{
if (in_array(substr($mainTable, -1), [':', '.'])) {
$mainTable = substr($mainTable, 0, -1);
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $this->addWhereStatement('FALSE', $separator);
Avoid too many return
statements within this method. Open
return $this->addWhereStatement($condition, $separator);
Avoid too many return
statements within this method. Open
return $this->addWhereStatement("$condition IN $in", $separator);
Avoid too many return
statements within this method. Open
return $this->addWhereStatement($condition, $separator, $args);
Avoid too many return
statements within this method. Open
return $this->addWhereStatement("$condition IS NULL", $separator);