spotweb/spotweb

View on GitHub
lib/services/Providers/Services_Providers_HttpNzb.php

Summary

Maintainability
D
2 days
Test Coverage

Function hasUrlForSpot has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    public function hasUrlForSpot()
    {
        if ($this->alternateDownloadUrl) {
            return true;
        }
Severity: Minor
Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 5 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 downloadNzbFromBinsearch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function downloadNzbFromBinsearch($url, $body)
    {
        // Match to get the nzb id.
        preg_match('/\q\=([a-z0-9]*)&*/i', $url, $matches);

Severity: Minor
Found in lib/services/Providers/Services_Providers_HttpNzb.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

Method hasUrlForSpot has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function hasUrlForSpot()
    {
        if ($this->alternateDownloadUrl) {
            return true;
        }
Severity: Major
Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 2 hrs to fix

    File Services_Providers_HttpNzb.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     * FIXME
     * XXX
     * TODO
    Severity: Minor
    Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 2 hrs to fix

      Function downloadNzbFromNzbindex has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function downloadNzbFromNzbindex($url)
          {
              // New http request to get the page again
              // This time do a request with the cookie that accepts the Disclaimer agreement.
      
      
      Severity: Minor
      Found in lib/services/Providers/Services_Providers_HttpNzb.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 downloadNzbFromBinsearch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function downloadNzbFromBinsearch($url, $body)
          {
              // Match to get the nzb id.
              preg_match('/\q\=([a-z0-9]*)&*/i', $url, $matches);
      
      
      Severity: Minor
      Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 1 hr to fix

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

            public function getNzb()
            {
                if ($this->nzb) {
                    // \O/ We already found an nzb before. Return the xml!
                    return $this->nzb;
        Severity: Minor
        Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 1 hr to fix

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

              public function getNzb()
              {
                  if ($this->nzb) {
                      // \O/ We already found an nzb before. Return the xml!
                      return $this->nzb;
          Severity: Minor
          Found in lib/services/Providers/Services_Providers_HttpNzb.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

          Avoid too many return statements within this method.
          Open

                  return false;
          Severity: Major
          Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $this->nzb;
            Severity: Major
            Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return false;
              Severity: Major
              Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                            return true;
                Severity: Major
                Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return null;
                  Severity: Major
                  Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status