Bee-Lab/bowerphp

View on GitHub
src/Bowerphp/Installer/Installer.php

Summary

Maintainability
D
1 day
Test Coverage

Function isIgnored has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function isIgnored($name, array $ignore, array $force, $dirName)
    {
        $vName = substr($name, strlen($dirName));
        if (in_array($vName, $force, true)) {
            return false;
Severity: Minor
Found in src/Bowerphp/Installer/Installer.php - About 6 hrs 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

Method isIgnored has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function isIgnored($name, array $ignore, array $force, $dirName)
    {
        $vName = substr($name, strlen($dirName));
        if (in_array($vName, $force, true)) {
            return false;
Severity: Major
Found in src/Bowerphp/Installer/Installer.php - About 2 hrs to fix

    Method install has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function install(PackageInterface $package)
        {
            $tmpFileName = $this->config->getCacheDir() . '/tmp/' . $package->getName();
            if (true !== $this->zipArchive->open($tmpFileName)) {
                throw new RuntimeException(sprintf('Unable to open zip file %s.', $tmpFileName));
    Severity: Minor
    Found in src/Bowerphp/Installer/Installer.php - About 1 hr to fix

      Function install has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function install(PackageInterface $package)
          {
              $tmpFileName = $this->config->getCacheDir() . '/tmp/' . $package->getName();
              if (true !== $this->zipArchive->open($tmpFileName)) {
                  throw new RuntimeException(sprintf('Unable to open zip file %s.', $tmpFileName));
      Severity: Minor
      Found in src/Bowerphp/Installer/Installer.php - About 55 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

      Function getInstalled has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getInstalled(Finder $finder)
          {
              $packages = [];
              if (!$this->filesystem->exists($this->config->getInstallDir())) {
                  return $packages;
      Severity: Minor
      Found in src/Bowerphp/Installer/Installer.php - About 35 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

      Avoid too many return statements within this method.
      Open

              return false;
      Severity: Major
      Found in src/Bowerphp/Installer/Installer.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return true;
        Severity: Major
        Found in src/Bowerphp/Installer/Installer.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return true;
          Severity: Major
          Found in src/Bowerphp/Installer/Installer.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return true;
            Severity: Major
            Found in src/Bowerphp/Installer/Installer.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return true;
              Severity: Major
              Found in src/Bowerphp/Installer/Installer.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status