Asymptix/Framework

View on GitHub

Showing 720 of 720 total issues

Method secondsToTime has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function secondsToTime($inputSeconds, $format = self::HUMAN_FORMAT_DEFAULT) {
        $secondsInAMinute = 60;
        $secondsInAnHour = 60 * $secondsInAMinute;
        $secondsInADay = 24 * $secondsInAnHour;

Severity: Minor
Found in framework/core/Time.php - About 1 hr to fix

    Method start has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function start($name = "", array $iniSettings = [], $useCookie = false,
                $lifetime = null, $path = null, $domain = null, $secure = null, $httponly = null)
    Severity: Major
    Found in framework/web/Session.php - About 1 hr to fix

      Function curlRequestAsync has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function log($type, $called, $script, $line, $message) {
              if (is_null($called)) {
                  $called = $_SERVER['SCRIPT_NAME'];
              }
      
      
      Severity: Minor
      Found in classes/db/tools/ErrorLog.php - About 55 mins 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 bindResults has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function bindResults($stmt) {
              $resultSet = [];
              $metaData = $stmt->result_metadata();
              $fieldsCounter = 0;
              while ($field = $metaData->fetch_field()) {
      Severity: Minor
      Found in framework/db/DBCore.php - About 55 mins 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 log has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function start() {
              switch ($this->direction) {
                  case (self::TO_OUTPUT_STREAM):
                      OutputStream::start();
      
      
      Severity: Minor
      Found in framework/tools/logging/Logger.php - About 55 mins 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 secondsToTime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function secondsToTime($inputSeconds, $format = self::HUMAN_FORMAT_DEFAULT) {
              $secondsInAMinute = 60;
              $secondsInAnHour = 60 * $secondsInAMinute;
              $secondsInADay = 24 * $secondsInAnHour;
      
      
      Severity: Minor
      Found in framework/core/Time.php - About 55 mins 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 getPrintableSQLValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function getPrintableSQLValue($type, $value) {
              if (strpos($type, "varchar") === 0
               || strpos($type, "text") === 0
               || strpos($type, "longtext") === 0
               || strpos($type, "enum") === 0
      Severity: Minor
      Found in framework/db/DBCore.php - About 55 mins 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 prepare has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function prepare($query, $conditions = null, $order = null, $offset = null, $count = null) {
              if (empty($query)) {
                  throw new DBCoreException("Nothing to run, SQL query is not initialized");
              }
              $this->query = $query;
      Severity: Minor
      Found in framework/db/DBPreparedQuery.php - About 55 mins 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 sendNotification has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                  $email, $subject, $languageCode, $template,
                  array $params = null, $format = self::FORMAT_TEXT,
                  $replyTo = ""
      Severity: Major
      Found in framework/mail/Email.php - About 50 mins to fix

        The class __LANG is not named in CamelCase.
        Open

        class __LANG {
        
        }
        Severity: Minor
        Found in conf/langs/en.php by phpmd

        CamelCaseClassName

        Since: 0.2

        It is considered best practice to use the CamelCase notation to name classes.

        Example

        class class_name {
        }

        Source

        The class __ERRORS is not named in CamelCase.
        Open

        class __ERRORS {
            const EMPTY_FIELD = "Field can't be empty";
        }
        Severity: Minor
        Found in conf/langs/en.php by phpmd

        CamelCaseClassName

        Since: 0.2

        It is considered best practice to use the CamelCase notation to name classes.

        Example

        class class_name {
        }

        Source

        Avoid variables with short names like $ch. Configured minimum length is 3.
        Open

                $ch = curl_init($url);
        Severity: Minor
        Found in framework/web/Http.php by phpmd

        ShortVariable

        Since: 0.2

        Detects when a field, local, or parameter has a very short name.

        Example

        class Something {
            private $q = 15; // VIOLATION - Field
            public static function main( array $as ) { // VIOLATION - Formal
                $r = 20 + $this->q; // VIOLATION - Local
                for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                    $r += $this->q;
                }
            }
        }

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

        The class __MESSAGES is not named in CamelCase.
        Open

        class __MESSAGES {
        
        }
        Severity: Minor
        Found in conf/langs/en.php by phpmd

        CamelCaseClassName

        Since: 0.2

        It is considered best practice to use the CamelCase notation to name classes.

        Example

        class class_name {
        }

        Source

        The class __DIALOGS is not named in CamelCase.
        Open

        class __DIALOGS {
        
        }
        Severity: Minor
        Found in conf/langs/en.php by phpmd

        CamelCaseClassName

        Since: 0.2

        It is considered best practice to use the CamelCase notation to name classes.

        Example

        class class_name {
        }

        Source

        The property $_route is not named in camelCase.
        Open

        class View {
        
            /**
             * @var Route
             */
        Severity: Minor
        Found in framework/app/View.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        The property $_tpl is not named in camelCase.
        Open

        class View {
        
            /**
             * @var Route
             */
        Severity: Minor
        Found in framework/app/View.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        The property $_errors is not named in camelCase.
        Open

        class View {
        
            /**
             * @var Route
             */
        Severity: Minor
        Found in framework/app/View.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        The property $_fields is not named in camelCase.
        Open

        class View {
        
            /**
             * @var Route
             */
        Severity: Minor
        Found in framework/app/View.php by phpmd

        CamelCasePropertyName

        Since: 0.2

        It is considered best practice to use the camelCase notation to name attributes.

        Example

        class ClassName {
            protected $property_name;
        }

        Source

        Severity
        Category
        Status
        Source
        Language