spotweb/spotweb

View on GitHub
lib/page/SpotPage_newznabapi.php

Summary

Maintainability
F
1 wk
Test Coverage

File SpotPage_newznabapi.php has 887 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class SpotPage_newznabapi extends SpotPage_Abs
{
    private $_params;
Severity: Major
Found in lib/page/SpotPage_newznabapi.php - About 2 days to fix

    Function search has a Cognitive Complexity of 94 (exceeds 5 allowed). Consider refactoring.
    Open

        public function search($outputtype)
        {
            // Check users' permissions
            $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_perform_search, '');
    
    
    Severity: Minor
    Found in lib/page/SpotPage_newznabapi.php - About 1 day 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 showResults has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

        public function showResults($spots, $offset, $outputtype)
        {
            $nzbhandling = $this->_currentSession['user']['prefs']['nzbhandling'];
    
            if ($outputtype == 'json') {
    Severity: Minor
    Found in lib/page/SpotPage_newznabapi.php - About 1 day 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 search has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function search($outputtype)
        {
            // Check users' permissions
            $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_perform_search, '');
    
    
    Severity: Major
    Found in lib/page/SpotPage_newznabapi.php - About 7 hrs to fix

      Method showResults has 150 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function showResults($spots, $offset, $outputtype)
          {
              $nzbhandling = $this->_currentSession['user']['prefs']['nzbhandling'];
      
              if ($outputtype == 'json') {
      Severity: Major
      Found in lib/page/SpotPage_newznabapi.php - About 6 hrs to fix

        Method spotAcat2nabcat has 122 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function spotAcat2nabcat()
            {
                return [0 => // Cat0 - Image
                        [0 => // Z0 - Movie
                                    [0     => '2000|2030',
        Severity: Major
        Found in lib/page/SpotPage_newznabapi.php - About 4 hrs to fix

          Method spotDetails has 114 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function spotDetails($outputtype)
              {
                  if (empty($this->_params['messageid'])) {
                      $this->showApiError(200);
          
          
          Severity: Major
          Found in lib/page/SpotPage_newznabapi.php - About 4 hrs to fix

            Method caps has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function caps($outputtype)
                {
                    $doc = new DOMDocument('1.0', 'utf-8');
                    $doc->formatOutput = true;
            
            
            Severity: Major
            Found in lib/page/SpotPage_newznabapi.php - About 2 hrs to fix

              Function showApiError has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function showApiError($errcode = 42)
                  {
                      switch ($errcode) {
                          case 100: $errtext = 'Incorrect user credentials';
                              break;
              Severity: Minor
              Found in lib/page/SpotPage_newznabapi.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 spotDetails has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function spotDetails($outputtype)
                  {
                      if (empty($this->_params['messageid'])) {
                          $this->showApiError(200);
              
              
              Severity: Minor
              Found in lib/page/SpotPage_newznabapi.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 categories has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function categories()
                  {
                      return [
                          ['name'              => 'Console',
                              'cat'               => '1000',
              Severity: Minor
              Found in lib/page/SpotPage_newznabapi.php - About 1 hr to fix

                Method showApiError has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function showApiError($errcode = 42)
                    {
                        switch ($errcode) {
                            case 100: $errtext = 'Incorrect user credentials';
                                break;
                Severity: Minor
                Found in lib/page/SpotPage_newznabapi.php - About 1 hr to fix

                  Function Cat2NewznabCat has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function Cat2NewznabCat($hcat, $cat, $catZ)
                      {
                          $catList = explode('|', $cat);
                          $cat = $catList[0];
                          $nr = substr($cat, 1);
                  Severity: Minor
                  Found in lib/page/SpotPage_newznabapi.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 nabcat2spotcat has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function nabcat2spotcat($cat)
                      {
                          switch ($cat) {
                              case 1000: return 'cat2_a3,cat2_a4,cat2_a5,cat2_a6,cat2_a7,cat2_a8,cat2_a9,cat2_a10,cat2_a11,cat2_a12';
                              case 1010: return 'cat2_a10';
                  Severity: Minor
                  Found in lib/page/SpotPage_newznabapi.php - About 1 hr to fix

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

                        public function Cat2NewznabCat($hcat, $cat, $catZ)
                        {
                            $catList = explode('|', $cat);
                            $cat = $catList[0];
                            $nr = substr($cat, 1);
                    Severity: Minor
                    Found in lib/page/SpotPage_newznabapi.php - About 1 hr to fix

                      Method render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function render()
                          {
                              // Don't let this output be cached
                              $this->sendExpireHeaders(true);
                      
                      
                      Severity: Minor
                      Found in lib/page/SpotPage_newznabapi.php - About 1 hr to fix

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

                            public function render()
                            {
                                // Don't let this output be cached
                                $this->sendExpireHeaders(true);
                        
                        
                        Severity: Minor
                        Found in lib/page/SpotPage_newznabapi.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 caps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function caps($outputtype)
                            {
                                $doc = new DOMDocument('1.0', 'utf-8');
                                $doc->formatOutput = true;
                        
                        
                        Severity: Minor
                        Found in lib/page/SpotPage_newznabapi.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;
                        Severity: Major
                        Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      case 7020: return 'cat0_z2';
                          Severity: Major
                          Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return;
                            Severity: Major
                            Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          case 3030: return 'cat1_z3';
                              Severity: Major
                              Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            case 5030: return 'cat0_z1_a0,cat0_z1_a1,cat0_z1_a2,cat0_z1_a3,cat0_z1_a10,cat0_z1_d';
                                Severity: Major
                                Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              case 5050: return 'cat0_z1,cat0_z1_d';
                                  Severity: Major
                                  Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                case 4040: return 'cat3_a4,cat3_a5,cat3_a6,cat3_a7';
                                    Severity: Major
                                    Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  case 1060: return 'cat2_a7';
                                      Severity: Major
                                      Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    case 4000: return 'cat3';
                                        Severity: Major
                                        Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      case 5040: return 'cat0_z1_a4,cat0_z1_a6,cat0_z1_a7,cat0_z1_a8,cat0_z1_a9,cat0_z1_a14,cat0_z1_a15,cat0_z1_d';
                                          Severity: Major
                                          Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        case 3010: return 'cat1_a0';
                                            Severity: Major
                                            Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                                  return;
                                              Severity: Major
                                              Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            case 1050: return 'cat2_a7';
                                                Severity: Major
                                                Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                              case 2050: return 'cat0_z0_a6';                                               // Movies/BluRay
                                                  Severity: Major
                                                  Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                case 2030: return 'cat0_z0_a0,cat0_z0_a1,cat0_z0_a2,cat0_z0_a3,cat0_z0_a10';  // Movies/SD
                                                    Severity: Major
                                                    Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                  case 3040: return 'cat1_a2,cat1_a4,cat1_a7,cat1_a8';
                                                      Severity: Major
                                                      Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                    case 6020: return 'cat0_z3_a1,cat0_z3_a8';
                                                        Severity: Major
                                                        Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return '';
                                                          Severity: Major
                                                          Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        case 6030: return 'cat0_z3_a0';
                                                            Severity: Major
                                                            Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                          case 3020: return 'cat0_d13';
                                                              Severity: Major
                                                              Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            case 4050: return 'cat2_a';
                                                                Severity: Major
                                                                Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                              case 5000: return 'cat0_z1,cat0_z1_d';
                                                                  Severity: Major
                                                                  Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                case 5020: return 'cat0_z1,cat0_z1_d';
                                                                    Severity: Major
                                                                    Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                  case 6040: return 'cat0_z3_a4,cat0_z3_a6,cat0_z3_a7,cat0_z3_a8,cat0_z3_a9';
                                                                      Severity: Major
                                                                      Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                    case 6010: return 'cat0_z3_a3,cat0_z3_a10';
                                                                        Severity: Major
                                                                        Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                      case 5060: return 'cat0_z1_d18';
                                                                          Severity: Major
                                                                          Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                        case 1040: return 'cat2_a6';
                                                                            Severity: Major
                                                                            Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                          case 2000: return 'cat0_z0';
                                                                              Severity: Major
                                                                              Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            case 3000: return 'cat1_a';
                                                                                Severity: Major
                                                                                Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                              case 5070: return 'cat0_z1_d29';
                                                                                  Severity: Major
                                                                                  Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                case 6000: return 'cat0_z3';
                                                                                    Severity: Major
                                                                                    Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                  case 2040: return 'cat0_z0_a4,cat0_z0_a7,cat0_z0_a8,cat0_z0_a9';              // Movies/HD
                                                                                      Severity: Major
                                                                                      Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                    case 2060: return 'cat0_z0_a14';                                              // Movies/3D
                                                                                        Severity: Major
                                                                                        Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                      case 4020: return 'cat3_a0';
                                                                                          Severity: Major
                                                                                          Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                        case 4030: return 'cat3_a1';
                                                                                            Severity: Major
                                                                                            Found in lib/page/SpotPage_newznabapi.php - About 30 mins to fix

                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if ($nabCat[0] != '' && is_numeric($nabCat[0])) {
                                                                                                              $attr = $doc->createElement('newznab:attr');
                                                                                                              $attr->setAttribute('name', 'category');
                                                                                                              $attr->setAttribute('value', $nabCat[0]);
                                                                                                              $item->appendChild($attr);
                                                                                              Severity: Major
                                                                                              Found in lib/page/SpotPage_newznabapi.php and 1 other location - About 2 hrs to fix
                                                                                              lib/page/SpotPage_newznabapi.php on lines 476..486

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 128.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                              if ($nabCat[0] != '' && is_numeric($nabCat[0])) {
                                                                                                                  $attr = $doc->createElement('newznab:attr');
                                                                                                                  $attr->setAttribute('name', 'category');
                                                                                                                  $attr->setAttribute('value', $nabCat[0]);
                                                                                                                  $item->appendChild($attr);
                                                                                              Severity: Major
                                                                                              Found in lib/page/SpotPage_newznabapi.php and 1 other location - About 2 hrs to fix
                                                                                              lib/page/SpotPage_newznabapi.php on lines 674..684

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 128.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if (($found == false) and ($this->_params['tvmazeid'] != '')) {
                                                                                                              if (!preg_match('/^[0-9]{1,6}$/', $this->_params['tvmazeid'])) {
                                                                                                                  $this->showApiError(201);
                                                                                              
                                                                                                                  return;
                                                                                              Severity: Major
                                                                                              Found in lib/page/SpotPage_newznabapi.php and 1 other location - About 2 hrs to fix
                                                                                              lib/page/SpotPage_newznabapi.php on lines 111..127

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 122.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          if (($found == false) and ($this->_params['rid'] != '')) {
                                                                                                              // validate input
                                                                                                              if (!preg_match('/^[0-9]{1,6}$/', $this->_params['rid'])) {
                                                                                                                  $this->showApiError(201);
                                                                                              
                                                                                              
                                                                                              Severity: Major
                                                                                              Found in lib/page/SpotPage_newznabapi.php and 1 other location - About 2 hrs to fix
                                                                                              lib/page/SpotPage_newznabapi.php on lines 94..109

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 122.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                              Open

                                                                                                          2 => // Cat2 - Games
                                                                                                            [0     => '4000|4050',
                                                                                                                1  => '4000|4030',
                                                                                                                2  => 'TUX',
                                                                                                                3  => 'PS',
                                                                                              Severity: Major
                                                                                              Found in lib/page/SpotPage_newznabapi.php and 1 other location - About 1 hr to fix
                                                                                              lib/SpotCategories.php on lines 65..84

                                                                                              Duplicated Code

                                                                                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                              Tuning

                                                                                              This issue has a mass of 101.

                                                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                              Refactorings

                                                                                              Further Reading

                                                                                              There are no issues that match your filters.

                                                                                              Category
                                                                                              Status