fpdo/fluentpdo

View on GitHub

Showing 35 of 35 total issues

File Base.php has 322 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Envms\FluentPDO\Queries;

use DateTime, IteratorAggregate, PDO, PDOStatement;
Severity: Minor
Found in src/Queries/Base.php - About 3 hrs to fix

    Base has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class Base implements IteratorAggregate
    {
    
        /** @var float */
        private $totalTime;
    Severity: Minor
    Found in src/Queries/Base.php - About 3 hrs to fix

      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};
      Severity: Minor
      Found in src/Queries/Common.php - About 2 hrs to fix

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

            private function debug()
            {
                if (!empty($this->fluent->debug)) {
                    if (!is_callable($this->fluent->debug)) {
                        $backtrace = '';
        Severity: Minor
        Found in src/Queries/Base.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 convertNullValues has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function convertNullValues(): void
            {
                $filterList = ['VALUES', 'ON DUPLICATE KEY UPDATE', 'SET'];
        
                foreach ($this->statements as $clause => $statement) {
        Severity: Minor
        Found in src/Queries/Base.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 stringToNumeric has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function stringToNumeric(\PDOStatement $statement, $rows)
            {
                for ($i = 0; ($columnMeta = $statement->getColumnMeta($i)) !== false; $i++) {
                    $type = $columnMeta['native_type'];
        
        
        Severity: Minor
        Found in src/Utilities.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 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');
                }
        Severity: Minor
        Found in src/Queries/Common.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 buildParameters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function buildParameters(): array
            {
                $parameters = [];
                foreach ($this->parameters as $clauses) {
                    if ($this->fluent->convertWrite === true) {
        Severity: Minor
        Found in src/Queries/Base.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 createUndefinedJoins has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private function createUndefinedJoins($statement)
            {
                if ($this->isEscapedJoin($statement)) {
                    return $statement;
                }
        Severity: Minor
        Found in src/Queries/Common.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

        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');
                }
        Severity: Minor
        Found in src/Queries/Common.php - About 1 hr to fix

          Method stringToNumeric has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function stringToNumeric(\PDOStatement $statement, $rows)
              {
                  for ($i = 0; ($columnMeta = $statement->getColumnMeta($i)) !== false; $i++) {
                      $type = $columnMeta['native_type'];
          
          
          Severity: Minor
          Found in src/Utilities.php - About 1 hr to fix

            Method debug has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function debug()
                {
                    if (!empty($this->fluent->debug)) {
                        if (!is_callable($this->fluent->debug)) {
                            $backtrace = '';
            Severity: Minor
            Found in src/Queries/Base.php - About 1 hr to fix

              Function fetchAll has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function fetchAll($index = '', $selectOnly = '')
                  {
                      $indexAsArray = strpos($index, '[]');
              
                      if ($indexAsArray !== false) {
              Severity: Minor
              Found in src/Queries/Select.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 set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function set($fieldOrArray, $value = false)
                  {
                      if (!$fieldOrArray) {
                          return $this;
                      }
              Severity: Minor
              Found in src/Queries/Update.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 buildQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function buildQuery()
                  {
                      if ($this->fluent->convertWrite === true) {
                          $this->convertNullValues();
                      }
              Severity: Minor
              Found in src/Queries/Base.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

              Method createUndefinedJoins has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function createUndefinedJoins($statement)
                  {
                      if ($this->isEscapedJoin($statement)) {
                          return $statement;
                      }
              Severity: Minor
              Found in src/Queries/Common.php - About 1 hr to fix

                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 = [];
                
                
                Severity: Minor
                Found in src/Queries/Common.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 fetch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function fetch(?string $column = null, int $cursorOrientation = \PDO::FETCH_ORI_NEXT)
                    {
                        if ($this->result === null) {
                            $this->execute();
                        }
                Severity: Minor
                Found in src/Queries/Select.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"

                Further reading

                Method applyTableJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private function applyTableJoin($clause, $parameters, $mainTable, $joinItem, $lastItem, $joinAlias)
                Severity: Minor
                Found in src/Queries/Common.php - About 45 mins to fix

                  Method addRawJoins has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private function addRawJoins($clause, $statement, $parameters, $joinAlias, $joinTable)
                  Severity: Minor
                  Found in src/Queries/Common.php - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language