Bee-Lab/bowerphp

View on GitHub
src/Bowerphp/Bowerphp.php

Summary

Maintainability
D
2 days
Test Coverage

File Bowerphp.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of Bowerphp.
 *
Severity: Minor
Found in src/Bowerphp/Bowerphp.php - About 3 hrs to fix

    Function isPackageExtraneous has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isPackageExtraneous(PackageInterface $package, $checkInstall = false)
        {
            if ($checkInstall && !$this->isPackageInstalled($package)) {
                return false;
            }
    Severity: Minor
    Found in src/Bowerphp/Bowerphp.php - About 2 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

    Function installPackage has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public function installPackage(PackageInterface $package, InstallerInterface $installer, $isDependency = false)
        {
            if (false !== strpos($package->getName(), 'github')) {
                // install from a github endpoint
                $name = basename($package->getName(), '.git');
    Severity: Minor
    Found in src/Bowerphp/Bowerphp.php - About 2 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

    Function updatePackage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updatePackage(PackageInterface $package, InstallerInterface $installer)
        {
            if (!$this->isPackageInstalled($package)) {
                throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
            }
    Severity: Minor
    Found in src/Bowerphp/Bowerphp.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

    Method installPackage has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function installPackage(PackageInterface $package, InstallerInterface $installer, $isDependency = false)
        {
            if (false !== strpos($package->getName(), 'github')) {
                // install from a github endpoint
                $name = basename($package->getName(), '.git');
    Severity: Minor
    Found in src/Bowerphp/Bowerphp.php - About 1 hr to fix

      Method updatePackage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updatePackage(PackageInterface $package, InstallerInterface $installer)
          {
              if (!$this->isPackageInstalled($package)) {
                  throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
              }
      Severity: Minor
      Found in src/Bowerphp/Bowerphp.php - About 1 hr to fix

        Method isPackageExtraneous has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function isPackageExtraneous(PackageInterface $package, $checkInstall = false)
            {
                if ($checkInstall && !$this->isPackageInstalled($package)) {
                    return false;
                }
        Severity: Minor
        Found in src/Bowerphp/Bowerphp.php - About 1 hr to fix

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

                  ConfigInterface $config,
                  Filesystem $filesystem,
                  Client $githubClient,
                  RepositoryInterface $repository,
                  BowerphpConsoleOutput $output
          Severity: Minor
          Found in src/Bowerphp/Bowerphp.php - About 35 mins to fix

            Avoid too many return statements within this method.
            Open

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

              Avoid too many return statements within this method.
              Open

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

                Avoid too many return statements within this method.
                Open

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

                  Function installDependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function installDependencies(InstallerInterface $installer)
                      {
                          $decode = $this->config->getBowerFileContent();
                          if (!empty($decode['dependencies'])) {
                              foreach ($decode['dependencies'] as $name => $requiredVersion) {
                  Severity: Minor
                  Found in src/Bowerphp/Bowerphp.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

                  There are no issues that match your filters.

                  Category
                  Status