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) {
- Read upRead up
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')
- Read upRead up
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
*
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
- Read upRead up
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 = [];
- Read upRead up
- Exclude checks
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 = [];
- Exclude checks
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)) {
- Read upRead up
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) {
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')
MX_Loader
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class MX_Loader extends CI_Loader
{
protected $_module;
public $_ci_plugins = [];
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);
- Read upRead up
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)) {
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);
- Read upRead up
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);
}
- Read upRead up
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);
}
- Read upRead up
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
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);
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.
- Read upRead up
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);
}
- Read upRead up
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);
}