fpdo/fluentpdo

View on GitHub

Showing 35 of 35 total issues

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

    protected function quote($value)
    {
        if (!isset($value)) {
            return "NULL";
        }
Severity: Minor
Found in src/Queries/Base.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"

Further reading

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

    private function createJoinStatement($clause, $mainTable, $joinTable, $joinAlias = '')
    {
        if (in_array(substr($mainTable, -1), [':', '.'])) {
            $mainTable = substr($mainTable, 0, -1);
        }
Severity: Minor
Found in src/Queries/Common.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"

Further reading

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

    private function buildSelectData($index, $indexAsArray)
    {
        $data = [];

        foreach ($this as $row) {
Severity: Minor
Found in src/Queries/Select.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"

Further reading

Avoid too many return statements within this method.
Open

                return $this->addWhereStatement($condition, $separator);
Severity: Major
Found in src/Queries/Common.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return 0;
    Severity: Major
    Found in src/Queries/Base.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $this->addWhereStatement('FALSE', $separator);
      Severity: Major
      Found in src/Queries/Common.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $this->addWhereStatement("$condition IN $in", $separator);
        Severity: Major
        Found in src/Queries/Common.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $this->fluent->getPdo()->quote($value);
          Severity: Major
          Found in src/Queries/Base.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return (string)$value;
            Severity: Major
            Found in src/Queries/Base.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $this->addWhereStatement($condition, $separator, $args);
              Severity: Major
              Found in src/Queries/Common.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $this->addWhereStatement("$condition IS NULL", $separator);
                Severity: Major
                Found in src/Queries/Common.php - About 30 mins to fix

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

                      public function values($values)
                      {
                          if (!is_array($values)) {
                              throw new Exception('Param VALUES for INSERT query must be array');
                          }
                  Severity: Minor
                  Found in src/Queries/Insert.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

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

                      private function addOneValue($oneValue)
                      {
                          // check if all $keys are strings
                          foreach ($oneValue as $key => $value) {
                              if (!is_string($key)) {
                  Severity: Minor
                  Found in src/Queries/Insert.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

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

                      protected function addStatement($clause, $statement, $parameters = [])
                      {
                          if ($statement === null) {
                              return $this->resetClause($clause);
                          }
                  Severity: Minor
                  Found in src/Queries/Base.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

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

                      protected function getClauseSet()
                      {
                          $setArray = [];
                          foreach ($this->statements['SET'] as $field => $value) {
                              // named params are being used here
                  Severity: Minor
                  Found in src/Queries/Update.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

                  Severity
                  Category
                  Status
                  Source
                  Language