qcubed/framework

View on GitHub
includes/database/QSqLite3PdoDatabase.class.php

Summary

Maintainability
F
1 wk
Test Coverage

Function SqlVariable has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

        public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                // Are we SqlVariabling a BOOLEAN value?
                if (is_bool($mixData)) {
                        // Yes
                        if ($blnIncludeEquality) {
Severity: Minor
Found in includes/database/QSqLite3PdoDatabase.class.php - About 1 day 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

File QSqLite3PdoDatabase.class.php has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * PDO_SqLite3 database driver
 * @package DatabaseAdapters
 * @author Christophe Damour [sigeal at sigeal dot com dot fr]
Severity: Minor
Found in includes/database/QSqLite3PdoDatabase.class.php - About 5 hrs to fix

    Function __construct has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($mixFieldData, $objDb = null, $strTableName=null) {
            $this->strName = $mixFieldData->GetColumn('name');
            // Set strOriginalName to Name if it isn't set
            if (!$this->strOriginalName)
                $this->strOriginalName = $this->strName;
    Severity: Minor
    Found in includes/database/QSqLite3PdoDatabase.class.php - About 3 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

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

    class QSqLite3PdoDatabase extends QPdoDatabase {
        const Adapter = 'SqLite3 PDO Database Adapter';
        const PDO_SQLITE3_DSN_IDENTIFIER = 'sqlite';
    
        protected $strEscapeIdentifierBegin = '';

    Method SetFieldType has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function SetFieldType($strSqlite3FieldType) {
            switch ($strSqlite3FieldType) {
                case 'TINYINT':
                case 'BOOLEAN':
                    if ($this->intMaxLength == 1)
    Severity: Major
    Found in includes/database/QSqLite3PdoDatabase.class.php - About 2 hrs to fix

      Function SetFieldType has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function SetFieldType($strSqlite3FieldType) {
              switch ($strSqlite3FieldType) {
                  case 'TINYINT':
                  case 'BOOLEAN':
                      if ($this->intMaxLength == 1)
      Severity: Minor
      Found in includes/database/QSqLite3PdoDatabase.class.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

      Method SqlVariable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                      // Are we SqlVariabling a BOOLEAN value?
                      if (is_bool($mixData)) {
                              // Yes
                              if ($blnIncludeEquality) {
      Severity: Major
      Found in includes/database/QSqLite3PdoDatabase.class.php - About 2 hrs to fix

        Method __construct has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct($mixFieldData, $objDb = null, $strTableName=null) {
                $this->strName = $mixFieldData->GetColumn('name');
                // Set strOriginalName to Name if it isn't set
                if (!$this->strOriginalName)
                    $this->strOriginalName = $this->strName;
        Severity: Minor
        Found in includes/database/QSqLite3PdoDatabase.class.php - About 1 hr to fix

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

                  public function SqlLimitVariableSuffix($strLimitInfo) {
                          // Setup limit suffix (if applicable) via a LIMIT clause
                          if (strlen($strLimitInfo)) {
                                  if (strpos($strLimitInfo, ';') !== false)
                                          throw new Exception('Invalid Semicolon in LIMIT Info');
          Severity: Minor
          Found in includes/database/QSqLite3PdoDatabase.class.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 GetForeignKeysForTable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function GetForeignKeysForTable($strTableName) {
                  $objForeignKeyArray = array();
                  $objForeignKeyArrayReturn = array();
                  
                  $strQuery = sprintf('PRAGMA foreign_key_list (%s%s%s)',
          Severity: Minor
          Found in includes/database/QSqLite3PdoDatabase.class.php - About 1 hr to fix

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

                    public function GetIndexesForTable($strTableName) {
                            $objIndexArray = array();
            
                    $objResult = $this->Query(sprintf(
                        'PRAGMA index_list (%s%s%s)',
            Severity: Minor
            Found in includes/database/QSqLite3PdoDatabase.class.php - About 1 hr to fix

              Method GetColumn has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function GetColumn($strColumnName, $strColumnType = null) {
                      if (!isset($this->strColumnArray[$strColumnName])) {
                          return null;
                      }
                      $strColumnValue = $this->strColumnArray[$strColumnName];
              Severity: Minor
              Found in includes/database/QSqLite3PdoDatabase.class.php - About 1 hr to fix

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

                        public function GetIndexesForTable($strTableName) {
                                $objIndexArray = array();
                
                        $objResult = $this->Query(sprintf(
                            'PRAGMA index_list (%s%s%s)',
                Severity: Minor
                Found in includes/database/QSqLite3PdoDatabase.class.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

                Avoid deeply nested control flow statements.
                Open

                                        if ($objIndex->name == $this->strName)
                                            $this->blnUnique = true;
                Severity: Major
                Found in includes/database/QSqLite3PdoDatabase.class.php - About 45 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                                  return $strToReturn . sprintf("'%s'", $mixData->__toString('YYYY-MM-DD'));
                  Severity: Major
                  Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                                            return 'NULL';
                    Severity: Major
                    Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                              return $strToReturn . 'NULL';
                      Severity: Major
                      Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $strToReturn . sprintf("'%s'", addslashes($mixData));
                        Severity: Major
                        Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return new QDateTime($strColumnValue);
                          Severity: Major
                          Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                                            return "= '0'";
                            Severity: Major
                            Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                              return $strToReturn . sprintf("'%s'", $mixData->__toString(QDateTime::FormatIso));
                              Severity: Major
                              Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                                        return "'1'";
                                Severity: Major
                                Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return QType::Cast($strColumnValue, QType::Float);
                                  Severity: Major
                                  Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                    return QType::Cast($strColumnValue, QType::Integer);
                                    Severity: Major
                                    Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                                                      return "!= '0'";
                                      Severity: Major
                                      Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                                                return "'0'";
                                        Severity: Major
                                        Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                                  return $strToReturn . sprintf('%s', $mixData);
                                          Severity: Major
                                          Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                            return $strColumnValue;
                                            Severity: Major
                                            Found in includes/database/QSqLite3PdoDatabase.class.php - About 30 mins to fix

                                              The method __construct() has an NPath complexity of 420. The configured NPath complexity threshold is 200.
                                              Open

                                                  public function __construct($mixFieldData, $objDb = null, $strTableName=null) {
                                                      $this->strName = $mixFieldData->GetColumn('name');
                                                      // Set strOriginalName to Name if it isn't set
                                                      if (!$this->strOriginalName)
                                                          $this->strOriginalName = $this->strName;

                                              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 SqlVariable() has an NPath complexity of 900. The configured NPath complexity threshold is 200.
                                              Open

                                                      public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                                                              // Are we SqlVariabling a BOOLEAN value?
                                                              if (is_bool($mixData)) {
                                                                      // Yes
                                                                      if ($blnIncludeEquality) {

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

                                                  public function GetColumn($strColumnName, $strColumnType = null) {
                                                      if (!isset($this->strColumnArray[$strColumnName])) {
                                                          return null;
                                                      }
                                                      $strColumnValue = $this->strColumnArray[$strColumnName];

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

                                                      public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                                                              // Are we SqlVariabling a BOOLEAN value?
                                                              if (is_bool($mixData)) {
                                                                      // Yes
                                                                      if ($blnIncludeEquality) {

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

                                                  public function __construct($mixFieldData, $objDb = null, $strTableName=null) {
                                                      $this->strName = $mixFieldData->GetColumn('name');
                                                      // Set strOriginalName to Name if it isn't set
                                                      if (!$this->strOriginalName)
                                                          $this->strOriginalName = $this->strName;

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

                                                  protected function SetFieldType($strSqlite3FieldType) {
                                                      switch ($strSqlite3FieldType) {
                                                          case 'TINYINT':
                                                          case 'BOOLEAN':
                                                              if ($this->intMaxLength == 1)

                                              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

                                              Avoid using undefined variables such as '$tmp' which will lead to PHP notices.
                                              Open

                                                              $tmp[] = $objPK->GetColumn('name');

                                              UndefinedVariable

                                              Since: 2.8.0

                                              Detects when a variable is used that has not been defined before.

                                              Example

                                              class Foo
                                              {
                                                  private function bar()
                                                  {
                                                      // $message is undefined
                                                      echo $message;
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                                              Avoid using undefined variables such as '$tmp' which will lead to PHP notices.
                                              Open

                                                              unset($tmp);

                                              UndefinedVariable

                                              Since: 2.8.0

                                              Detects when a variable is used that has not been defined before.

                                              Example

                                              class Foo
                                              {
                                                  private function bar()
                                                  {
                                                      // $message is undefined
                                                      echo $message;
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                                              Avoid using undefined variables such as '$tmp' which will lead to PHP notices.
                                              Open

                                                              $objIndex = new QDatabaseIndex('(' . $strTableName . ' autoindex 1)', true, true, $tmp);    

                                              UndefinedVariable

                                              Since: 2.8.0

                                              Detects when a variable is used that has not been defined before.

                                              Example

                                              class Foo
                                              {
                                                  private function bar()
                                                  {
                                                      // $message is undefined
                                                      echo $message;
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                                              Missing class import via use statement (line '34', column '27').
                                              Open

                                                                      $this->objPdo = new PDO($strDsn);

                                              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

                                              The method SqlVariable has a boolean flag argument $blnIncludeEquality, which is a certain sign of a Single Responsibility Principle violation.
                                              Open

                                                      public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {

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

                                                      public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {

                                              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

                                              Missing class import via use statement (line '155', column '19').
                                              Open

                                                                              throw new Exception('Invalid Semicolon in ORDER BY Info');

                                              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

                                              Missing class import via use statement (line '325', column '41').
                                              Open

                                                                      array_push($objArrayToReturn, new QSqLite3PdoDatabaseField($objField, $this->objDb));

                                              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

                                              Missing class import via use statement (line '243', column '21').
                                              Open

                                                              $objIndex = new QDatabaseIndex($objIndexList->GetColumn('name'), false, $blnUnique, $arrIndex);    

                                              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

                                              Missing class import via use statement (line '303', column '42').
                                              Open

                                                              $objPdoStatementDatabaseResult = new QSqLite3PdoDatabaseResult($objResult, $this);

                                              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

                                              Missing class import via use statement (line '332', column '18').
                                              Open

                                                                      return new QSqLite3PdoDatabaseField($objField, $this->objDb);

                                              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

                                              Missing class import via use statement (line '254', column '21').
                                              Open

                                                              $objIndex = new QDatabaseIndex('(' . $strTableName . ' autoindex 1)', true, true, $tmp);    

                                              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

                                              Missing class import via use statement (line '299', column '16').
                                              Open

                                                                  throw new QSqLite3PdoDatabaseException($this->objPdo->errorInfo(), $this->objPdo->errorCode(), $strQuery);

                                              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

                                              Missing class import via use statement (line '200', column '17').
                                              Open

                                                                      throw new Exception('Invalid Key Definition: ' . $strKeyDefinition);

                                              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

                                              Missing class import via use statement (line '376', column '16').
                                              Open

                                                              return new QDateTime($strColumnValue);

                                              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

                                              Missing class import via use statement (line '157', column '19').
                                              Open

                                                                              throw new Exception('Invalid Backtick in ORDER BY Info');

                                              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

                                              Missing class import via use statement (line '184', column '34').
                                              Open

                                                                      array_push($objFields, new QSqLite3PdoDatabaseField($objRow, $this));

                                              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

                                              Missing class import via use statement (line '134', column '19').
                                              Open

                                                                              throw new Exception('Invalid Backtick in LIMIT Info');

                                              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

                                              Missing class import via use statement (line '438', column '15').
                                              Open

                                                              throw new Exception('Not a valid Column Length: ' . $mixFieldData->GetColumn('type'));

                                              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

                                              Missing class import via use statement (line '132', column '19').
                                              Open

                                                                              throw new Exception('Invalid Semicolon in LIMIT Info');

                                              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

                                              Missing class import via use statement (line '145', column '19').
                                              Open

                                                                              throw new QSqLite3DatabaseException('Invalid Limit Info: ' . $strLimitInfo, 0, null);

                                              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

                                              Missing class import via use statement (line '205', column '17').
                                              Open

                                                                      throw new Exception('Invalid Key Definition: ' . $strKeyDefinition);

                                              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

                                              Missing class import via use statement (line '289', column '25').
                                              Open

                                                          $objForeignKey = new QDatabaseForeignKey($Key[0], $arrFrom, $Key[2], $arrTo);

                                              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

                                              Missing class import via use statement (line '537', column '15').
                                              Open

                                                              throw new Exception('Unable to determine Sqlite3 Database Field Type: ' . $strSqlite3FieldType);

                                              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

                                              Missing class import via use statement (line '36', column '17').
                                              Open

                                                                      throw new QSqLite3PdoDatabaseException(sprintf('Unable to connect to Database: %s',$expPgSql->getMessage()), -1, null);

                                              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

                                              Missing class import via use statement (line '317', column '18').
                                              Open

                                                                      return new QSqLite3PdoDatabaseRow($strColumnArray);

                                              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

                                              The method SqlLimitVariableSuffix uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                              Open

                                                                      } else {
                                                                              throw new QSqLite3DatabaseException('Invalid Limit Info: ' . $strLimitInfo, 0, null);
                                                                      }

                                              ElseExpression

                                              Since: 1.4.0

                                              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                              Example

                                              class Foo
                                              {
                                                  public function bar($flag)
                                                  {
                                                      if ($flag) {
                                                          // one branch
                                                      } else {
                                                          // another branch
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#elseexpression

                                              Avoid assigning values to variables in if clauses and the like (line '331', column '9').
                                              Open

                                                      public function FetchField() {
                                                              if ($objField = $this->FetchColumn())
                                                                      return new QSqLite3PdoDatabaseField($objField, $this->objDb);
                                                      }

                                              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 using static access to class 'QType' in method 'GetColumn'.
                                              Open

                                                              return QType::Cast($strColumnValue, QType::String);

                                              StaticAccess

                                              Since: 1.4.0

                                              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                              Example

                                              class Foo
                                              {
                                                  public function bar()
                                                  {
                                                      Bar::baz();
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#staticaccess

                                              Avoid using static access to class 'QType' in method 'GetColumn'.
                                              Open

                                                              return QType::Cast($strColumnValue, QType::Integer);

                                              StaticAccess

                                              Since: 1.4.0

                                              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                              Example

                                              class Foo
                                              {
                                                  public function bar()
                                                  {
                                                      Bar::baz();
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#staticaccess

                                              Avoid assigning values to variables in if clauses and the like (line '465', column '8').
                                              Open

                                                  public function __construct($mixFieldData, $objDb = null, $strTableName=null) {
                                                      $this->strName = $mixFieldData->GetColumn('name');
                                                      // Set strOriginalName to Name if it isn't set
                                                      if (!$this->strOriginalName)
                                                          $this->strOriginalName = $this->strName;

                                              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 using static access to class 'QType' in method 'GetColumn'.
                                              Open

                                                              return QType::Cast($strColumnValue, QType::Float);

                                              StaticAccess

                                              Since: 1.4.0

                                              Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                              Example

                                              class Foo
                                              {
                                                  public function bar()
                                                  {
                                                      Bar::baz();
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#staticaccess

                                              The method SqlVariable uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                              Open

                                                                              } else {
                                                                                      // Check against NULL, True then False
                                                                                      if (is_null($mixData))
                                                                                              return 'IS NULL';
                                                                                      else if ($mixData)

                                              ElseExpression

                                              Since: 1.4.0

                                              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                              Example

                                              class Foo
                                              {
                                                  public function bar($flag)
                                                  {
                                                      if ($flag) {
                                                          // one branch
                                                      } else {
                                                          // another branch
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#elseexpression

                                              The method SqlVariable uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                              Open

                                                                      } else {
                                                                              if (is_null($mixData))
                                                                                      $strToReturn = 'IS ';
                                                                              else
                                                                                      $strToReturn = '= ';

                                              ElseExpression

                                              Since: 1.4.0

                                              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                              Example

                                              class Foo
                                              {
                                                  public function bar($flag)
                                                  {
                                                      if ($flag) {
                                                          // one branch
                                                      } else {
                                                          // another branch
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#elseexpression

                                              The method GetColumn uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                              Open

                                                              } else {
                                                                  return ($strColumnValue) ? true : false;
                                                              }

                                              ElseExpression

                                              Since: 1.4.0

                                              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                              Example

                                              class Foo
                                              {
                                                  public function bar($flag)
                                                  {
                                                      if ($flag) {
                                                          // one branch
                                                      } else {
                                                          // another branch
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#elseexpression

                                              The method SqlVariable uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                              Open

                                                                      } else {
                                                                              // Check against NULL, True then False
                                                                              if (is_null($mixData))
                                                                                      return 'NULL';
                                                                              else if ($mixData)

                                              ElseExpression

                                              Since: 1.4.0

                                              An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                              Example

                                              class Foo
                                              {
                                                  public function bar($flag)
                                                  {
                                                      if ($flag) {
                                                          // one branch
                                                      } else {
                                                          // another branch
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/cleancode.html#elseexpression

                                              Avoid unused parameters such as '$strColumnName'.
                                              Open

                                                      public function InsertId($strTableName = null, $strColumnName = null) {

                                              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 private methods such as 'ParseColumnNameArrayFromKeyDefinition'.
                                              Open

                                                      private function ParseColumnNameArrayFromKeyDefinition($strKeyDefinition) {
                                                              $strKeyDefinition = trim($strKeyDefinition);
                                              
                                                              // Get rid of the opening "(" and the closing ")"
                                                              $intPosition = strpos($strKeyDefinition, '(');

                                              UnusedPrivateMethod

                                              Since: 0.2

                                              Unused Private Method detects when a private method is declared but is unused.

                                              Example

                                              class Something
                                              {
                                                  private function foo() {} // unused
                                              }

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

                                              Avoid unused parameters such as '$strLimitInfo'.
                                              Open

                                                      public function SqlLimitVariablePrefix($strLimitInfo) {

                                              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 '$strTableName'.
                                              Open

                                                      public function InsertId($strTableName = null, $strColumnName = null) {

                                              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 '$strPKNames'.
                                              Open

                                                      public function InsertOrUpdate($strTable, $mixColumnsAndValuesArray, $strPKNames = null) {

                                              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 using count() function in for loops.
                                              Open

                                                              for ($intIndex = 0; $intIndex < count($strToReturn); $intIndex++) {
                                                                      $strColumn = $strToReturn[$intIndex];
                                              
                                                                      if (substr($strColumn, 0, 1) == '"')
                                                                              $strColumn = substr($strColumn, 1, strpos($strColumn, '"', 1) - 1);

                                              CountInLoopExpression

                                              Since: 2.7.0

                                              Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

                                              Example

                                              class Foo {
                                              
                                                public function bar()
                                                {
                                                  $array = array();
                                              
                                                  for ($i = 0; count($array); $i++) {
                                                    // ...
                                                  }
                                                }
                                              }

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

                                              TODO found
                                              Open

                                                  //TODO: Tables and Unique

                                              TODO found
                                              Open

                                                      //TODO:table

                                              TODO found
                                              Open

                                                              // TODO: Current method doesn't support key names with commas or parenthesis in them!

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

                                                      public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                                                              // Are we SqlVariabling a BOOLEAN value?
                                                              if (is_bool($mixData)) {
                                                                      // Yes
                                                                      if ($blnIncludeEquality) {
                                              Severity: Major
                                              Found in includes/database/QSqLite3PdoDatabase.class.php and 1 other location - About 1 day to fix
                                              includes/database/QInformixPdoDatabase.class.php on lines 114..185

                                              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 384.

                                              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

                                              Further Reading

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

                                              class QSqLite3PdoDatabaseRow extends QDatabaseRowBase {
                                                  protected $strColumnArray;
                                              
                                                  public function __construct($strColumnArray) {
                                                      $this->strColumnArray = $strColumnArray;
                                              Severity: Major
                                              Found in includes/database/QSqLite3PdoDatabase.class.php and 2 other locations - About 1 day to fix
                                              includes/database/QInformixPdoDatabase.class.php on lines 651..714
                                              includes/database/QPostgreSqlPdoDatabase.class.php on lines 444..509

                                              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 272.

                                              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

                                              Further Reading

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

                                                      public function SqlLimitVariableSuffix($strLimitInfo) {
                                                              // Setup limit suffix (if applicable) via a LIMIT clause
                                                              if (strlen($strLimitInfo)) {
                                                                      if (strpos($strLimitInfo, ';') !== false)
                                                                              throw new Exception('Invalid Semicolon in LIMIT Info');
                                              Severity: Major
                                              Found in includes/database/QSqLite3PdoDatabase.class.php and 3 other locations - About 6 hrs to fix
                                              includes/database/QInformixPdoDatabase.class.php on lines 195..218
                                              includes/database/QPostgreSqlDatabase.class.php on lines 127..149
                                              includes/database/QPostgreSqlPdoDatabase.class.php on lines 164..186

                                              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 209.

                                              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

                                              Further Reading

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

                                              class QSqLite3PdoDatabaseResult extends QPdoDatabaseResult {
                                              
                                                      public function GetNextRow() {
                                                              $strColumnArray = $this->FetchArray();
                                              
                                              
                                              Severity: Major
                                              Found in includes/database/QSqLite3PdoDatabase.class.php and 2 other locations - About 2 hrs to fix
                                              includes/database/QInformixPdoDatabase.class.php on lines 623..647
                                              includes/database/QPostgreSqlPdoDatabase.class.php on lines 416..440

                                              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 127.

                                              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

                                              Further Reading

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

                                                      protected function ExecuteQuery($strQuery) {
                                                              // Perform the Query
                                                              $objResult = $this->objPdo->query($strQuery);
                                                              if ($objResult === false)
                                                                  throw new QSqLite3PdoDatabaseException($this->objPdo->errorInfo(), $this->objPdo->errorCode(), $strQuery);
                                              Severity: Minor
                                              Found in includes/database/QSqLite3PdoDatabase.class.php and 1 other location - About 30 mins to fix
                                              includes/database/QPostgreSqlPdoDatabase.class.php on lines 399..409

                                              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 90.

                                              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

                                              Further Reading

                                              Avoid excessively long variable names like $objForeignKeyArrayReturn. Keep variable name length under 20.
                                              Open

                                                      $objForeignKeyArrayReturn = array();

                                              LongVariable

                                              Since: 0.2

                                              Detects when a field, formal or local variable is declared with a long name.

                                              Example

                                              class Something {
                                                  protected $reallyLongIntName = -3; // VIOLATION - Field
                                                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                                      $otherReallyLongName = -5; // VIOLATION - Local
                                                      for ($interestingIntIndex = 0; // VIOLATION - For
                                                           $interestingIntIndex < 10;
                                                           $interestingIntIndex++ ) {
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/naming.html#longvariable

                                              Avoid excessively long variable names like $mixColumnsAndValuesArray. Keep variable name length under 20.
                                              Open

                                                      public function InsertOrUpdate($strTable, $mixColumnsAndValuesArray, $strPKNames = null) {

                                              LongVariable

                                              Since: 0.2

                                              Detects when a field, formal or local variable is declared with a long name.

                                              Example

                                              class Something {
                                                  protected $reallyLongIntName = -3; // VIOLATION - Field
                                                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                                      $otherReallyLongName = -5; // VIOLATION - Local
                                                      for ($interestingIntIndex = 0; // VIOLATION - For
                                                           $interestingIntIndex < 10;
                                                           $interestingIntIndex++ ) {
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/naming.html#longvariable

                                              Avoid excessively long variable names like $strEscapeIdentifierBeginInternal. Keep variable name length under 20.
                                              Open

                                                  protected $strEscapeIdentifierBeginInternal = '\'';

                                              LongVariable

                                              Since: 0.2

                                              Detects when a field, formal or local variable is declared with a long name.

                                              Example

                                              class Something {
                                                  protected $reallyLongIntName = -3; // VIOLATION - Field
                                                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                                      $otherReallyLongName = -5; // VIOLATION - Local
                                                      for ($interestingIntIndex = 0; // VIOLATION - For
                                                           $interestingIntIndex < 10;
                                                           $interestingIntIndex++ ) {
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/naming.html#longvariable

                                              Avoid excessively long variable names like $strEscapeIdentifierEndInternal. Keep variable name length under 20.
                                              Open

                                                  protected $strEscapeIdentifierEndInternal = '\'';    

                                              LongVariable

                                              Since: 0.2

                                              Detects when a field, formal or local variable is declared with a long name.

                                              Example

                                              class Something {
                                                  protected $reallyLongIntName = -3; // VIOLATION - Field
                                                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                                      $otherReallyLongName = -5; // VIOLATION - Local
                                                      for ($interestingIntIndex = 0; // VIOLATION - For
                                                           $interestingIntIndex < 10;
                                                           $interestingIntIndex++ ) {
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/naming.html#longvariable

                                              Avoid excessively long variable names like $objPdoStatementDatabaseResult. Keep variable name length under 20.
                                              Open

                                                              $objPdoStatementDatabaseResult = new QSqLite3PdoDatabaseResult($objResult, $this);

                                              LongVariable

                                              Since: 0.2

                                              Detects when a field, formal or local variable is declared with a long name.

                                              Example

                                              class Something {
                                                  protected $reallyLongIntName = -3; // VIOLATION - Field
                                                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                                      $otherReallyLongName = -5; // VIOLATION - Local
                                                      for ($interestingIntIndex = 0; // VIOLATION - For
                                                           $interestingIntIndex < 10;
                                                           $interestingIntIndex++ ) {
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/naming.html#longvariable

                                              Avoid excessively long variable names like $strEscapeIdentifierEnd. Keep variable name length under 20.
                                              Open

                                                  protected $strEscapeIdentifierEnd = '';

                                              LongVariable

                                              Since: 0.2

                                              Detects when a field, formal or local variable is declared with a long name.

                                              Example

                                              class Something {
                                                  protected $reallyLongIntName = -3; // VIOLATION - Field
                                                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                                      $otherReallyLongName = -5; // VIOLATION - Local
                                                      for ($interestingIntIndex = 0; // VIOLATION - For
                                                           $interestingIntIndex < 10;
                                                           $interestingIntIndex++ ) {
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/naming.html#longvariable

                                              Avoid excessively long variable names like $strEscapeIdentifierBegin. Keep variable name length under 20.
                                              Open

                                                  protected $strEscapeIdentifierBegin = '';

                                              LongVariable

                                              Since: 0.2

                                              Detects when a field, formal or local variable is declared with a long name.

                                              Example

                                              class Something {
                                                  protected $reallyLongIntName = -3; // VIOLATION - Field
                                                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                                      $otherReallyLongName = -5; // VIOLATION - Local
                                                      for ($interestingIntIndex = 0; // VIOLATION - For
                                                           $interestingIntIndex < 10;
                                                           $interestingIntIndex++ ) {
                                                      }
                                                  }
                                              }

                                              Source https://phpmd.org/rules/naming.html#longvariable

                                              Constant Adapter should be defined in uppercase
                                              Open

                                                  const Adapter = 'SqLite3 PDO Database Adapter';

                                              ConstantNamingConventions

                                              Since: 0.2

                                              Class/Interface constant names should always be defined in uppercase.

                                              Example

                                              class Foo {
                                                  const MY_NUM = 0; // ok
                                                  const myTest = ""; // fail
                                              }

                                              Source https://phpmd.org/rules/naming.html#constantnamingconventions

                                              The variable $Key is not named in camelCase.
                                              Open

                                                      public function GetForeignKeysForTable($strTableName) {
                                                      $objForeignKeyArray = array();
                                                      $objForeignKeyArrayReturn = array();
                                                      
                                                      $strQuery = sprintf('PRAGMA foreign_key_list (%s%s%s)',

                                              CamelCaseVariableName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name variables.

                                              Example

                                              class ClassName {
                                                  public function doSomething() {
                                                      $data_module = new DataModule();
                                                  }
                                              }

                                              Source

                                              The variable $Key is not named in camelCase.
                                              Open

                                                      public function GetForeignKeysForTable($strTableName) {
                                                      $objForeignKeyArray = array();
                                                      $objForeignKeyArrayReturn = array();
                                                      
                                                      $strQuery = sprintf('PRAGMA foreign_key_list (%s%s%s)',

                                              CamelCaseVariableName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name variables.

                                              Example

                                              class ClassName {
                                                  public function doSomething() {
                                                      $data_module = new DataModule();
                                                  }
                                              }

                                              Source

                                              The variable $Key is not named in camelCase.
                                              Open

                                                      public function GetForeignKeysForTable($strTableName) {
                                                      $objForeignKeyArray = array();
                                                      $objForeignKeyArrayReturn = array();
                                                      
                                                      $strQuery = sprintf('PRAGMA foreign_key_list (%s%s%s)',

                                              CamelCaseVariableName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name variables.

                                              Example

                                              class ClassName {
                                                  public function doSomething() {
                                                      $data_module = new DataModule();
                                                  }
                                              }

                                              Source

                                              The variable $Key is not named in camelCase.
                                              Open

                                                      public function GetForeignKeysForTable($strTableName) {
                                                      $objForeignKeyArray = array();
                                                      $objForeignKeyArrayReturn = array();
                                                      
                                                      $strQuery = sprintf('PRAGMA foreign_key_list (%s%s%s)',

                                              CamelCaseVariableName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name variables.

                                              Example

                                              class ClassName {
                                                  public function doSomething() {
                                                      $data_module = new DataModule();
                                                  }
                                              }

                                              Source

                                              The variable $Key is not named in camelCase.
                                              Open

                                                      public function GetForeignKeysForTable($strTableName) {
                                                      $objForeignKeyArray = array();
                                                      $objForeignKeyArrayReturn = array();
                                                      
                                                      $strQuery = sprintf('PRAGMA foreign_key_list (%s%s%s)',

                                              CamelCaseVariableName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name variables.

                                              Example

                                              class ClassName {
                                                  public function doSomething() {
                                                      $data_module = new DataModule();
                                                  }
                                              }

                                              Source

                                              The method InsertOrUpdate is not named in camelCase.
                                              Open

                                                      public function InsertOrUpdate($strTable, $mixColumnsAndValuesArray, $strPKNames = null) {
                                                          $strEscapedArray = $this->EscapeIdentifiersAndValues($mixColumnsAndValuesArray);
                                                          $strSql = sprintf('INSERT OR REPLACE INTO %s%s%s (%s) VALUES (%s)',
                                                              $this->EscapeIdentifierBegin, $strTable, $this->EscapeIdentifierEnd,
                                                              implode(', ', array_keys($strEscapedArray)),

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method SqlLimitVariableSuffix is not named in camelCase.
                                              Open

                                                      public function SqlLimitVariableSuffix($strLimitInfo) {
                                                              // Setup limit suffix (if applicable) via a LIMIT clause
                                                              if (strlen($strLimitInfo)) {
                                                                      if (strpos($strLimitInfo, ';') !== false)
                                                                              throw new Exception('Invalid Semicolon in LIMIT Info');

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method GetTables is not named in camelCase.
                                              Open

                                                      public function GetTables() {
                                                              $objResult = $this->Query('SELECT name FROM sqlite_master WHERE type = "table"');
                                                              $strToReturn = array();
                                                              while ($strRowArray = $objResult->FetchRow())
                                                          if (strpos($strRowArray[0], 'sqlite') === false) 

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method SetFieldType is not named in camelCase.
                                              Open

                                                  protected function SetFieldType($strSqlite3FieldType) {
                                                      switch ($strSqlite3FieldType) {
                                                          case 'TINYINT':
                                                          case 'BOOLEAN':
                                                              if ($this->intMaxLength == 1)

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method SqlSortByVariable is not named in camelCase.
                                              Open

                                                      public function SqlSortByVariable($strSortByInfo) {
                                                              // Setup sorting information (if applicable) via a ORDER BY clause
                                                              if (strlen($strSortByInfo)) {
                                                                      if (strpos($strSortByInfo, ';') !== false)
                                                                              throw new Exception('Invalid Semicolon in ORDER BY Info');

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method SqlLimitVariablePrefix is not named in camelCase.
                                              Open

                                                      public function SqlLimitVariablePrefix($strLimitInfo) {
                                                              // SqLite3 uses Limit by Suffixes (via a LIMIT clause)
                                                              // Prefix is not used, therefore, return null
                                                              return null;
                                                      }

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method Connect is not named in camelCase.
                                              Open

                                                      public function Connect() {
                                                              // Lookup Adapter-Specific Connection Properties
                                                              $strDsn = sprintf('%s:%s', QSqLite3PdoDatabase::PDO_SQLITE3_DSN_IDENTIFIER, $this->Database);
                                                              // Connect to the Database Server
                                                              try {

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method SqlVariable is not named in camelCase.
                                              Open

                                                      public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                                                              // Are we SqlVariabling a BOOLEAN value?
                                                              if (is_bool($mixData)) {
                                                                      // Yes
                                                                      if ($blnIncludeEquality) {

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method GetForeignKeysForTable is not named in camelCase.
                                              Open

                                                      public function GetForeignKeysForTable($strTableName) {
                                                      $objForeignKeyArray = array();
                                                      $objForeignKeyArrayReturn = array();
                                                      
                                                      $strQuery = sprintf('PRAGMA foreign_key_list (%s%s%s)',

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method GetFieldsForTable is not named in camelCase.
                                              Open

                                                      public function GetFieldsForTable($strTableName) {
                                                      $strQuery = sprintf('PRAGMA table_info (%s%s%s)',
                                                          $this->strEscapeIdentifierBeginInternal,
                                                          $strTableName,
                                                          $this->strEscapeIdentifierEndInternal);

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method FetchFields is not named in camelCase.
                                              Open

                                                      public function FetchFields() {
                                                              $objArrayToReturn = array();
                                                              while ($objField = $this->FetchColumn()) {
                                                                      array_push($objArrayToReturn, new QSqLite3PdoDatabaseField($objField, $this->objDb));
                                                              }

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method ParseColumnNameArrayFromKeyDefinition is not named in camelCase.
                                              Open

                                                      private function ParseColumnNameArrayFromKeyDefinition($strKeyDefinition) {
                                                              $strKeyDefinition = trim($strKeyDefinition);
                                              
                                                              // Get rid of the opening "(" and the closing ")"
                                                              $intPosition = strpos($strKeyDefinition, '(');

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method GetIndexesForTable is not named in camelCase.
                                              Open

                                                      public function GetIndexesForTable($strTableName) {
                                                              $objIndexArray = array();
                                              
                                                      $objResult = $this->Query(sprintf(
                                                          'PRAGMA index_list (%s%s%s)',

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method ExecuteQuery is not named in camelCase.
                                              Open

                                                      protected function ExecuteQuery($strQuery) {
                                                              // Perform the Query
                                                              $objResult = $this->objPdo->query($strQuery);
                                                              if ($objResult === false)
                                                                  throw new QSqLite3PdoDatabaseException($this->objPdo->errorInfo(), $this->objPdo->errorCode(), $strQuery);

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method FetchField is not named in camelCase.
                                              Open

                                                      public function FetchField() {
                                                              if ($objField = $this->FetchColumn())
                                                                      return new QSqLite3PdoDatabaseField($objField, $this->objDb);
                                                      }

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method GetColumn is not named in camelCase.
                                              Open

                                                  public function GetColumn($strColumnName, $strColumnType = null) {
                                                      if (!isset($this->strColumnArray[$strColumnName])) {
                                                          return null;
                                                      }
                                                      $strColumnValue = $this->strColumnArray[$strColumnName];

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method Close is not named in camelCase.
                                              Open

                                                      public function Close() {
                                                          parent::Close();
                                              
                                                          // Update Connected Flag
                                                          $this->blnConnectedFlag = false;

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method InsertId is not named in camelCase.
                                              Open

                                                      public function InsertId($strTableName = null, $strColumnName = null) {
                                                      return $this->objPdo->lastInsertId();
                                                      }

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method GetNextRow is not named in camelCase.
                                              Open

                                                      public function GetNextRow() {
                                                              $strColumnArray = $this->FetchArray();
                                              
                                                              if ($strColumnArray)
                                                                      return new QSqLite3PdoDatabaseRow($strColumnArray);

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method ColumnExists is not named in camelCase.
                                              Open

                                                  public function ColumnExists($strColumnName) {
                                                      return array_key_exists($strColumnName, $this->strColumnArray);
                                                  }

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              The method GetColumnNameArray is not named in camelCase.
                                              Open

                                                  public function GetColumnNameArray() {
                                                          return $this->strColumnArray;
                                                  }

                                              CamelCaseMethodName

                                              Since: 0.2

                                              It is considered best practice to use the camelCase notation to name methods.

                                              Example

                                              class ClassName {
                                                  public function get_name() {
                                                  }
                                              }

                                              Source

                                              There are no issues that match your filters.

                                              Category
                                              Status