Showing 82 of 291 total issues

Function ip_address has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

    public static function ip_address($proxy_ips = [])
    {
        if (self::$ip_address) {
            return self::$ip_address;
        }
Severity: Minor
Found in core/LibRequest.php - About 1 day 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 seekRouteByTreeForKeychain has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    protected function seekRouteByTreeForKeychain($tree, $keychain, $method, &$params = [])
    {
        if ($this->debug) {
            echo __METHOD__ .
                ' tree nodes: ' . json_encode(array_keys($tree)) .
Severity: Minor
Found in mvc/Zillah.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

Method buildHTML has 124 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function buildHTML($content, $components)
    {
        $autoURLBase = $this->getURLRootString();
        $title = $this->wikiTitle;
        $navigator = "";
Severity: Major
Found in wiki/MarkdownBaruch.php - About 4 hrs to fix

    Function executeCurl has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function executeCurl($method, $url, $data = null, $headers = [], $cookies = [], $bodyAsJson = false, $logger = null)
        {
            //$logger = $this->getFileLogger();
            $ch = curl_init();
    
    
    Severity: Minor
    Found in helper/CommonHelper.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

    File LibPDO.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Created by PhpStorm.
     * User: Sinri
     * Date: 2017/7/14
    Severity: Minor
    Found in core/LibPDO.php - About 3 hrs to fix

      File LibRequest.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Created by PhpStorm.
       * User: Sinri
       * Date: 2017/5/9
      Severity: Minor
      Found in core/LibRequest.php - About 3 hrs to fix

        Function loadController has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function loadController($basePath, $controllerClass, $middleware = null)
            {
                $method_list = get_class_methods($controllerClass);
                $reflector = new \ReflectionClass($controllerClass);
                foreach ($method_list as $method) {
        Severity: Minor
        Found in mvc/Adah.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

        LibPDO has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class LibPDO
        {
            /**
             * @var \PDO
             */
        Severity: Minor
        Found in core/LibPDO.php - About 3 hrs to fix

          LibRequest has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class LibRequest
          {
              const METHOD_ANY = "ANY";//since v2.1.3 for TreeRouter
          
              const METHOD_HEAD = "HEAD";//since v1.3.0
          Severity: Minor
          Found in core/LibRequest.php - About 3 hrs to fix

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

                public function loadAllControllersInDirectoryAsCI($directory, $urlBase = '', $controllerNamespaceBase = '', $middleware = '')
                {
                    if (!file_exists($directory) || !is_dir($directory)) {
                        if ($this->debug) {
                            echo __METHOD__ . " warning: this is not a direcoty: " . $directory . PHP_EOL;
            Severity: Minor
            Found in mvc/Adah.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 seekRouteByTreeForKeychain has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function seekRouteByTreeForKeychain($tree, $keychain, $method, &$params = [])
                {
                    if ($this->debug) {
                        echo __METHOD__ .
                            ' tree nodes: ' . json_encode(array_keys($tree)) .
            Severity: Major
            Found in mvc/Zillah.php - About 3 hrs to fix

              Function buildCondition has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected final function buildCondition($conditions, $glue = 'AND')
                  {
                      $condition_sql = "";
                      if (is_string($conditions)) {
                          $condition_sql = $conditions;
              Severity: Minor
              Found in core/AbstractDataModel.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 loadAllControllersInDirectoryAsCI has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function loadAllControllersInDirectoryAsCI($directory, $urlBase = '', $controllerNamespaceBase = '', $middleware = '')
                  {
                      if ($handle = opendir($directory)) {
                          if (
                              $this->default_controller_name
              Severity: Minor
              Found in mvc/Zillah.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 ip_address has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function ip_address($proxy_ips = [])
                  {
                      if (self::$ip_address) {
                          return self::$ip_address;
                      }
              Severity: Major
              Found in core/LibRequest.php - About 3 hrs to fix

                File Zillah.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Created by PhpStorm.
                 * User: Sinri
                 * Date: 2017/7/24
                Severity: Minor
                Found in mvc/Zillah.php - About 2 hrs to fix

                  Method safeBuildSQL has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function safeBuildSQL($template, $parameters = [])
                      {
                          $this->debug($template, $parameters);
                          $count = preg_match_all('/\?|`\?`|\(\?\)|\[\?\]|\{\?\}/', $template, $matches, PREG_OFFSET_CAPTURE);
                          $this->debug("preg_match_all count=" . json_encode($count), $matches);
                  Severity: Major
                  Found in core/LibPDO.php - About 2 hrs to fix

                    Function seekRoute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function seekRoute($path, $method)
                        {
                            // a possible fix in 2.1.4
                            if (strlen($path) > 1 && substr($path, strlen($path) - 1, 1) == '/') {
                                $path = substr($path, 0, strlen($path) - 1);
                    Severity: Minor
                    Found in mvc/Adah.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 safeBuildSQL has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function safeBuildSQL($template, $parameters = [])
                        {
                            $this->debug($template, $parameters);
                            $count = preg_match_all('/\?|`\?`|\(\?\)|\[\?\]|\{\?\}/', $template, $matches, PREG_OFFSET_CAPTURE);
                            $this->debug("preg_match_all count=" . json_encode($count), $matches);
                    Severity: Minor
                    Found in core/LibPDO.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 loadController has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function loadController($basePath, $controllerClass, $middleware = null)
                        {
                            $method_list = get_class_methods($controllerClass);
                            $reflector = new \ReflectionClass($controllerClass);
                            foreach ($method_list as $method) {
                    Severity: Minor
                    Found in mvc/Zillah.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 sendMail has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function sendMail($params)
                        {
                            $this->prepareSMTP();
                            $this->phpMailerInstance->isSMTP();
                    
                    
                    Severity: Minor
                    Found in core/LibMail.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