third_party/MX/Router.php

Summary

Maintainability
C
1 day
Test Coverage

Function locate has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    public function locate($segments)
    {
        // Clear var $this->directory before search controller in function locate() of the Router class.
        // Solve the problem of trying to load a "root" controller using Modules::run('controller/method') after loading a module controller
        // with Modules::run('module/controller/method')
Severity: Minor
Found in third_party/MX/Router.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 locate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function locate($segments)
    {
        // Clear var $this->directory before search controller in function locate() of the Router class.
        // Solve the problem of trying to load a "root" controller using Modules::run('controller/method') after loading a module controller
        // with Modules::run('module/controller/method')
Severity: Major
Found in third_party/MX/Router.php - About 2 hrs to fix

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

        protected function _set_module_path(&$_route)
        {
            if (! empty($_route)) {
                // Are module/directory/controller/method segments being specified?
                $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
    Severity: Minor
    Found in third_party/MX/Router.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 _set_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _set_request($segments = [])
        {
            if ($this->translate_uri_dashes === true) {
                foreach (range(0, 2) as $v) {
                    isset($segments[$v]) && $segments[$v] = str_replace('-', '_', $segments[$v]);
    Severity: Minor
    Found in third_party/MX/Router.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

    Avoid too many return statements within this method.
    Open

                return array_slice($segments, 1);
    Severity: Major
    Found in third_party/MX/Router.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return array_slice($segments, 2);
      Severity: Major
      Found in third_party/MX/Router.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $segments;
        Severity: Major
        Found in third_party/MX/Router.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return array_slice($segments, 1);
          Severity: Major
          Found in third_party/MX/Router.php - About 30 mins to fix

            The method locate() has an NPath complexity of 4704. The configured NPath complexity threshold is 200.
            Open

                public function locate($segments)
                {
                    // Clear var $this->directory before search controller in function locate() of the Router class.
                    // Solve the problem of trying to load a "root" controller using Modules::run('controller/method') after loading a module controller
                    // with Modules::run('module/controller/method')
            Severity: Minor
            Found in third_party/MX/Router.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 _set_module_path() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.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 locate() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
            Open

                public function locate($segments)
                {
                    // Clear var $this->directory before search controller in function locate() of the Router class.
                    // Solve the problem of trying to load a "root" controller using Modules::run('controller/method') after loading a module controller
                    // with Modules::run('module/controller/method')
            Severity: Minor
            Found in third_party/MX/Router.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

            Avoid using undefined variables such as '$directory' which will lead to PHP notices.
            Open

                                case 2: $_route = ($this->located < 2) ? $module.'/'.$directory : $directory.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$directory' which will lead to PHP notices.
            Open

                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$class' which will lead to PHP notices.
            Open

                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$method' which will lead to PHP notices.
            Open

                                case 4: $_route = ($this->located == 3) ? $class.'/'.$method : $method.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$directory' which will lead to PHP notices.
            Open

                                case 2: $_route = ($this->located < 2) ? $module.'/'.$directory : $directory.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$class' which will lead to PHP notices.
            Open

                        if ($this->locate([$module, $directory, $class])) {
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$directory' which will lead to PHP notices.
            Open

                                case 3: $_route = ($this->located == 2) ? $directory.'/'.$class : $class.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$class' which will lead to PHP notices.
            Open

                                case 3: $_route = ($this->located == 2) ? $directory.'/'.$class : $class.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$directory' which will lead to PHP notices.
            Open

                        if ($this->locate([$module, $directory, $class])) {
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$method' which will lead to PHP notices.
            Open

                                case 4: $_route = ($this->located == 3) ? $class.'/'.$method : $method.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$method' which will lead to PHP notices.
            Open

                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$class' which will lead to PHP notices.
            Open

                                case 3: $_route = ($this->located == 2) ? $directory.'/'.$class : $class.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using undefined variables such as '$class' which will lead to PHP notices.
            Open

                                case 4: $_route = ($this->located == 3) ? $class.'/'.$method : $method.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            UndefinedVariable

            Since: 2.8.0

            Detects when a variable is used that has not been defined before.

            Example

            class Foo
            {
                private function bar()
                {
                    // $message is undefined
                    echo $message;
                }
            }

            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

            Avoid using static access to class 'Modules' in method 'locate'.
            Open

                    if (isset($segments[0]) && $routes = Modules::parse_routes($segments[0], implode('/', $segments))) {
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            StaticAccess

            Since: 1.4.0

            Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

            Example

            class Foo
            {
                public function bar()
                {
                    Bar::baz();
                }
            }

            Source https://phpmd.org/rules/cleancode.html#staticaccess

            Avoid assigning values to variables in if clauses and the like (line '143', column '36').
            Open

                public function locate($segments)
                {
                    // Clear var $this->directory before search controller in function locate() of the Router class.
                    // Solve the problem of trying to load a "root" controller using Modules::run('controller/method') after loading a module controller
                    // with Modules::run('module/controller/method')
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($foo = 'bar') { // possible typo
                        // ...
                    }
                    if ($baz = 0) { // always false
                        // ...
                    }
                }
            }

            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

            Avoid assigning values to variables in if clauses and the like (line '160', column '24').
            Open

                public function locate($segments)
                {
                    // Clear var $this->directory before search controller in function locate() of the Router class.
                    // Solve the problem of trying to load a "root" controller using Modules::run('controller/method') after loading a module controller
                    // with Modules::run('module/controller/method')
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($foo = 'bar') { // possible typo
                        // ...
                    }
                    if ($baz = 0) { // always false
                        // ...
                    }
                }
            }

            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

            The method locate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                                } else {
                                    $this->located = -1;
                                }
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            ElseExpression

            Since: 1.4.0

            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($flag) {
                        // one branch
                    } else {
                        // another branch
                    }
                }
            }

            Source https://phpmd.org/rules/cleancode.html#elseexpression

            The method _set_request uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $segments[1] = 'index';
                    }
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            ElseExpression

            Since: 1.4.0

            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($flag) {
                        // one branch
                    } else {
                        // another branch
                    }
                }
            }

            Source https://phpmd.org/rules/cleancode.html#elseexpression

            The method locate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        [$module, $directory, $controller] = array_pad($segments, 3, null);
                    }
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            ElseExpression

            Since: 1.4.0

            An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($flag) {
                        // one branch
                    } else {
                        // another branch
                    }
                }
            }

            Source https://phpmd.org/rules/cleancode.html#elseexpression

            The phpdoc comment for @method cannot occur on a method
            Open

                 * @method fetch_module
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->config
            Open

                    $ext = $this->config->item('controller_suffix').EXT;
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @method fetch_module'
            Open

                 * @method fetch_module
            Severity: Info
            Found in third_party/MX/Router.php by phan

            The phpdoc comment for @method cannot occur on a method
            Open

                 * @method _set_404override_controller
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory (Did you mean $directory)
            Open

                            $this->directory = $module.'/'.$directory.'/';
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            The phpdoc comment for @method cannot occur on a method
            Open

                 * @method locate
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared constant \APPPATH
            Open

                    if (is_dir(APPPATH.'controllers/'.$module.'/')) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @method _set_module_path'
            Open

                 * @method _set_module_path
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->translate_uri_dashes
            Open

                    if ($this->translate_uri_dashes === true) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->uri
            Open

                    $this->uri->rsegments = $segments;
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @method _set_request'
            Open

                 * @method _set_request
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->routes
            Open

                    $this->_set_module_path($this->routes['404_override']);
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            The phpdoc comment for @method cannot occur on a method
            Open

                 * @method _set_default_controller
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->class
            Open

                    if (empty($this->class)) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory (Did you mean $directory)
            Open

                                    $this->directory .= $directory.'/';
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Reference to undeclared constant \APPPATH
            Open

                    if (is_file(APPPATH.'controllers/'.ucfirst($module).$ext)) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            The phpdoc comment for @method cannot occur on a method
            Open

                 * @method set_class
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @method set_class'
            Open

                 * @method set_class
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @method locate'
            Open

                 * @method locate
            Severity: Info
            Found in third_party/MX/Router.php by phan

            The phpdoc comment for @method cannot occur on a method
            Open

                 * @method _set_module_path
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->config
            Open

                    $suffix = $this->config->item('controller_suffix');
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @method _set_404override_controller'
            Open

                 * @method _set_404override_controller
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @method _set_default_controller'
            Open

                 * @method _set_default_controller
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @param [type] $segments [description]'
            Open

                 * @param  [type] $segments [description]
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory (Did you mean $directory)
            Open

                    if (! empty($this->directory)) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @return [type] [description]'
            Open

                 * @return [type]           [description]
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory (Did you mean $directory)
            Open

                        $this->directory = $module.'/';
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @param [type] &$_route [description]'
            Open

                 * @param  [type]  &$_route [description]
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared class \CI_Router (Did you mean class \MX_Router or class \MY_Router)
            Open

                    parent::set_class($class);
            Severity: Critical
            Found in third_party/MX/Router.php by phan

            Reference to undeclared class \CI_Router (Did you mean class \MX_Router or class \MY_Router)
            Open

                    parent::_set_default_controller();
            Severity: Critical
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory (Did you mean $directory)
            Open

                            $this->directory = $offset.$module.'/controllers/';
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Reference to undeclared constant \APPPATH
            Open

                        if (is_file(APPPATH.'controllers/'.$module.'/'.ucfirst($directory).$ext)) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory
            Open

                    if (empty($this->directory)) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @param [type] $class [description]'
            Open

                 * @param  [type]    $class [description]
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory
            Open

                    $this->directory = null;
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Saw unextractable annotation for comment '* @return [type] [description]'
            Open

                 * @return [type]       [description]
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Call to undeclared method \MX_Router::set_method
            Open

                        $this->set_method($segments[1]);
            Severity: Critical
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->default_controller
            Open

                        $this->_set_module_path($this->default_controller);
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Class extends undeclared class \CI_Router (Did you mean class \MX_Router or class \MY_Router)
            Open

            class MX_Router extends CI_Router
            Severity: Critical
            Found in third_party/MX/Router.php by phan

            The phpdoc comment for @method cannot occur on a method
            Open

                 * @method _set_request
            Severity: Info
            Found in third_party/MX/Router.php by phan

            Reference to undeclared property \MX_Router->directory (Did you mean $directory)
            Open

                            $this->directory = $module.'/';
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Reference to undeclared constant \APPPATH
            Open

                        if ($controller && is_file(APPPATH . 'controllers/' . $module . '/' . $directory . '/' . ucfirst($controller) . $ext)) {
            Severity: Minor
            Found in third_party/MX/Router.php by phan

            Each class must be in a namespace of at least one level (a top-level vendor name)
            Open

            class MX_Router extends CI_Router
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 38 and the first side effect is on line 1.
            Open

            <?php defined('BASEPATH') or exit('No direct script access allowed');
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            The parameter $_route is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseParameterName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething($user_name) {
                }
            }

            Source

            The class MX_Router is not named in CamelCase.
            Open

            class MX_Router extends CI_Router
            {
                public $module;
                private $located = 0;
            
            
            Severity: Minor
            Found in third_party/MX/Router.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

            Method name "_set_request" should not be prefixed with an underscore to indicate visibility
            Open

                protected function _set_request($segments = [])
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            The CASE body must start on the line following the statement
            Open

                                case 1: $_route = $module.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "_set_module_path" should not be prefixed with an underscore to indicate visibility
            Open

                protected function _set_module_path(&$_route)
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            The CASE body must start on the line following the statement
            Open

                                case 2: $_route = ($this->located < 2) ? $module.'/'.$directory : $directory.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "MX_Router::_set_request" is not in camel caps format
            Open

                protected function _set_request($segments = [])
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "_set_default_controller" should not be prefixed with an underscore to indicate visibility
            Open

                protected function _set_default_controller()
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            The CASE body must start on the line following the statement
            Open

                                case 3: $_route = ($this->located == 2) ? $directory.'/'.$class : $class.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "MX_Router::set_class" is not in camel caps format
            Open

                public function set_class($class)
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "MX_Router::_set_default_controller" is not in camel caps format
            Open

                protected function _set_default_controller()
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            The CASE body must start on the line following the statement
            Open

                                case 4: $_route = ($this->located == 3) ? $class.'/'.$method : $method.'/index';
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "_set_404override_controller" should not be prefixed with an underscore to indicate visibility
            Open

                protected function _set_404override_controller()
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "MX_Router::fetch_module" is not in camel caps format
            Open

                public function fetch_module()
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "MX_Router::_set_404override_controller" is not in camel caps format
            Open

                protected function _set_404override_controller()
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Method name "MX_Router::_set_module_path" is not in camel caps format
            Open

                protected function _set_module_path(&$_route)
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Line exceeds 120 characters; contains 132 characters
            Open

                        if ($controller && is_file(APPPATH . 'controllers/' . $module . '/' . $directory . '/' . ucfirst($controller) . $ext)) {
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Line exceeds 120 characters; contains 140 characters
            Open

                    // Solve the problem of trying to load a "root" controller using Modules::run('controller/method') after loading a module controller
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            Class name "MX_Router" is not in camel caps format
            Open

            class MX_Router extends CI_Router
            Severity: Minor
            Found in third_party/MX/Router.php by phpcodesniffer

            The variable $_route is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseVariableName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething() {
                    $data_module = new DataModule();
                }
            }

            Source

            The variable $_route is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseVariableName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething() {
                    $data_module = new DataModule();
                }
            }

            Source

            The variable $_route is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseVariableName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething() {
                    $data_module = new DataModule();
                }
            }

            Source

            The variable $_route is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseVariableName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething() {
                    $data_module = new DataModule();
                }
            }

            Source

            The variable $_route is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseVariableName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething() {
                    $data_module = new DataModule();
                }
            }

            Source

            The variable $_route is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseVariableName

            Since: 0.2

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

            Example

            class ClassName {
                public function doSomething() {
                    $data_module = new DataModule();
                }
            }

            Source

            The method _set_404override_controller is not named in camelCase.
            Open

                protected function _set_404override_controller()
                {
                    $this->_set_module_path($this->routes['404_override']);
                }
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseMethodName

            Since: 0.2

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

            Example

            class ClassName {
                public function get_name() {
                }
            }

            Source

            The method set_class is not named in camelCase.
            Open

                public function set_class($class)
                {
                    $suffix = $this->config->item('controller_suffix');
                    // Fixing Error Message: strpos(): Non-string needles will be interpreted as strings in the future.
                    // Use an explicit chr() call to preserve the current behavior.
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseMethodName

            Since: 0.2

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

            Example

            class ClassName {
                public function get_name() {
                }
            }

            Source

            The method _set_request is not named in camelCase.
            Open

                protected function _set_request($segments = [])
                {
                    if ($this->translate_uri_dashes === true) {
                        foreach (range(0, 2) as $v) {
                            isset($segments[$v]) && $segments[$v] = str_replace('-', '_', $segments[$v]);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseMethodName

            Since: 0.2

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

            Example

            class ClassName {
                public function get_name() {
                }
            }

            Source

            The method _set_default_controller is not named in camelCase.
            Open

                protected function _set_default_controller()
                {
                    if (empty($this->directory)) {
                        // set the default controller module path
                        $this->_set_module_path($this->default_controller);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseMethodName

            Since: 0.2

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

            Example

            class ClassName {
                public function get_name() {
                }
            }

            Source

            The method fetch_module is not named in camelCase.
            Open

                public function fetch_module()
                {
                    return $this->module;
                }
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseMethodName

            Since: 0.2

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

            Example

            class ClassName {
                public function get_name() {
                }
            }

            Source

            The method _set_module_path is not named in camelCase.
            Open

                protected function _set_module_path(&$_route)
                {
                    if (! empty($_route)) {
                        // Are module/directory/controller/method segments being specified?
                        $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method);
            Severity: Minor
            Found in third_party/MX/Router.php by phpmd

            CamelCaseMethodName

            Since: 0.2

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

            Example

            class ClassName {
                public function get_name() {
                }
            }

            Source

            There are no issues that match your filters.

            Category
            Status