Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

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

        Avoid excessively long variable names like $currentAvatarFileName. Keep variable name length under 20.
        Open

                $currentAvatarFileName = $this->avatar;
        Severity: Minor
        Found in classes/db/access/User.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

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

        Avoid excessively long variable names like $currentAvatarFileName. Keep variable name length under 20.
        Open

                $currentAvatarFileName = $this->avatar;
        Severity: Minor
        Found in classes/db/access/User.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

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

        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

            Avoid using short method names like DBPreparedQuery::go(). The configured minimum method name length is 3.
            Open

                public function go($debug = false) {
                    if ($debug) {
                        $this->debug();
                    } else {
                        if ($this->isSelector()) {
            Severity: Minor
            Found in framework/db/DBPreparedQuery.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

            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

            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
                    Severity
                    Category
                    Status
                    Source
                    Language