Asymptix/Framework

View on GitHub

Showing 129 of 720 total issues

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

    public static function getValueByComplexName($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

Method getBrowserInfo has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getBrowserInfo() {
        $browserFullName = $browserShortName = $browserVersion = null;
        $userAgent = self::getUserAgent();

        if (empty($userAgent)) {
Severity: Major
Found in framework/web/Browser.php - About 2 hrs to fix

    Method checkParameterTypes has 51 lines of code (exceeds 25 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: Major
    Found in framework/db/DBPreparedQuery.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 __construct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct($type = "", $name = "", $value = null) {
                if (!(bool)preg_match("#^[a-zA-Z][a-zA-Z0-9_]*$#", $name)) {
                    throw new DBFieldException("Can't create DBField object: invalid field name '" . $name . "'");
                }
                $this->name = $name;
        Severity: Minor
        Found in framework/db/DBField.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 curlRequestAsync has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function curlRequestAsync($url, $params, $type = self::POST, $timeout = 30) {
                $postParams = [];
                foreach ($params as $key => &$val) {
                    if (is_array($val)) {
                        $val = implode(',', $val);
        Severity: Minor
        Found in framework/web/Http.php - About 1 hr to fix

          Function filterBouncedEmails has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              private function filterBouncedEmails($emailData) {
                  $emails = [];
          
                  if (isset($emailData[0])) {
                      if (is_array($emailData[0])) {
          Severity: Minor
          Found in framework/mail/POP.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

          Function showQueryDebugInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function showQueryDebugInfo($query = "", $types = "", array $params = []) {
                  OutputStream::start();
                  if (!empty($query)) {
                      if (empty($types) && empty($params)) {
                          OutputStream::message(OutputStream::MSG_INFO, "Q: " . $query);
          Severity: Minor
          Found in framework/db/DBQuery.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

          Function start has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function start($name = "", array $iniSettings = [], $useCookie = false,
                      $lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
              {
                  if (!empty($iniSettings)) {
                      foreach ($iniSettings as $key => $value) {
          Severity: Minor
          Found in framework/web/Session.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 getBouncedEmails has 43 lines of code (exceeds 25 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 1 hr to fix

            Method __call has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __call($methodName, $methodParams) {
                    /*
                     * Selects DBObject record by some field value.
                     *
                     * @param <mixed> Value of the field
            Severity: Minor
            Found in framework/db/DBSelector.php - About 1 hr to fix

              Method log has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function log($type, $message, $format = "\[Y-m-d H:i:s\]", $time = null) {
                      $msgType = null;
                      switch ($type) {
                          case (self::LOG_INFO):
                              $msgType = OutputStream::MSG_INFO;
              Severity: Minor
              Found in framework/tools/logging/Logger.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

                Function _get has a Cognitive Complexity of 13 (exceeds 5 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: Minor
                Found in framework/tools/geo/LocationDetector.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

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

                    public static function getFieldValue($fieldName, $source = null) {
                        $value = null;
                
                        try {
                            switch ($source) {
                Severity: Minor
                Found in framework/web/Request.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 setFieldsValues has 33 lines of code (exceeds 25 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 1 hr to fix

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

                      public function __construct($type = "", $name = "", $value = null) {
                          if (!(bool)preg_match("#^[a-zA-Z][a-zA-Z0-9_]*$#", $name)) {
                              throw new DBFieldException("Can't create DBField object: invalid field name '" . $name . "'");
                          }
                          $this->name = $name;
                  Severity: Minor
                  Found in framework/db/DBField.php - About 1 hr to fix

                    Method friendlyErrorType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function friendlyErrorType($type) {
                            switch($type) {
                                case E_ERROR: // 1
                                    return 'E_ERROR';
                                case E_WARNING: // 2
                    Severity: Minor
                    Found in classes/db/tools/ErrorLog.php - About 1 hr to fix

                      Method getFieldValue has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function getFieldValue($fieldName, $source = null) {
                              $value = null;
                      
                              try {
                                  switch ($source) {
                      Severity: Minor
                      Found in framework/web/Request.php - About 1 hr to fix

                        Method setValueWithComplexName has 32 lines of code (exceeds 25 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 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language