src/abstraction/SelectBuilder.php
Method generate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function generate()
{
$result = '';
$table = $this->buildTable();
Function generate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function generate()
{
$result = '';
$table = $this->buildTable();
- 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
The method generate() has an NPath complexity of 256. The configured NPath complexity threshold is 200. Open
Open
public function generate()
{
$result = '';
$table = $this->buildTable();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method forUpdate has a boolean flag argument $flag, which is a certain sign of a Single Responsibility Principle violation. Open
Open
public function forUpdate($flag = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildTable();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildLimit();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildSelectFields();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildUnion();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildGroup();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildHaving();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildWhere();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildJoin();
- Exclude checks
The abstract declaration must precede the visibility declaration Open
Open
protected abstract function buildOrder();
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks