RebelCode/modular

View on GitHub

Showing 95 of 95 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

namespace RebelCode\Modular\Events;

use Dhii\Event\EventFactoryInterface;
Severity: Major
Found in src/Events/EventFactoryAwareTrait.php and 1 other location - About 3 hrs to fix
src/Events/EventManagerAwareTrait.php on lines 1..92

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 157.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<?php

namespace RebelCode\Modular\Events;

use Dhii\Util\String\StringableInterface as Stringable;
Severity: Major
Found in src/Events/EventManagerAwareTrait.php and 1 other location - About 3 hrs to fix
src/Events/EventFactoryAwareTrait.php on lines 1..92

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 157.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid using short method names like EventManagerAwareTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);
Severity: Minor
Found in src/Events/EventManagerAwareTrait.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Avoid using short method names like TriggerCapableTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);
Severity: Minor
Found in src/Events/TriggerCapableTrait.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Avoid using short method names like DetachCapableTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);
Severity: Minor
Found in src/Events/DetachCapableTrait.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Avoid using short method names like AttachCapableTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);
Severity: Minor
Found in src/Events/AttachCapableTrait.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Avoid using short method names like EventFactoryAwareTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);
Severity: Minor
Found in src/Events/EventFactoryAwareTrait.php by phpmd

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Avoid using short method names like CreateEventCapableTrait::__(). The configured minimum method name length is 3.
Open

    abstract protected function __($string, $args = [], $context = null);

ShortMethodName

Since: 0.2

Detects when very short method names are used.

Example

class ShortMethod {
    public function a( $index ) { // Violation
    }
}

Source https://phpmd.org/rules/naming.html#shortmethodname

Method _loadPhpConfigFile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _loadPhpConfigFile($filePath)
    {
        if (!file_exists($filePath) || !is_readable($filePath)) {
            throw $this->_createRuntimeException(
                $this->__('Config file does not exist or not readable'),
Severity: Minor
Found in src/Module/AbstractBaseModule.php - About 1 hr to fix

    Avoid variables with short names like $c. Configured minimum length is 3.
    Open

        protected function _run(ContainerInterface $c = null)
    Severity: Minor
    Found in src/Module/ModularModuleTrait.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Method _initModule has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $key,
            $dependencies,
            ConfigFactoryInterface $configFactory,
            ContainerFactoryInterface $containerFactory,
            ContainerFactoryInterface $compContainerFactory
    Severity: Minor
    Found in src/Module/AbstractBaseModule.php - About 35 mins to fix

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

          protected function _setup()
          {
              // The list of containers that will be added to the composite container
              $containers = $this->_createAddCapableList();
              // The composite container - the container for this modular module
      Severity: Minor
      Found in src/Module/ModularModuleTrait.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 variable $_depKey is not named in camelCase.
      Open

          protected function _getModuleDependencies(ModuleInterface $module)
          {
              if (!($module instanceof DependenciesAwareInterface)) {
                  return [];
              }

      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 $_module is not named in camelCase.
      Open

          protected function _setup()
          {
              // The list of containers that will be added to the composite container
              $containers = $this->_createAddCapableList();
              // The composite container - the container for this modular module
      Severity: Minor
      Found in src/Module/ModularModuleTrait.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 $_moduleContainer is not named in camelCase.
      Open

          protected function _setup()
          {
              // The list of containers that will be added to the composite container
              $containers = $this->_createAddCapableList();
              // The composite container - the container for this modular module
      Severity: Minor
      Found in src/Module/ModularModuleTrait.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 $_module is not named in camelCase.
      Open

          protected function _createModuleMap($modules)
          {
              $this->moduleMap = [];
      
              foreach ($modules as $_module) {

      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 $_module is not named in camelCase.
      Open

          protected function _setup()
          {
              // The list of containers that will be added to the composite container
              $containers = $this->_createAddCapableList();
              // The composite container - the container for this modular module
      Severity: Minor
      Found in src/Module/ModularModuleTrait.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 $_container is not named in camelCase.
      Open

          protected function _setup()
          {
              // The list of containers that will be added to the composite container
              $containers = $this->_createAddCapableList();
              // The composite container - the container for this modular module
      Severity: Minor
      Found in src/Module/ModularModuleTrait.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 $_container is not named in camelCase.
      Open

          protected function _setup()
          {
              // The list of containers that will be added to the composite container
              $containers = $this->_createAddCapableList();
              // The composite container - the container for this modular module
      Severity: Minor
      Found in src/Module/ModularModuleTrait.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 $_moduleContainer is not named in camelCase.
      Open

          protected function _setup()
          {
              // The list of containers that will be added to the composite container
              $containers = $this->_createAddCapableList();
              // The composite container - the container for this modular module
      Severity: Minor
      Found in src/Module/ModularModuleTrait.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

      Severity
      Category
      Status
      Source
      Language