detain/db_abstraction

View on GitHub

Showing 88 of 88 total issues

Avoid classes with short names like Db. Configured minimum length is 3.
Open

class Db extends Generic implements Db_Interface
{
    /* public: this is an api revision, not a CVS revision. */
    public $type = 'pgsql';
    public $port = '';
Severity: Minor
Found in src/Pgsql/Db.php by phpmd

ShortClassName

Since: 2.9

Detects when classes or interfaces have a very short name.

Example

class Fo {

}

interface Fo {

}

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

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

    public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '', $port = '');
Severity: Minor
Found in src/Db_Interface.php - About 45 mins to fix

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

        public function lock($table, $mode = 'write')
        {
            $result = $this->transactionBegin();
    
            if ($mode == 'write') {
    Severity: Minor
    Found in src/Pgsql/Db.php - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        public function __construct($Type = '', $database = '', $user = '', $password = '', $host = 'localhost', $query = '')
    Severity: Minor
    Found in src/Loader.php - About 45 mins to fix

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

          public function __construct($database = '', $user = '', $password = '', $host = 'localhost', $query = '', $port = '')
      Severity: Minor
      Found in src/Generic.php - About 45 mins to fix

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

            public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql')
        Severity: Minor
        Found in src/Adodb/Db.php - About 35 mins to fix

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

              public function connect($database = '', $host = '', $user = '', $password = '', $driver = 'mysql')
          Severity: Minor
          Found in src/Pdo/Db.php - About 35 mins to fix

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

                public function connect($database = '', $host = '', $user = '', $password = '', $port = '')
            Severity: Minor
            Found in src/Mysqli/Db.php - About 35 mins to fix

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

                  public function limitQuery($queryString, $numRows = '', $offset = 0, $line = '', $file = '')
              Severity: Minor
              Found in src/Generic.php - About 35 mins to fix

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

                    public function query($queryString, $line = '', $file = '')
                    {
                        /* No empty queries, please, since PHP4 chokes on them. */
                        /* The empty query string is passed on from the constructor,
                        * when calling the class without a query, e.g. in situations
                Severity: Minor
                Found in src/Adodb/Db.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                    public function query($queryString, $line = '', $file = '')
                    {
                        /* No empty queries, please, since PHP4 chokes on them. */
                        /* The empty query string is passed on from the constructor,
                        * when calling the class without a query, e.g. in situations
                Severity: Minor
                Found in src/Pdo/Db.php - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

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

                            (new \MyAdmin\Mail())->adminMail($subject, $email, 'john@interserver.net', '');
                Severity: Minor
                Found in src/Generic.php by phpmd

                MissingImport

                Since: 2.7.0

                Importing all external classes in a file through use statements makes them clearly visible.

                Example

                function make() {
                    return new \stdClass();
                }

                Source http://phpmd.org/rules/cleancode.html#MissingImport

                Remove error control operator '@' on line 472.
                Open

                    public function affectedRows()
                    {
                        return @mysqli_affected_rows($this->linkId);
                    }
                Severity: Minor
                Found in src/Mysqli/Db.php by phpmd

                ErrorControlOperator

                Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                Example

                function foo($filePath) {
                    $file = @fopen($filPath); // hides exceptions
                    $key = @$array[$notExistingKey]; // assigns null to $key
                }

                Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                Avoid too many return statements within this method.
                Open

                        return $Record[0];
                Severity: Major
                Found in src/Pgsql/Db.php - About 30 mins to fix

                  Remove error control operator '@' on line 258.
                  Open

                      public function query($queryString, $line = '', $file = '')
                      {
                          /* No empty queries, please, since PHP4 chokes on them. */
                          /* The empty query string is passed on from the constructor,
                          * when calling the class without a query, e.g. in situations
                  Severity: Minor
                  Found in src/Mysqli/Db.php by phpmd

                  ErrorControlOperator

                  Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                  Example

                  function foo($filePath) {
                      $file = @fopen($filPath); // hides exceptions
                      $key = @$array[$notExistingKey]; // assigns null to $key
                  }

                  Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                  Remove error control operator '@' on line 106.
                  Open

                      public function disconnect()
                      {
                          return @pg_close($this->linkId);
                      }
                  Severity: Minor
                  Found in src/Pgsql/Db.php by phpmd

                  ErrorControlOperator

                  Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                  Example

                  function foo($filePath) {
                      $file = @fopen($filPath); // hides exceptions
                      $key = @$array[$notExistingKey]; // assigns null to $key
                  }

                  Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

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

                              (new \MyAdmin\Mail())->adminMail($subject, $email, 'detain@interserver.net', '');
                  Severity: Minor
                  Found in src/Generic.php by phpmd

                  MissingImport

                  Since: 2.7.0

                  Importing all external classes in a file through use statements makes them clearly visible.

                  Example

                  function make() {
                      return new \stdClass();
                  }

                  Source http://phpmd.org/rules/cleancode.html#MissingImport

                  Remove error control operator '@' on line 279.
                  Open

                      public function query($queryString, $line = '', $file = '')
                      {
                          /* No empty queries, please, since PHP4 chokes on them. */
                          /* The empty query string is passed on from the constructor,
                          * when calling the class without a query, e.g. in situations
                  Severity: Minor
                  Found in src/Mysqli/Db.php by phpmd

                  ErrorControlOperator

                  Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                  Example

                  function foo($filePath) {
                      $file = @fopen($filPath); // hides exceptions
                      $key = @$array[$notExistingKey]; // assigns null to $key
                  }

                  Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                  Remove error control operator '@' on line 439.
                  Open

                      public function lock($table, $mode = 'write')
                      {
                          $this->connect();
                          $query = 'lock tables ';
                          if (is_array($table)) {
                  Severity: Minor
                  Found in src/Mysqli/Db.php by phpmd

                  ErrorControlOperator

                  Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                  Example

                  function foo($filePath) {
                      $file = @fopen($filPath); // hides exceptions
                      $key = @$array[$notExistingKey]; // assigns null to $key
                  }

                  Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                  Remove error control operator '@' on line 332.
                  Open

                      public function affectedRows()
                      {
                          return @$this->linkId->Affected_Rows();
                          //            return @$this->queryId->rowCount();
                      }
                  Severity: Minor
                  Found in src/Adodb/Db.php by phpmd

                  ErrorControlOperator

                  Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                  Example

                  function foo($filePath) {
                      $file = @fopen($filPath); // hides exceptions
                      $key = @$array[$notExistingKey]; // assigns null to $key
                  }

                  Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                  Severity
                  Category
                  Status
                  Source
                  Language