yiisoft/yii2

framework/db/QueryBuilder.php

Summary

F
3 days

The class QueryBuilder has 62 public methods. Consider refactoring QueryBuilder to keep number of public methods under 10. Open

class QueryBuilder extends \yii\base\BaseObject
{
/**
* The prefix for automatically generated query binding parameters.
*/
Found in framework/db/QueryBuilder.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class QueryBuilder has an overall complexity of 211 which is very high. The configured complexity threshold is 50. Open

class QueryBuilder extends \yii\base\BaseObject
{
/**
* The prefix for automatically generated query binding parameters.
*/
Found in framework/db/QueryBuilder.php by phpmd

The class QueryBuilder has 70 non-getter- and setter-methods. Consider refactoring QueryBuilder to keep number of methods under 25. Open

class QueryBuilder extends \yii\base\BaseObject
{
/**
* The prefix for automatically generated query binding parameters.
*/
Found in framework/db/QueryBuilder.php by phpmd

TooManyMethods

Since: 0.1

A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

The default was changed from 10 to 25 in PHPMD 2.3.

Example

Source https://phpmd.org/rules/codesize.html#toomanymethods

Function buildSelect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open

    public function buildSelect($columns, &$params, $distinct = false,$selectOption = null)
{
$select =$distinct ? 'SELECT DISTINCT' : 'SELECT';
if ($selectOption !== null) {$select .= ' ' . $selectOption; Found in framework/db/QueryBuilder.php - About 2 hrs to fix 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 batchInsert has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open  public function batchInsert($table, $columns,$rows, &$params = []) { if (empty($rows)) {
return '';
}
Found in framework/db/QueryBuilder.php - About 2 hrs to fix

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"

Function build has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open

    public function build($query,$params = [])
{
$query =$query->prepare($this);$params = empty($params) ?$query->params : array_merge($params,$query->params);
Found in framework/db/QueryBuilder.php - About 1 hr to fix

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"

Function quoteTableNames has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open

    private function quoteTableNames($tables, &$params)
{
foreach ($tables as$i => $table) { if ($table instanceof Query) {
list($sql,$params) = $this->build($table, $params); Found in framework/db/QueryBuilder.php - About 1 hr to fix 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 getExpressionBuilder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open  public function getExpressionBuilder(ExpressionInterface$expression)
{
$className = get_class($expression);

if (!isset($this->expressionBuilders[$className])) {
Found in framework/db/QueryBuilder.php - About 1 hr to fix

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"

The class QueryBuilder has 69 public methods and attributes. Consider reducing the number of public items to less than 45. Open

class QueryBuilder extends \yii\base\BaseObject
{
/**
* The prefix for automatically generated query binding parameters.
*/
Found in framework/db/QueryBuilder.php by phpmd

ExcessivePublicCount

Since: 0.1

A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

Example

public class Foo {
public $value; public$something;
public $var; // [... more more public attributes ...] public function doWork() {} public function doMoreWork() {} public function doWorkAgain() {} // [... more more public methods ...] } Source https://phpmd.org/rules/codesize.html#excessivepubliccount Function buildJoin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open  public function buildJoin($joins, &$params) { if (empty($joins)) {
return '';
}
Found in framework/db/QueryBuilder.php - About 1 hr to fix

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"

Function prepareInsertValues has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open

    protected function prepareInsertValues($table,$columns, $params = []) {$schema = $this->db->getSchema();$tableSchema = $schema->getTableSchema($table);
$columnSchemas =$tableSchema !== null ? $tableSchema->columns : []; Found in framework/db/QueryBuilder.php - About 55 mins to fix 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 buildColumns has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open  public function buildColumns($columns)
{
if (!is_array($columns)) { if (strpos($columns, '(') !== false) {
return $columns; Found in framework/db/QueryBuilder.php - About 55 mins to fix 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 addForeignKey has 7 arguments (exceeds 4 allowed). Consider refactoring. Open  public function addForeignKey($name, $table,$columns, $refTable,$refColumns, $delete = null,$update = null)
Found in framework/db/QueryBuilder.php - About 50 mins to fix

Function getColumnType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open

    public function getColumnType($type) { if ($type instanceof ColumnSchemaBuilder) {
$type =$type->__toString();
}
Found in framework/db/QueryBuilder.php - About 45 mins to fix

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"

Function prepareInsertSelectSubQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open

    protected function prepareInsertSelectSubQuery($columns,$schema, $params = []) { if (!is_array($columns->select) || empty($columns->select) || in_array('*',$columns->select)) {
throw new InvalidArgumentException('Expected select query object with enumerated (named) parameters');
}
Found in framework/db/QueryBuilder.php - About 35 mins to fix

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"

Function buildWithQueries has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open

    public function buildWithQueries($withs, &$params)
{
if (empty($withs)) { return ''; } Found in framework/db/QueryBuilder.php - About 25 mins to fix 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 class QueryBuilder has 1756 lines of code. Current threshold is 1000. Avoid really long classes. Open class QueryBuilder extends \yii\base\BaseObject { /** * The prefix for automatically generated query binding parameters. */ Found in framework/db/QueryBuilder.php by phpmd The method batchInsert() has an NPath complexity of 224. The configured NPath complexity threshold is 200. Open  public function batchInsert($table, $columns,$rows, &$params = []) { if (empty($rows)) {
return '';
}
Found in framework/db/QueryBuilder.php by phpmd

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 buildSelect() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open

    public function buildSelect($columns, &$params, $distinct = false,$selectOption = null)
{
$select =$distinct ? 'SELECT DISTINCT' : 'SELECT';
if ($selectOption !== null) {$select .= ' ' . $selectOption; Found in framework/db/QueryBuilder.php by phpmd CyclomaticComplexity Since: 0.1 Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity. Example // Cyclomatic Complexity = 11 class Foo { 1 public function example() { 2 if ($a == $b) { 3 if ($a1 == $b1) { fiddle(); 4 } elseif ($a2 == $b2) { fiddle(); } else { fiddle(); } 5 } elseif ($c == $d) { 6 while ($c == $d) { fiddle(); } 7 } elseif ($e == $f) { 8 for ($n = 0; $n <$h; $n++) { fiddle(); } } else { switch ($z) {
9               case 1:
fiddle();
break;
10              case 2:
fiddle();
break;
11              case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method batchInsert() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open

    public function batchInsert($table,$columns, $rows, &$params = [])
{
if (empty($rows)) { return ''; } Found in framework/db/QueryBuilder.php by phpmd CyclomaticComplexity Since: 0.1 Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity. Example // Cyclomatic Complexity = 11 class Foo { 1 public function example() { 2 if ($a == $b) { 3 if ($a1 == $b1) { fiddle(); 4 } elseif ($a2 == $b2) { fiddle(); } else { fiddle(); } 5 } elseif ($c == $d) { 6 while ($c == $d) { fiddle(); } 7 } elseif ($e == $f) { 8 for ($n = 0; $n <$h; $n++) { fiddle(); } } else { switch ($z) {
9               case 1:
fiddle();
break;
10              case 2:
fiddle();
break;
11              case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method build() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open

    public function build($query,$params = [])
{
$query =$query->prepare($this);$params = empty($params) ?$query->params : array_merge($params,$query->params);
Found in framework/db/QueryBuilder.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a ==$b) {
3           if ($a1 ==$b1) {
fiddle();
4           } elseif ($a2 ==$b2) {
fiddle();
} else {
fiddle();
}
5       } elseif ($c ==$d) {
6           while ($c ==$d) {
fiddle();
}
7        } elseif ($e ==$f) {
8           for ($n = 0;$n < $h;$n++) {
fiddle();
}
} else {
switch ($z) { 9 case 1: fiddle(); break; 10 case 2: fiddle(); break; 11 case 3: fiddle(); break; default: fiddle(); break; } } } } Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity The class QueryBuilder has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open class QueryBuilder extends \yii\base\BaseObject { /** * The prefix for automatically generated query binding parameters. */ Found in framework/db/QueryBuilder.php by phpmd CouplingBetweenObjects Since: 1.1.0 A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability Example class Foo { /** * @var \foo\bar\X */ private$x = null;

/**
* @var \foo\bar\Y
*/
private $y = null; /** * @var \foo\bar\Z */ private$z = null;

public function setFoo(\Foo $foo) {} public function setBar(\Bar$bar) {}
public function setBaz(\Baz $baz) {} /** * @return \SplObjectStorage * @throws \OutOfRangeException * @throws \InvalidArgumentException * @throws \ErrorException */ public function process(\Iterator$it) {}

// ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

The method createIndex has a boolean flag argument $unique, which is a certain sign of a Single Responsibility Principle violation. Open  public function createIndex($name, $table,$columns, $unique = false) Found in framework/db/QueryBuilder.php by phpmd 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 method checkIntegrity has a boolean flag argument $check, which is a certain sign of a Single Responsibility Principle violation. Open  public function checkIntegrity($check = true, $schema = '',$table = '')
Found in framework/db/QueryBuilder.php by phpmd

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 method buildSelect has a boolean flag argument$distinct, which is a certain sign of a Single Responsibility Principle violation. Open

    public function buildSelect($columns, &$params, $distinct = false,$selectOption = null)
Found in framework/db/QueryBuilder.php by phpmd

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 Avoid assigning values to variables in if clauses and the like (line '1339', column '21'). Open  private function quoteTableNames($tables, &$params) { foreach ($tables as $i =>$table) {
if ($table instanceof Query) { list($sql, $params) =$this->build($table,$params);
Found in framework/db/QueryBuilder.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
public function bar($flag) { if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false // ... } } } Source http://phpmd.org/rules/cleancode.html#ifstatementassignment Avoid assigning values to variables in if clauses and the like (line '458', column '14'). Open  public function batchInsert($table, $columns,$rows, &$params = []) { if (empty($rows)) {
return '';
}
Found in framework/db/QueryBuilder.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
public function bar($flag) { if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false // ... } } } Source http://phpmd.org/rules/cleancode.html#ifstatementassignment Avoid unused parameters such as '$name'. Open

    public function dropDefaultValue($name,$table)
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

{
// $howdy is not used } } Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter Avoid unused parameters such as '$params'. Open

    public function upsert($table,$insertColumns, $updateColumns, &$params)
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

{
// $howdy is not used } } Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter Avoid unused parameters such as '$name'. Open

    public function addDefaultValue($name,$table, $column,$value)
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$check'. Open  public function checkIntegrity($check = true, $schema = '',$table = '')
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$schema'. Open  public function checkIntegrity($check = true, $schema = '',$table = '')
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

{

    public function checkIntegrity($check = true,$schema = '', $table = '') Found in framework/db/QueryBuilder.php by phpmd UnusedFormalParameter Since: 0.2 Avoid passing parameters to methods or constructors and then not using those parameters. Example class Foo { private function bar($howdy)
{
// $howdy is not used } } Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter Avoid unused parameters such as '$insertColumns'. Open

    public function upsert($table,$insertColumns, $updateColumns, &$params)
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

{

        foreach ($withs as$i => $with) { Found in framework/db/QueryBuilder.php by phpmd UnusedLocalVariable Since: 0.2 Detects when a local variable is declared and/or assigned, but not used. Example class Foo { public function doSomething() {$i = 5; // Unused
}
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

{
// $howdy is not used } } Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter Avoid unused parameters such as '$value'. Open

    public function resetSequence($table,$value = null)
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

{
// $howdy is not used } } Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter Avoid unused parameters such as '$table'. Open

    public function upsert($table,$insertColumns, $updateColumns, &$params)
Found in framework/db/QueryBuilder.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
private function bar($howdy) { //$howdy is not used
}
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Identical blocks of code found in 2 locations. Consider refactoring. Open

        foreach ($rows as$row) {
$vs = []; foreach ($row as $i =>$value) {
if (isset($columns[$i], $columnSchemas[$columns[$i]])) {$value = $columnSchemas[$columns[$i]]->dbTypecast($value);
Found in framework/db/QueryBuilder.php and 1 other location - About 6 hrs to fix
framework/db/oci/QueryBuilder.php on lines 314..335

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 210.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Similar blocks of code found in 2 locations. Consider refactoring. Open

    public function addPrimaryKey($name,$table, $columns) { if (is_string($columns)) {
$columns = preg_split('/\s*,\s*/',$columns, -1, PREG_SPLIT_NO_EMPTY);
}
Found in framework/db/QueryBuilder.php and 1 other location - About 2 hrs to fix
framework/db/QueryBuilder.php on lines 940..952

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 136.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Similar blocks of code found in 2 locations. Consider refactoring. Open

    public function addUnique($name,$table, $columns) { if (is_string($columns)) {
$columns = preg_split('/\s*,\s*/',$columns, -1, PREG_SPLIT_NO_EMPTY);
}
Found in framework/db/QueryBuilder.php and 1 other location - About 2 hrs to fix
framework/db/QueryBuilder.php on lines 759..772

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 136.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Identical blocks of code found in 2 locations. Consider refactoring. Open

        $clauses = [$this->buildSelect($query->select,$params, $query->distinct,$query->selectOption),
$this->buildFrom($query->from, $params),$this->buildJoin($query->join,$params),
$this->buildWhere($query->where, \$params),
Found in framework/db/QueryBuilder.php and 1 other location - About 55 mins to fix
framework/db/sqlite/QueryBuilder.php on lines 491..498

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 99.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.