src/Database/QueryBuilder.php
QueryBuilder
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class QueryBuilder
{
const ENGINES = ['mysql', 'postgres', 'mssql'];
public static $engine = "mysql";
public static $requireWhereClause = true;
File QueryBuilder.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Query Builder - build SQL queries programatically
*
* @package Automatorm\Database
Method resolve
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function resolve() : array
{
$this->data = [];
$table = $this->table->render($this);
Avoid too many return
statements within this method. Open
Open
return ["DELETE FROM $table{$where}{$limit}", $this->data];
Missing class import via use statement (line '38', column '23'). Open
Open
throw new \UnexpectedValueException('Unknown property');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid unused parameters such as '$columndata'. Open
Open
public static function replace($table, array $columndata = []) : self
- Read upRead up
- Exclude checks
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
Reference to undeclared property \Automatorm\Database\QueryBuilder->currentJoin
Open
Open
$this->joins[] = $this->currentJoin = $join;
- Exclude checks
Possibly zero references to use statement for classlike/namespace Expression
(\Automatorm\Database\QueryBuilder\Expression)
Open
Open
Table, SubQuery, Column, CountColumn, Join, Expression, Data, Where
- Exclude checks
Reference to undeclared property \Automatorm\Database\QueryBuilder->currentJoin
Open
Open
$this->currentJoin = end($this->joins);
- Exclude checks
Reference to undeclared property \Automatorm\Database\QueryBuilder->currentJoin
Open
Open
$this->joins[] = $this->currentJoin = $join;
- Exclude checks
There must be one USE keyword per declaration Open
Open
use Automatorm\Database\QueryBuilder\{
- Exclude checks
Usage of ELSE IF is discouraged; use ELSEIF instead Open
Open
} else if ($table instanceof QueryBuilder) {
- Exclude checks