Asymptix/Framework

View on GitHub

Showing 129 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

              Function httpRedirect has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function httpRedirect($url = "", $postData = [], $serialize = true) {
                      if (preg_match("#^http[s]?://.+#", $url)) { // absolute url
                          if (function_exists("http_redirect")) {
                              http_redirect($url);
                          } else {
              Severity: Minor
              Found in framework/web/Http.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

              Function getBouncedEmails has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getBouncedEmails($delete = true, $number = null) {
                      $emails = [];
              
                      for ($i = 1; (is_null($number) ? true : $i <= $number); $i++) {
                          $message = $this->getMessage($i);
              Severity: Minor
              Found in framework/mail/POP.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 _get has 74 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function _get($ip, $type, $provider) {
                      if (!filter_var($ip, FILTER_VALIDATE_IP)) {
                          throw new LocationDetectorException("Invalid IP address.");
                      }
              
              
              Severity: Major
              Found in framework/tools/geo/LocationDetector.php - About 2 hrs to fix

                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

                Function unsetValueWithComplexName has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function unsetValueWithComplexName(&$array, $complexName) {
                        if (!is_array($complexName)) {
                            $complexName = self::parseComplexName($complexName);
                        }
                
                
                Severity: Minor
                Found in framework/helpers/Naming.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

                  Function getSQLCondition has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getSQLCondition($queryCondition, $operator = "") {
                          $operator = strtoupper(trim($operator));
                          if ($operator === "OR" || $operator === "AND") {
                              if (is_array($queryCondition)) {
                                  if ($operator === "AND") {
                  Severity: Minor
                  Found in framework/db/DBQueryCondition.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

                  Validator has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Validator {
                  
                      /**
                       * Validate field value by regular expression.
                       *
                  Severity: Minor
                  Found in framework/core/Validator.php - About 2 hrs to fix

                    Function getBrowserInfo has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function getBrowserInfo() {
                            $browserFullName = $browserShortName = $browserVersion = null;
                            $userAgent = self::getUserAgent();
                    
                            if (empty($userAgent)) {
                    Severity: Minor
                    Found in framework/web/Browser.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

                    Severity
                    Category
                    Status
                    Source
                    Language