Asymptix/Framework

View on GitHub
framework/db/DBObject.php

Summary

Maintainability
D
1 day
Test Coverage

DBObject has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class DBObject extends \Asymptix\core\BasicObject {

    /**
     * Status constants.
     */
Severity: Minor
Found in framework/db/DBObject.php - About 4 hrs to fix

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

    abstract class DBObject extends \Asymptix\core\BasicObject {
    
        /**
         * Status constants.
         */
    Severity: Minor
    Found in framework/db/DBObject.php by phpmd

    The class DBObject has 25 public methods. Consider refactoring DBObject to keep number of public methods under 10.
    Open

    abstract class DBObject extends \Asymptix\core\BasicObject {
    
        /**
         * Status constants.
         */
    Severity: Minor
    Found in framework/db/DBObject.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    Function go has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function go($debug = false) {
            switch ($this->dbQuery->getType()) {
                case (DBQueryType::SELECT):
                    $this->dbQuery->query = "SELECT * FROM " . static::TABLE_NAME;
                    break;
    Severity: Minor
    Found in framework/db/DBObject.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

    File DBObject.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Asymptix\db;
    
    use Asymptix\core\Tools;
    Severity: Minor
    Found in framework/db/DBObject.php - About 2 hrs to fix

      Method go has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function go($debug = false) {
              switch ($this->dbQuery->getType()) {
                  case (DBQueryType::SELECT):
                      $this->dbQuery->query = "SELECT * FROM " . static::TABLE_NAME;
                      break;
      Severity: Minor
      Found in framework/db/DBObject.php - About 1 hr to fix

        Function initQuery has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function initQuery($queryType, $conditions = [], $fields = []) {
                $this->dbQuery = new DBPreparedQuery();
        
                $this->dbQuery->setType($queryType);
        
        
        Severity: Minor
        Found in framework/db/DBObject.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

        The method go() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        Open

            public function go($debug = false) {
                switch ($this->dbQuery->getType()) {
                    case (DBQueryType::SELECT):
                        $this->dbQuery->query = "SELECT * FROM " . static::TABLE_NAME;
                        break;
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

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

            public function save($debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

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

            public function insert($ignore = false, $debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 '576', column '20').
        Open

                $ref = new \ReflectionClass(get_called_class());
        Severity: Minor
        Found in framework/db/DBObject.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

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

            public static function _get($recordId, $debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

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

            public static function _min($field, $conditions = [], $debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

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

            public function insert($ignore = false, $debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 '437', column '20').
        Open

                $ref = new \ReflectionClass(get_called_class());
        Severity: Minor
        Found in framework/db/DBObject.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

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

            public function go($debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 '330', column '20').
        Open

                $ref = new \ReflectionClass(get_called_class());
        Severity: Minor
        Found in framework/db/DBObject.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

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

            public static function _count($conditions = [], $debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

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

            public static function _max($field, $conditions = [], $debug = false) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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

        Avoid using static access to class 'Asymptix\db\DBCore' in method 'save'.
        Open

                    $insertionId = DBCore::insertDBObject($this, false, $debug);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 'Asymptix\db\DBCore' in method 'saveRemovementFlag'.
        Open

                return DBCore::doUpdateQuery(
                    "UPDATE " . static::TABLE_NAME . "
                        SET removed = ?
                     WHERE " . static::ID_FIELD_NAME . " = ?
                     LIMIT 1",
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 limit uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $this->dbQuery->limit = [$offset, $count];
                }
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 go uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    if ($this->dbQuery->isSelector()) {
                        $stmt = $this->dbQuery->go();
                        if ($stmt !== false) {
                            $data = null;
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 using static access to class '\Asymptix\core\Tools' in method 'save'.
        Open

                    if (Tools::isInteger($insertionId) && $insertionId > 0) {
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 'Asymptix\db\DBCore' in method 'delete'.
        Open

                return DBCore::deleteDBObject($this);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 changeActivation uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $this->activate();
                }
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 using static access to class 'Asymptix\db\DBCore' in method '_min'.
        Open

                    return DBCore::selectSingleValue($dbQuery);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 'Asymptix\db\DBCore' in method 'go'.
        Open

                                $data = DBCore::selectDBObjectsFromStatement($stmt, $this);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 'Asymptix\db\DBCore' in method 'saveActivationFlag'.
        Open

                return DBCore::doUpdateQuery(
                    "UPDATE " . static::TABLE_NAME . "
                        SET activation = ?
                     WHERE " . static::ID_FIELD_NAME . " = ?
                     LIMIT 1",
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 go uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                            } else {
                                $data = DBCore::selectDBObjectFromStatement($stmt, $this);
                            }
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 changeRemovement uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $this->remove();
                }
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 using static access to class 'Asymptix\db\DBCore' in method 'go'.
        Open

                                $data = DBCore::selectDBObjectFromStatement($stmt, $this);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 'Asymptix\db\DBCore' in method 'insert'.
        Open

                return DBCore::insertDBObject($this, $ignore, $debug);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 'Asymptix\db\DBCore' in method 'save'.
        Open

                DBCore::updateDBObject($this, $debug);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 'Asymptix\db\DBCore' in method '_count'.
        Open

                    return (int)DBCore::selectSingleValue($dbQuery);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 go uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $this->dbQuery->query.= " WHERE ";
                    $this->dbQuery->sqlPushValues([static::ID_FIELD_NAME => $this->id]);
                }
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 go uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
        Open

                } else {
                    $this->dbQuery->query.= " LIMIT 1";
                    $count = 1;
                }
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 using static access to class 'Asymptix\db\DBCore' in method '_max'.
        Open

                    return DBCore::selectSingleValue($dbQuery);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 short method names like DBObject::go(). The configured minimum method name length is 3.
        Open

            public function go($debug = false) {
                switch ($this->dbQuery->getType()) {
                    case (DBQueryType::SELECT):
                        $this->dbQuery->query = "SELECT * FROM " . static::TABLE_NAME;
                        break;
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        ShortMethodName

        Since: 0.2

        Detects when very short method names are used.

        Example

        class ShortMethod {
            public function a( $index ) { // Violation
            }
        }

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

        The method _get is not named in camelCase.
        Open

            public static function _get($recordId, $debug = false) {
                return static::_select([
                    static::ID_FIELD_NAME => $recordId
                ])->limit(1)->go($debug);
            }
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 _delete is not named in camelCase.
        Open

            public static function _delete($conditions = []) {
                $ref = new \ReflectionClass(get_called_class());
                $dbObject = $ref->newInstance();
        
                if (!is_array($conditions)) { // Just record ID provided
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 _min is not named in camelCase.
        Open

            public static function _min($field, $conditions = [], $debug = false) {
                $dbQuery = (new DBPreparedQuery())->prepare(
                    "SELECT MIN(`" . $field . "`) as 'val' FROM " . static::TABLE_NAME,
                    $conditions
                );
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 _update is not named in camelCase.
        Open

            public static function _update($fields = [], $conditions = []) {
                $ref = new \ReflectionClass(get_called_class());
                $dbObject = $ref->newInstance();
        
                return $dbObject->initQuery(DBQueryType::UPDATE, $conditions, $fields);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 _max is not named in camelCase.
        Open

            public static function _max($field, $conditions = [], $debug = false) {
                $dbQuery = (new DBPreparedQuery())->prepare(
                    "SELECT MAX(`" . $field . "`) as 'val' FROM " . static::TABLE_NAME,
                    $conditions
                );
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 _select is not named in camelCase.
        Open

            public static function _select($conditions = []) {
                $ref = new \ReflectionClass(get_called_class());
                $dbObject = $ref->newInstance();
        
                return $dbObject->initQuery(DBQueryType::SELECT, $conditions);
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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 _count is not named in camelCase.
        Open

            public static function _count($conditions = [], $debug = false) {
                $dbQuery = (new DBPreparedQuery())->prepare(
                    "SELECT COUNT(*) as 'val' FROM " . static::TABLE_NAME,
                    $conditions
                );
        Severity: Minor
        Found in framework/db/DBObject.php by phpmd

        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