Kanti/hub-updater

View on GitHub

Showing 11 of 11 total issues

File HubUpdater.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Kanti;

use Composer\CaBundle\CaBundle;
Severity: Minor
Found in src/HubUpdater.php - About 2 hrs to fix

    Method __construct has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($option)
        {
            if (!in_array('https', stream_get_wrappers())) {
                throw new \Exception("No HTTPS Wrapper Exception");
            }
    Severity: Major
    Found in src/HubUpdater.php - About 2 hrs to fix

      Function getNewestInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getNewestInfo()
          {
              if (is_null($this->newestInfo)) {
                  foreach ($this->allRelease as $release) {
                      if (isset($release['prerelease']) && $release['prerelease'] && !$this->options['prerelease']) {
      Severity: Minor
      Found in src/HubUpdater.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 unZip has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function unZip()
          {
              $path = getcwd() . "/" . $this->options['cache'] . $this->options['zipFile'];
      
              $zip = new \ZipArchive();
      Severity: Minor
      Found in src/HubUpdater.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 getCurrentInfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getCurrentInfo()
          {
              if (is_null($this->currentInfo) && file_exists($this->options['cache'] . $this->options['versionFile'])) {
                  $fileContent = file_get_contents($this->options['cache'] . $this->options['versionFile']);
                  $current = json_decode($fileContent, true);
      Severity: Minor
      Found in src/HubUpdater.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 able has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function able()
          {
              if (empty($this->allRelease)) {
                  return false;
              }
      Severity: Minor
      Found in src/HubUpdater.php - About 45 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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct($option)
          {
              if (!in_array('https', stream_get_wrappers())) {
                  throw new \Exception("No HTTPS Wrapper Exception");
              }
      Severity: Minor
      Found in src/HubUpdater.php - About 45 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 setOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function setOptions($option)
          {
              if (is_array($option)) {
                  if (!isset($option['name']) || empty($option['name'])) {
                      throw new \Exception('No Name in Option Set');
      Severity: Minor
      Found in src/HubUpdater.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

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

          protected function shouldBeCopied($file)
          {
              static $updateIgnore = array();
              if (empty($updateIgnore) && file_exists($this->options['updateignore'])) {
                  $updateIgnore = file($this->options['updateignore']);
      Severity: Minor
      Found in src/HubUpdater.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

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

          protected function getRemoteInfo()
          {
              if ($this->cachedInfo->has()) {
                  return json_decode($this->cachedInfo->get(), true);
              }
      Severity: Minor
      Found in src/HubUpdater.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

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

          public function update()
          {
              $newestRelease = $this->getNewestInfo();
              if ($this->able()) {
                  if ($this->download($newestRelease['zipball_url'])) {
      Severity: Minor
      Found in src/HubUpdater.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

      Severity
      Category
      Status
      Source
      Language