vaimo/composer-patches

View on GitHub
src/Patch/SourceLoaders/PatchesSearch.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method createDefinitionItem has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function createDefinitionItem($contents, array $values = array())
    {
        $header = $this->fileAnalyser->getHeader($contents);

        $data = $this->applyAliases(
Severity: Minor
Found in src/Patch/SourceLoaders/PatchesSearch.php - About 1 hr to fix

    Method resolveBaseInfo has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function resolveBaseInfo(array $data)
        {
            $target = false;
    
            list($package, $version, $depends) = $this->resolveBaseData($data);
    Severity: Minor
    Found in src/Patch/SourceLoaders/PatchesSearch.php - About 1 hr to fix

      Function applyAliases has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          private function applyAliases(array $data, array $aliases)
          {
              foreach ($aliases as $target => $origins) {
                  if (isset($data[$target])) {
                      continue;
      Severity: Minor
      Found in src/Patch/SourceLoaders/PatchesSearch.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 createPatchDefinitions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function createPatchDefinitions($basePath, array $paths)
          {
              $groups = array();
              $basePathLength = strlen($basePath);
      
      
      Severity: Minor
      Found in src/Patch/SourceLoaders/PatchesSearch.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 '80', column '38').
      Open

              $this->fileSystemUtils = new \Vaimo\ComposerPatches\Utils\FileSystemUtils();

      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

      Missing class import via use statement (line '76', column '38').
      Open

              $this->patchFileLoader = new \Vaimo\ComposerPatches\Patch\File\Loader();

      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

      Missing class import via use statement (line '79', column '40').
      Open

              $this->patchHeaderParser = new \Vaimo\ComposerPatches\Patch\File\Header\Parser();

      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

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

              $this->fileAnalyser = new \Vaimo\ComposerPatches\Patch\File\Analyser();

      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

      Parameter $package has undeclared type \Composer\Package\PackageInterface
      Open

          public function load(\Composer\Package\PackageInterface $package, $source)

      Parameter $package has undeclared type \Composer\Package\PackageInterface
      Open

          private function getInstallPath(\Composer\Package\PackageInterface $package)

      Checking instanceof against undeclared class \Composer\Package\RootPackageInterface
      Open

              if ($package instanceof \Composer\Package\RootPackageInterface) {
      Severity: Critical
      Found in src/Patch/SourceLoaders/PatchesSearch.php by phan

      Call to method getInstallPath from undeclared class \Composer\Installer\InstallationManager
      Open

              return $this->installationManager->getInstallPath($package);
      Severity: Critical
      Found in src/Patch/SourceLoaders/PatchesSearch.php by phan

      Property \Vaimo\ComposerPatches\Patch\SourceLoaders\PatchesSearch->installationManager has undeclared type \Composer\Installer\InstallationManager
      Open

          private $installationManager;

      Parameter $installationManager has undeclared type \Composer\Installer\InstallationManager
      Open

          public function __construct(

      There are no issues that match your filters.

      Category
      Status