brokencube/automatorm

View on GitHub
src/Database/QueryBuilder.php

Summary

Maintainability
C
1 day
Test Coverage

QueryBuilder has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

class QueryBuilder
{
    const ENGINES = ['mysql', 'postgres', 'mssql'];
    public static $engine = "mysql";
    public static $requireWhereClause = true;
Severity: Minor
Found in src/Database/QueryBuilder.php - About 4 hrs to fix

    File QueryBuilder.php has 320 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Query Builder - build SQL queries programatically
     *
     * @package Automatorm\Database
    Severity: Minor
    Found in src/Database/QueryBuilder.php - About 3 hrs to fix

      Method resolve has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function resolve() : array
          {
              $this->data = [];
              
              $table = $this->table->render($this);
      Severity: Minor
      Found in src/Database/QueryBuilder.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                        return ["DELETE FROM $table{$where}{$limit}", $this->data];
        Severity: Major
        Found in src/Database/QueryBuilder.php - About 30 mins to fix

          Missing class import via use statement (line '38', column '23').
          Open

                      throw new \UnexpectedValueException('Unknown property');
          Severity: Minor
          Found in src/Database/QueryBuilder.php by phpmd

          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

              public static function replace($table, array $columndata = []) : self
          Severity: Minor
          Found in src/Database/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

          Reference to undeclared property \Automatorm\Database\QueryBuilder->currentJoin
          Open

                  $this->joins[] = $this->currentJoin = $join;
          Severity: Minor
          Found in src/Database/QueryBuilder.php by phan

          Possibly zero references to use statement for classlike/namespace Expression (\Automatorm\Database\QueryBuilder\Expression)
          Open

              Table, SubQuery, Column, CountColumn, Join, Expression, Data, Where
          Severity: Minor
          Found in src/Database/QueryBuilder.php by phan

          Reference to undeclared property \Automatorm\Database\QueryBuilder->currentJoin
          Open

                  $this->currentJoin = end($this->joins);
          Severity: Minor
          Found in src/Database/QueryBuilder.php by phan

          Reference to undeclared property \Automatorm\Database\QueryBuilder->currentJoin
          Open

                  $this->joins[] = $this->currentJoin = $join;
          Severity: Minor
          Found in src/Database/QueryBuilder.php by phan

          There must be one USE keyword per declaration
          Open

          use Automatorm\Database\QueryBuilder\{

          Usage of ELSE IF is discouraged; use ELSEIF instead
          Open

                  } else if ($table instanceof QueryBuilder) {

          There are no issues that match your filters.

          Category
          Status