Showing 651 of 651 total issues

Function _autoloader has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function _autoloader($autoload)
    {
        $path = false;

        if ($this->_module) {
Severity: Minor
Found in third_party/MX/Loader.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

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

File Loader.php has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php defined('BASEPATH') or exit('No direct script access allowed');

/**
 * Modular Extensions - HMVC
 *
Severity: Minor
Found in third_party/MX/Loader.php - About 4 hrs to fix

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

        public static function parse_routes($module, $uri)
        {
            // load the route file
            if (! isset(self::$routes[$module])) {
                // Backward function
    Severity: Minor
    Found in third_party/MX/Modules.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

    The class MX_Loader has 20 public methods. Consider refactoring MX_Loader to keep number of public methods under 10.
    Open

    class MX_Loader extends CI_Loader
    {
        protected $_module;
    
        public $_ci_plugins = [];
    Severity: Minor
    Found in third_party/MX/Loader.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    The class MX_Loader has an overall complexity of 114 which is very high. The configured complexity threshold is 50.
    Open

    class MX_Loader extends CI_Loader
    {
        protected $_module;
    
        public $_ci_plugins = [];
    Severity: Minor
    Found in third_party/MX/Loader.php by phpmd

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

        public function _ci_load($_ci_data)
        {
            extract($_ci_data);
    
            if (isset($_ci_view)) {
    Severity: Minor
    Found in third_party/MX/Loader.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 _autoloader has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _autoloader($autoload)
        {
            $path = false;
    
            if ($this->_module) {
    Severity: Major
    Found in third_party/MX/Loader.php - About 2 hrs to fix

      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

        MX_Loader has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class MX_Loader extends CI_Loader
        {
            protected $_module;
        
            public $_ci_plugins = [];
        Severity: Minor
        Found in third_party/MX/Loader.php - About 2 hrs to fix

          Function load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public function load($langfile, $lang = '', $return = false, $add_suffix = true, $alt_path = '', $_module = '')
              {
                  if (is_array($langfile)) {
                      foreach ($langfile as $_lang) {
                          $this->load($_lang);
          Severity: Minor
          Found in third_party/MX/Lang.php - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method _ci_load has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function _ci_load($_ci_data)
              {
                  extract($_ci_data);
          
                  if (isset($_ci_view)) {
          Severity: Minor
          Found in third_party/MX/Loader.php - About 1 hr to fix

            Function find has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function find($file, $module, $base)
                {
                    $segments = explode('/', $file);
            
                    $file = array_pop($segments);
            Severity: Minor
            Found in third_party/MX/Modules.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function model has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function model($model, $object_name = null, $connect = false)
                {
                    if (is_array($model)) {
                        return $this->models($model);
                    }
            Severity: Minor
            Found in third_party/MX/Loader.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function load has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function load($file = '', $use_sections = false, $fail_gracefully = false, $_module = '')
                {
                    if (in_array($file, $this->is_loaded, true)) {
                        return $this->item($file);
                    }
            Severity: Minor
            Found in third_party/MX/Config.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method parse_routes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function parse_routes($module, $uri)
                {
                    // load the route file
                    if (! isset(self::$routes[$module])) {
                        // Backward function
            Severity: Minor
            Found in third_party/MX/Modules.php - About 1 hr to fix

              Method load has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function load($langfile, $lang = '', $return = false, $add_suffix = true, $alt_path = '', $_module = '')
                  {
                      if (is_array($langfile)) {
                          foreach ($langfile as $_lang) {
                              $this->load($_lang);
              Severity: Minor
              Found in third_party/MX/Lang.php - About 1 hr to fix

                Function load has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function load($module)
                    {
                        // Backward function
                        // The function each() has been DEPRECATED as of PHP 7.2.0. Relying on this function is highly discouraged
                        // Before PHP 7.1.0, list() only worked on numerical arrays and assumes the numerical indices start at 0.
                Severity: Minor
                Found in third_party/MX/Modules.php - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function library has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function library($library, $params = null, $object_name = null)
                    {
                        if (is_array($library)) {
                            return $this->libraries($library);
                        }
                Severity: Minor
                Found in third_party/MX/Loader.php - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method library has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function library($library, $params = null, $object_name = null)
                    {
                        if (is_array($library)) {
                            return $this->libraries($library);
                        }
                Severity: Minor
                Found in third_party/MX/Loader.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language