speedworks/speedy

View on GitHub

Showing 32 of 149 total issues

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

    public function Authenticate()
    {
        $auth = new BaseAuth();
        if($this->type == "KEY")
        {
Severity: Minor
Found in Core/Middleware/Auth.php - About 1 hr to fix

    Function ErrorHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    function ErrorHandler($errno, $errstr, $errfile, $errline)
    {
        if (!(error_reporting() & $errno))
        {
            return;
    Severity: Minor
    Found in public/index.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 set has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function set($cookieName, $cookieValue=null, $expiryDays=365, $path=null, $domain=null, $secure=null, $httpOnly=null)
    Severity: Major
    Found in Core/Classes/Cookie.php - About 50 mins to fix

      Function MakeLog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function MakeLog($logdir, $filename, $logstr)
          {
              $logstr .= "\n";
              if(is_dir($logdir.date('Y')))
              {
      Severity: Minor
      Found in Core/Classes/System.php - About 45 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 Pass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function Pass($requestUri, $requestMethod, $requestData, $rawData)
          {
              if(!array_key_exists($requestMethod,Route::$URLS))
              {
                  System::GiveError(405,"Method not allowed");
      Severity: Minor
      Found in Core/Bridge.php - About 45 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 setEngine has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function setEngine($engine, $host=null, $port=null, $user=null, $password=null, $encryption=null)
      Severity: Minor
      Found in Core/Classes/Mailer.php - About 45 mins to fix

        Function DBD has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function DBD($inData, $die=false) //DEBUG AND DIE
            {
                if(is_array($inData))
                {
                    echo "<pre><br/>\n";
        Severity: Minor
        Found in Core/Classes/System.php - About 35 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 corePHPMailer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            private function corePHPMailer($options)
            {
                $options = null;
                $this->mailHeaders[] = "MIME-Version: 1.0";
                $this->mailHeaders[] = "Content-Type: ".$this->mailContentType;
        Severity: Minor
        Found in Core/Classes/Mailer.php - About 35 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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function delete($cookieName = null)
            {
                if($cookieName == null)
                {
                    if (isset($_SERVER['HTTP_COOKIE']))
        Severity: Minor
        Found in Core/Classes/Cookie.php - About 25 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

        The method selectionQueryMaker() has an NPath complexity of 1250. The configured NPath complexity threshold is 200.
        Open

            protected function selectionQueryMaker()
            {
                $this->query = 'SELECT '.$this->selects.' FROM '.$this->table;
                $where="";
                $flag = 0;
        Severity: Minor
        Found in Core/Classes/DB.php by phpmd

        NPathComplexity

        Since: 0.1

        The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

        Example

        class Foo {
            function bar() {
                // lots of complicated code
            }
        }

        Source https://phpmd.org/rules/codesize.html#npathcomplexity

        The method GiveError() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
        Open

            public static function GiveError($errorCode, $errorMessage)
            {
                if($errorCode==400)
                {
                    header("HTTP/1.0 400 Bad Request");
        Severity: Minor
        Found in Core/Classes/System.php by phpmd

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

        The method selectionQueryMaker() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
        Open

            protected function selectionQueryMaker()
            {
                $this->query = 'SELECT '.$this->selects.' FROM '.$this->table;
                $where="";
                $flag = 0;
        Severity: Minor
        Found in Core/Classes/DB.php by phpmd

        CyclomaticComplexity

        Since: 0.1

        Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

        Example

        // Cyclomatic Complexity = 11
        class Foo {
        1   public function example() {
        2       if ($a == $b) {
        3           if ($a1 == $b1) {
                        fiddle();
        4           } elseif ($a2 == $b2) {
                        fiddle();
                    } else {
                        fiddle();
                    }
        5       } elseif ($c == $d) {
        6           while ($c == $d) {
                        fiddle();
                    }
        7        } elseif ($e == $f) {
        8           for ($n = 0; $n < $h; $n++) {
                        fiddle();
                    }
                } else {
                    switch ($z) {
        9               case 1:
                            fiddle();
                            break;
        10              case 2:
                            fiddle();
                            break;
        11              case 3:
                            fiddle();
                            break;
                        default:
                            fiddle();
                            break;
                    }
                }
            }
        }

        Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

        Severity
        Category
        Status
        Source
        Language