Function pluginMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function pluginMap($path="",$carry=array())
{
if ($path == '') {
$path = static::defaultSearchDir();
}
- 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
Missing class import via use statement (line '77', column '21'). Open
$info = new \ReflectionClass($this);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using COREPOS\common\count() function in for loops. Open
for($i=0;$i<count($dirs);$i++) {
if ($dirs[$i] == $exclude && isset($dirs[$i+1])) {
return $dirs[$i+1];
}
}
- Read upRead up
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
The property $unmapped_files is not named in camelCase. Open
class CorePlugin
{
/**
Desired settings. These are automatically exposed
on the 'Plugins' area of the install page and
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $plugin_settings is not named in camelCase. Open
class CorePlugin
{
/**
Desired settings. These are automatically exposed
on the 'Plugins' area of the install page and
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $plugin_description is not named in camelCase. Open
class CorePlugin
{
/**
Desired settings. These are automatically exposed
on the 'Plugins' area of the install page and
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The variable $plugin_list is not named in camelCase. Open
public static function isEnabled($plugin)
{
$plugin_list = static::getPluginList();
return (is_array($plugin_list) && in_array($plugin, $plugin_list)) ? true : false;
- Read upRead up
- Exclude checks
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 $plugin_list is not named in camelCase. Open
public static function isEnabled($plugin)
{
$plugin_list = static::getPluginList();
return (is_array($plugin_list) && in_array($plugin, $plugin_list)) ? true : false;
- Read upRead up
- Exclude checks
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 $plugin_list is not named in camelCase. Open
public static function isEnabled($plugin)
{
$plugin_list = static::getPluginList();
return (is_array($plugin_list) && in_array($plugin, $plugin_list)) ? true : false;
- Read upRead up
- Exclude checks
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();
}
}