Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

File DBCore.php has 438 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Asymptix\db;

use Asymptix\core\Tools;
Severity: Minor
Found in framework/db/DBCore.php - About 6 hrs to fix

    Function http_response_code has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        function http_response_code($code = NULL) {
            if ($code !== NULL) {
                switch ($code) {
                    case 100: $text = 'Continue';
                        break;
    Severity: Minor
    Found in modules/http.php - About 6 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function setFieldsValues has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setFieldsValues($valuesList) {
            if (is_array($valuesList)) {
                $count = 0;
                foreach ($this->fieldsList as $fieldName => &$fieldValue) {
                    if (isset($valuesList[$fieldName])) {
    Severity: Minor
    Found in framework/core/BasicObject.php - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function setValueWithComplexName has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function setValueWithComplexName(&$array, $complexName, $value, $rewrite = false) {
            if (!is_array($complexName)) {
                $complexName = self::parseComplexName($complexName);
            }
    
    
    Severity: Minor
    Found in framework/helpers/Naming.php - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function __construct(DBField $field, $conditionType, $value) {
            $this->type = self::sqlConditionType($conditionType);
            if (!Tools::isInstanceOf($value, "DBField")) {
                $this->field = $field;
    
    
    Severity: Minor
    Found in framework/db/DBQueryCondition.php - About 4 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

    DBCore has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DBCore {
        /**
         * An array containing all the opened connections.
         *
         * @var array
    Severity: Minor
    Found in framework/db/DBCore.php - About 4 hrs to fix

      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

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

            private static function checkParameterTypes($params, $types) {
                if (count($params) != strlen($types)) {
                    throw new DBCoreException(
                        "Number of types is not equal parameters number"
                    );
        Severity: Minor
        Found in framework/db/DBPreparedQuery.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

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

            public function __construct(DBField $field, $conditionType, $value) {
                $this->type = self::sqlConditionType($conditionType);
                if (!Tools::isInstanceOf($value, "DBField")) {
                    $this->field = $field;
        
        
        Severity: Major
        Found in framework/db/DBQueryCondition.php - About 3 hrs to fix

          Method http_response_code has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function http_response_code($code = NULL) {
                  if ($code !== NULL) {
                      switch ($code) {
                          case 100: $text = 'Continue';
                              break;
          Severity: Major
          Found in modules/http.php - About 3 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                    if (strpos($type, "varchar") === 0
                     || strpos($type, "text") === 0
                     || strpos($type, "longtext") === 0
                     || strpos($type, "enum") === 0
                     || strpos($type, "char") === 0
            Severity: Critical
            Found in framework/db/DBCore.php - About 3 hrs to fix

              The class Validator has 20 public methods. Consider refactoring Validator to keep number of public methods under 10.
              Open

              class Validator {
              
                  /**
                   * Validate field value by regular expression.
                   *
              Severity: Minor
              Found in framework/core/Validator.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

              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 DBCore has an overall complexity of 123 which is very high. The configured complexity threshold is 50.
              Open

              class DBCore {
                  /**
                   * An array containing all the opened connections.
                   *
                   * @var array
              Severity: Minor
              Found in framework/db/DBCore.php by phpmd

              The class Request has 12 public methods. Consider refactoring Request to keep number of public methods under 10.
              Open

              class Request {
              
                  /**
                   * Check if form was submitted.
                   *
              Severity: Minor
              Found in framework/web/Request.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

              The class DBCore has 23 public methods. Consider refactoring DBCore to keep number of public methods under 10.
              Open

              class DBCore {
                  /**
                   * An array containing all the opened connections.
                   *
                   * @var array
              Severity: Minor
              Found in framework/db/DBCore.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

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

              class DBPreparedQuery extends DBQuery {
              
                  /**
                   * DB query template.
                   *
              Severity: Minor
              Found in framework/db/DBPreparedQuery.php by phpmd

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

              class POP {
              
                  /**
                   * Email regular expression.
                   */
              Severity: Minor
              Found in framework/mail/POP.php by phpmd

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

              class Http {
              
                  const POST = "POST";
                  const GET  = "GET";
              
              
              Severity: Minor
              Found in framework/web/Http.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

              Severity
              Category
              Status
              Source
              Language