railpage/railpagecore

View on GitHub
lib/Jobs/Scraper.php

Summary

Maintainability
F
4 days
Test Coverage

Method fetchOld has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function fetchOld() {

        if (!is_string($this->feed)) {
            throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
        }
Severity: Major
Found in lib/Jobs/Scraper.php - About 2 hrs to fix

    Method fetch has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function fetch() {
    
            if (!is_string($this->feed)) {
                throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
            }
    Severity: Major
    Found in lib/Jobs/Scraper.php - About 2 hrs to fix

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

          public function fetch() {
      
              if (!is_string($this->feed)) {
                  throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
              }
      Severity: Minor
      Found in lib/Jobs/Scraper.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 fetchOld has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fetchOld() {
      
              if (!is_string($this->feed)) {
                  throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
              }
      Severity: Minor
      Found in lib/Jobs/Scraper.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 store has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function store() {
      
              foreach ($this->jobs as $job) {
      
                  if (strtolower(trim($job['title'])) != "test job") {
      Severity: Minor
      Found in lib/Jobs/Scraper.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

      The method fetchOld() has 112 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

          public function fetchOld() {
      
              if (!is_string($this->feed)) {
                  throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
              }
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      The method fetch() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
      Open

          public function fetch() {
      
              if (!is_string($this->feed)) {
                  throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
              }
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      CyclomaticComplexity

      Since: 0.1

      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

      Example

      // Cyclomatic Complexity = 11
      class Foo {
      1   public function example() {
      2       if ($a == $b) {
      3           if ($a1 == $b1) {
                      fiddle();
      4           } elseif ($a2 == $b2) {
                      fiddle();
                  } else {
                      fiddle();
                  }
      5       } elseif ($c == $d) {
      6           while ($c == $d) {
                      fiddle();
                  }
      7        } elseif ($e == $f) {
      8           for ($n = 0; $n < $h; $n++) {
                      fiddle();
                  }
              } else {
                  switch ($z) {
      9               case 1:
                          fiddle();
                          break;
      10              case 2:
                          fiddle();
                          break;
      11              case 3:
                          fiddle();
                          break;
                      default:
                          fiddle();
                          break;
                  }
              }
          }
      }

      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

      The class Scraper has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
      Open

      class Scraper extends AppCore {
      
          /**
           * RSS feed URL
           *
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

      Example

      class Foo {
          /**
           * @var \foo\bar\X
           */
          private $x = null;
      
          /**
           * @var \foo\bar\Y
           */
          private $y = null;
      
          /**
           * @var \foo\bar\Z
           */
          private $z = null;
      
          public function setFoo(\Foo $foo) {}
          public function setBar(\Bar $bar) {}
          public function setBaz(\Baz $baz) {}
      
          /**
           * @return \SplObjectStorage
           * @throws \OutOfRangeException
           * @throws \InvalidArgumentException
           * @throws \ErrorException
           */
          public function process(\Iterator $it) {}
      
          // ...
      }

      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

      The method __construct has a boolean flag argument $url, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function __construct($url = false, $provider = "pageuppeople", Organisation $Organisation) {
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method fetch uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                      } else {
                          $woe = getWoeData(sprintf("%s, %s", $location[1], $location[0]));
      
                          if (count($woe)) {
                              $location = array(
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method fetchOld uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      $woe = getWoeData(sprintf("%s, %s", $location[1], $location[0]));
      
                      if (count($woe)) {
                          $location = array(
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method store() contains an exit expression.
      Open

                          die;
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      ExitExpression

      Since: 0.2

      An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

      Example

      class Foo {
          public function bar($param)  {
              if ($param === 42) {
                  exit(23);
              }
          }
      }

      Source https://phpmd.org/rules/design.html#exitexpression

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

                      if (!function_exists("getWoeData")) {
                          $location = array(
                              "name" => sprintf("%, %s", $location[1], $location[0])
                          );
                      } else {
      Severity: Major
      Found in lib/Jobs/Scraper.php and 1 other location - About 1 day to fix
      lib/Jobs/Scraper.php on lines 250..264

      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 177.

      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 (!function_exists("getWoeData")) {
                      $location = array(
                          "name" => sprintf("%, %s", $location[1], $location[0])
                      );
                  } else {
      Severity: Major
      Found in lib/Jobs/Scraper.php and 1 other location - About 1 day to fix
      lib/Jobs/Scraper.php on lines 127..141

      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 177.

      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 (!is_array($location) || count($location) === 1) {
                          $location = array(
                              0 => "Australia",
                              1 => is_array($location) ? $location[0] : $location
                          );
      Severity: Major
      Found in lib/Jobs/Scraper.php and 1 other location - About 2 hrs to fix
      lib/Jobs/Scraper.php on lines 237..242

      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 64.

      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 (!is_array($location) || count($location) === 1) {
                      $location = array(
                          0 => "Australia",
                          1 => is_array($location) ? $location[0] : $location
                      );
      Severity: Major
      Found in lib/Jobs/Scraper.php and 1 other location - About 2 hrs to fix
      lib/Jobs/Scraper.php on lines 114..119

      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 64.

      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 5 locations. Consider refactoring.
      Open

              $config = array(
                  'adapter'     => 'Zend\Http\Client\Adapter\Curl',
                  'curloptions' => array(CURLOPT_FOLLOWLOCATION => true),
              );
      Severity: Major
      Found in lib/Jobs/Scraper.php and 4 other locations - About 1 hr to fix
      lib/Bugs/Bugs.php on lines 51..54
      lib/GTFS/AU/VIC/PTV/PTV.php on lines 278..281
      lib/Graphite/Graph.php on lines 87..90
      lib/News/Scraper.php on lines 137..140

      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 30.

      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 8 locations. Consider refactoring.
      Open

              if (!is_string($this->feed)) {
                  throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
              }
      Severity: Major
      Found in lib/Jobs/Scraper.php and 7 other locations - About 45 mins to fix
      lib/Forums/Thread.php on lines 445..447
      lib/Images/Image.php on lines 446..448
      lib/Jobs/Scraper.php on lines 96..98
      lib/Locos/Date.php on lines 258..260
      lib/News/Scraper.php on lines 86..88
      lib/Newsletters/Newsletter.php on lines 147..149
      lib/Notifications/Transport/Email.php on lines 167..169

      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 26.

      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 8 locations. Consider refactoring.
      Open

              if (!is_string($this->feed)) {
                  throw new Exception("Cannot fetch jobs from RSS feed because no RSS feed was provided");
              }
      Severity: Major
      Found in lib/Jobs/Scraper.php and 7 other locations - About 45 mins to fix
      lib/Forums/Thread.php on lines 445..447
      lib/Images/Image.php on lines 446..448
      lib/Jobs/Scraper.php on lines 192..194
      lib/Locos/Date.php on lines 258..260
      lib/News/Scraper.php on lines 86..88
      lib/Newsletters/Newsletter.php on lines 147..149
      lib/Notifications/Transport/Email.php on lines 167..169

      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 26.

      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 4 locations. Consider refactoring.
      Open

                  $row['date']['open']->setTimeZone(new DateTimeZone($timezone));
      Severity: Major
      Found in lib/Jobs/Scraper.php and 3 other locations - About 40 mins to fix
      lib/Jobs/Scraper.php on lines 166..166
      lib/Jobs/Scraper.php on lines 167..167
      lib/Jobs/Scraper.php on lines 289..289

      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 24.

      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 4 locations. Consider refactoring.
      Open

                  $row['date']['close']->setTimeZone(new DateTimeZone($timezone));
      Severity: Major
      Found in lib/Jobs/Scraper.php and 3 other locations - About 40 mins to fix
      lib/Jobs/Scraper.php on lines 166..166
      lib/Jobs/Scraper.php on lines 167..167
      lib/Jobs/Scraper.php on lines 288..288

      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 24.

      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 4 locations. Consider refactoring.
      Open

                      $row['date']['open']->setTimeZone(new DateTimeZone($timezone));
      Severity: Major
      Found in lib/Jobs/Scraper.php and 3 other locations - About 40 mins to fix
      lib/Jobs/Scraper.php on lines 167..167
      lib/Jobs/Scraper.php on lines 288..288
      lib/Jobs/Scraper.php on lines 289..289

      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 24.

      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 4 locations. Consider refactoring.
      Open

                      $row['date']['close']->setTimeZone(new DateTimeZone($timezone));
      Severity: Major
      Found in lib/Jobs/Scraper.php and 3 other locations - About 40 mins to fix
      lib/Jobs/Scraper.php on lines 166..166
      lib/Jobs/Scraper.php on lines 288..288
      lib/Jobs/Scraper.php on lines 289..289

      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 24.

      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 4 locations. Consider refactoring.
      Open

                      $Job->duration = implode(", ", $job['type']);
      Severity: Major
      Found in lib/Jobs/Scraper.php and 3 other locations - About 40 mins to fix
      lib/Locos/Gauge.php on lines 146..146
      lib/Users/Utility/UrlUtility.php on lines 51..51
      lib/Users/Utility/UrlUtility.php on lines 52..52

      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 23.

      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 6 locations. Consider refactoring.
      Open

              if (is_string($provider)) {
                  $this->provider = $provider;
              }
      Severity: Major
      Found in lib/Jobs/Scraper.php and 5 other locations - About 30 mins to fix
      lib/GTFS/StandardRoute.php on lines 60..62
      lib/Jobs/Scraper.php on lines 73..75
      lib/News/Scraper.php on lines 70..72
      lib/News/Scraper.php on lines 74..76
      lib/Users/User.php on lines 1448..1450

      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 21.

      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 6 locations. Consider refactoring.
      Open

              if (is_string($url)) {
                  $this->feed = $url;
              }
      Severity: Major
      Found in lib/Jobs/Scraper.php and 5 other locations - About 30 mins to fix
      lib/GTFS/StandardRoute.php on lines 60..62
      lib/Jobs/Scraper.php on lines 77..79
      lib/News/Scraper.php on lines 70..72
      lib/News/Scraper.php on lines 74..76
      lib/Users/User.php on lines 1448..1450

      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 21.

      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 5 locations. Consider refactoring.
      Open

                      "url"         => array(
                          "view"  => $item->link,
                          "apply" => $job->applyLink
                      ),
      Severity: Major
      Found in lib/Jobs/Scraper.php and 4 other locations - About 30 mins to fix
      lib/Images/Image.php on lines 1013..1016
      lib/Jobs/Jobs.php on lines 210..213
      lib/Locos/Locomotive.php on lines 1415..1418
      lib/Sightings/Sighting.php on lines 187..190

      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 20.

      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 4 locations. Consider refactoring.
      Open

                      $location = explode("|", $item['extra']['location']);
      Severity: Major
      Found in lib/Jobs/Scraper.php and 3 other locations - About 30 mins to fix
      lib/Formatting/BbcodeEtc/Filters/ImageFilter.php on lines 61..61
      lib/GTFS/AU/VIC/PTV/PTV.php on lines 341..341
      lib/News/News.php on lines 149..149

      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 20.

      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 (strtolower(trim($job['title'])) != "test job") {
      Severity: Minor
      Found in lib/Jobs/Scraper.php and 1 other location - About 30 mins to fix
      lib/Locos/Locos.php on lines 1059..1059

      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 20.

      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

      The parameter $Organisation is not named in camelCase.
      Open

          public function __construct($url = false, $provider = "pageuppeople", Organisation $Organisation) {
      
              parent::__construct();
      
              $this->Module = new Module("jobs");
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpmd

      CamelCaseParameterName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name parameters.

      Example

      class ClassName {
          public function doSomething($user_name) {
          }
      }

      Source

      Blank line found at start of control structure
      Open

              foreach ($this->jobs as $job) {
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpcodesniffer

      Arguments with default values must be at the end of the argument list
      Open

          public function __construct($url = false, $provider = "pageuppeople", Organisation $Organisation) {
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpcodesniffer

      Closing parenthesis of a multi-line function call must be on a line by itself
      Open

                                  strtotime("+1 month")) : $item['extra']['closingDate'])
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpcodesniffer

      Multi-line function call not indented correctly; expected 24 spaces but found 28
      Open

                                  strtotime("+1 month")) : $item['extra']['closingDate'])
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpcodesniffer

      Opening parenthesis of a multi-line function call must be the last content on the line
      Open

                              "close" => new DateTime(empty( $item['extra']['closingDate'] ) ? sprintf("@%d",
      Severity: Minor
      Found in lib/Jobs/Scraper.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status