CORE-POS/Common-Bundle

View on GitHub
src/CorePlugin.php

Summary

Maintainability
A
25 mins
Test Coverage

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();
        }
Severity: Minor
Found in src/CorePlugin.php - About 25 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

Missing class import via use statement (line '77', column '21').
Open

        $info = new \ReflectionClass($this);
Severity: Minor
Found in src/CorePlugin.php by phpmd

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];
            }
        }
Severity: Minor
Found in src/CorePlugin.php by phpmd

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
Severity: Minor
Found in src/CorePlugin.php by phpmd

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
Severity: Minor
Found in src/CorePlugin.php by phpmd

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
Severity: Minor
Found in src/CorePlugin.php by phpmd

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;
Severity: Minor
Found in src/CorePlugin.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 $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;
Severity: Minor
Found in src/CorePlugin.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 $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;
Severity: Minor
Found in src/CorePlugin.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

There are no issues that match your filters.

Category
Status