railpage/railpagecore

View on GitHub
lib/Events/Event.php

Summary

Maintainability
F
5 days
Test Coverage

The class Event has an overall complexity of 62 which is very high. The configured complexity threshold is 50.
Open

class Event extends AppCore {
    
    /**
     * Registry key
     * @since Version 3.9.1
Severity: Minor
Found in lib/Events/Event.php by phpmd

File Event.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Railpage Events module
 * @since Version 3.8.7
Severity: Minor
Found in lib/Events/Event.php - About 3 hrs to fix

    Method commit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function commit() {
            $this->validate(); 
            
            $data = array(
                "title" => $this->title,
    Severity: Minor
    Found in lib/Events/Event.php - About 1 hr to fix

      Method getArray has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getArray() {
              $array = array(
                  "id" => $this->id,
                  "title" => $this->title,
                  "description" => $this->desc,
      Severity: Minor
      Found in lib/Events/Event.php - About 1 hr to fix

        Method populate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function populate($id) {
                
                $row = $this->load($id); 
                
                if (!isset($row) || !is_array($row)) {
        Severity: Minor
        Found in lib/Events/Event.php - About 1 hr to fix

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

              private function populate($id) {
                  
                  $row = $this->load($id); 
                  
                  if (!isset($row) || !is_array($row)) {
          Severity: Minor
          Found in lib/Events/Event.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              private function validate() {
                  if (empty($this->title)) {
                      throw new Exception("Validation failed for event. Title cannot be empty");
                  }
                  
          Severity: Minor
          Found in lib/Events/Event.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

          The method populate() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
          Open

              private function populate($id) {
                  
                  $row = $this->load($id); 
                  
                  if (!isset($row) || !is_array($row)) {
          Severity: Minor
          Found in lib/Events/Event.php by phpmd

          NPathComplexity

          Since: 0.1

          The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

          Example

          class Foo {
              function bar() {
                  // lots of complicated code
              }
          }

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

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

              private function populate($id) {
                  
                  $row = $this->load($id); 
                  
                  if (!isset($row) || !is_array($row)) {
          Severity: Minor
          Found in lib/Events/Event.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 Event has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13.
          Open

          class Event extends AppCore {
              
              /**
               * Registry key
               * @since Version 3.9.1
          Severity: Minor
          Found in lib/Events/Event.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

          Avoid assigning values to variables in if clauses and the like (line '171', column '14').
          Open

              private function load($id) {
                  
                  if (!filter_var($id, FILTER_VALIDATE_INT)) {
                      $id = $this->db->fetchOne("SELECT id FROM event WHERE slug = ?", $id); 
                  }
          Severity: Minor
          Found in lib/Events/Event.php by phpmd

          IfStatementAssignment

          Since: 2.7.0

          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($foo = 'bar') { // possible typo
                      // ...
                  }
                  if ($baz = 0) { // always false
                      // ...
                  }
              }
          }

          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

          Avoid assigning values to variables in if clauses and the like (line '576', column '13').
          Open

              public function getCoverPhoto() {
                  
                  if (!isset($this->meta['coverphoto']) || empty($this->meta['coverphoto'])) {
                      return false;
                  }
          Severity: Minor
          Found in lib/Events/Event.php by phpmd

          IfStatementAssignment

          Since: 2.7.0

          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($foo = 'bar') { // possible typo
                      // ...
                  }
                  if ($baz = 0) { // always false
                      // ...
                  }
              }
          }

          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

          Avoid assigning values to variables in if clauses and the like (line '179', column '14').
          Open

              private function load($id) {
                  
                  if (!filter_var($id, FILTER_VALIDATE_INT)) {
                      $id = $this->db->fetchOne("SELECT id FROM event WHERE slug = ?", $id); 
                  }
          Severity: Minor
          Found in lib/Events/Event.php by phpmd

          IfStatementAssignment

          Since: 2.7.0

          Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

          Example

          class Foo
          {
              public function bar($flag)
              {
                  if ($foo = 'bar') { // possible typo
                      // ...
                  }
                  if ($baz = 0) { // always false
                      // ...
                  }
              }
          }

          Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                  if (RP_DEBUG) {
                      $site_debug[] = __CLASS__ . "::" . __METHOD__ . " completed in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                  }
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 2 hrs to fix
          lib/Events/Event.php on lines 392..394
          lib/Forums/Thread.php on lines 266..268

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

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

                  if (RP_DEBUG) {
                      $site_debug[] = __CLASS__ . "::" . __METHOD__ . " completed in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                  }
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 2 hrs to fix
          lib/Events/Event.php on lines 365..367
          lib/Forums/Thread.php on lines 266..268

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

          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 ($this->Place instanceof Place) {
                      
                      $this->meta['address'] = $this->Place->getAddress(); 
                      $this->commit(); 
                      
          Severity: Major
          Found in lib/Events/Event.php and 1 other location - About 1 hr to fix
          lib/Events/EventDate.php on lines 417..424

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

          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 (isset($this->meta['website']) && !empty($this->meta['website'])) {
                      $this->url->website = $this->meta['website'];
                  }
          Severity: Major
          Found in lib/Events/Event.php and 1 other location - About 1 hr to fix
          lib/Events/Event.php on lines 486..488

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

          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 (isset($this->meta['tickets']) && !empty($this->meta['tickets'])) {
                      $this->url->tickets = $this->meta['tickets'];
                  }
          Severity: Major
          Found in lib/Events/Event.php and 1 other location - About 1 hr to fix
          lib/Events/Event.php on lines 482..484

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

          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 ($this->Place instanceof Place) {
                      $data['lat'] = $this->Place->lat;
                      $data['lon'] = $this->Place->lon;
                  }
          Severity: Major
          Found in lib/Events/Event.php and 1 other location - About 1 hr to fix
          lib/Images/Image.php on lines 486..489

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

          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 (filter_var($row['category_id'], FILTER_VALIDATE_INT)) {
                      $this->Category = Factory::CreateEventCategory($row['category_id']);
                  }
          Severity: Major
          Found in lib/Events/Event.php and 1 other location - About 1 hr to fix
          lib/Events/Event.php on lines 223..225

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

          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 (filter_var($row['organisation_id'], FILTER_VALIDATE_INT)) {
                      $this->Organisation = OrganisationsFactory::CreateOrganisation($row['organisation_id']);
                  }
          Severity: Major
          Found in lib/Events/Event.php and 1 other location - About 1 hr to fix
          lib/Events/Event.php on lines 219..221

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

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

                      "category" => array(
                          "id" => $this->Category->id,
                          "name" => $this->Category->name,
                          "url" => $this->Category->url->getURLs()
                      ),
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 516..520
          lib/Events/EventDate.php on lines 340..344

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

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

                      "author" => array(
                          "id" => $this->Author->id,
                          "username" => $this->Author->username,
                          "url" => $this->Author->url->getURLs()
                      )
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 507..511
          lib/Events/EventDate.php on lines 340..344

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

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

                  $this->url = new Url(sprintf("%s/%s", $this->Module->url, $this->slug));
          Severity: Major
          Found in lib/Events/Event.php and 11 other locations - About 1 hr to fix
          lib/Events/EventCategory.php on lines 232..232
          lib/Gallery/Image.php on lines 207..207
          lib/Glossary/Entry.php on lines 227..227
          lib/Ideas/Idea.php on lines 186..186
          lib/Jobs/Job.php on lines 195..195
          lib/Jobs/Job.php on lines 315..315
          lib/Locations/Region.php on lines 149..149
          lib/Locos/Type.php on lines 106..106
          lib/Locos/Type.php on lines 133..133
          lib/News/Topic.php on lines 147..147
          lib/Timetables/Point.php on lines 114..114

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

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

                      "status" => array(
                          "id" => $this->status,
                          "name" => $this->status == Events::STATUS_APPROVED ? "Approved" : "Unapproved"
                      ),
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 1 hr to fix
          lib/Events/EventDate.php on lines 330..333
          lib/Newsletters/Newsletter.php on lines 239..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 33.

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

                  if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                      throw new Exception("Cannot reject event - no event ID specified");
                  }
          Severity: Major
          Found in lib/Events/Event.php and 24 other locations - About 1 hr to fix
          lib/Downloads/Download.php on lines 313..315
          lib/Events/Events.php on lines 130..132
          lib/Images/Competition.php on lines 624..626
          lib/Images/Competition.php on lines 654..656
          lib/Images/Competition.php on lines 823..825
          lib/Images/Competition.php on lines 860..862
          lib/Images/Favourites.php on lines 112..114
          lib/Images/Favourites.php on lines 178..180
          lib/Jobs/Classification.php on lines 80..82
          lib/Locations/Location.php on lines 406..408
          lib/Locations/Location.php on lines 410..412
          lib/Locos/Locomotive.php on lines 622..624
          lib/Locos/Locomotive.php on lines 626..628
          lib/Locos/Locomotive.php on lines 897..899
          lib/News/Article.php on lines 361..363
          lib/News/Article.php on lines 834..836
          lib/Newsletters/Newsletters.php on lines 135..137
          lib/PrivateMessages/Message.php on lines 244..246
          lib/PrivateMessages/Message.php on lines 452..454
          lib/Railcams/Photo.php on lines 330..332
          lib/Railcams/Storage.php on lines 224..226
          lib/Sightings/Sighting.php on lines 133..135
          lib/Users/Group.php on lines 236..238
          lib/Warnings/Warning.php on lines 209..211

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

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

                  if ($dateTo instanceof DateTime) {
                      $query .= " AND date <= ?";
                      $params[] = $dateTo->format("Y-m-d");
                  }
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 353..356
          lib/Events/EventCategory.php on lines 189..192

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

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

                  if ($dateFrom instanceof DateTime) {
                      $query .= " AND date >= ?";
                      $params[] = $dateFrom->format("Y-m-d");
                  }
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 358..361
          lib/Events/EventCategory.php on lines 189..192

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

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

                  $this->url->approve = sprintf("%s?mode=event.approve&event_id=%d", $this->Module->url, $this->id);
          Severity: Major
          Found in lib/Events/Event.php and 13 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 476..476
          lib/Events/Event.php on lines 477..477
          lib/Gallery/Album.php on lines 143..143
          lib/Glossary/Entry.php on lines 233..233
          lib/Glossary/Entry.php on lines 234..234
          lib/Glossary/Entry.php on lines 235..235
          lib/Ideas/Idea.php on lines 202..202
          lib/Ideas/Idea.php on lines 203..203
          lib/Ideas/Idea.php on lines 204..204
          lib/Locos/LocoClass.php on lines 649..649
          lib/Locos/LocoClass.php on lines 650..650
          lib/Locos/Locomotive.php on lines 431..431
          lib/Railcams/Photo.php on lines 166..166

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

                  $this->url->delete = sprintf("%s?mode=event.reject&event_id=%d", $this->Module->url, $this->id);
          Severity: Major
          Found in lib/Events/Event.php and 13 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 476..476
          lib/Events/Event.php on lines 479..479
          lib/Gallery/Album.php on lines 143..143
          lib/Glossary/Entry.php on lines 233..233
          lib/Glossary/Entry.php on lines 234..234
          lib/Glossary/Entry.php on lines 235..235
          lib/Ideas/Idea.php on lines 202..202
          lib/Ideas/Idea.php on lines 203..203
          lib/Ideas/Idea.php on lines 204..204
          lib/Locos/LocoClass.php on lines 649..649
          lib/Locos/LocoClass.php on lines 650..650
          lib/Locos/Locomotive.php on lines 431..431
          lib/Railcams/Photo.php on lines 166..166

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

                  $this->url->edit = sprintf("%s?mode=event.edit&event_id=%d", $this->Module->url, $this->id);
          Severity: Major
          Found in lib/Events/Event.php and 13 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 477..477
          lib/Events/Event.php on lines 479..479
          lib/Gallery/Album.php on lines 143..143
          lib/Glossary/Entry.php on lines 233..233
          lib/Glossary/Entry.php on lines 234..234
          lib/Glossary/Entry.php on lines 235..235
          lib/Ideas/Idea.php on lines 202..202
          lib/Ideas/Idea.php on lines 203..203
          lib/Ideas/Idea.php on lines 204..204
          lib/Locos/LocoClass.php on lines 649..649
          lib/Locos/LocoClass.php on lines 650..650
          lib/Locos/Locomotive.php on lines 431..431
          lib/Railcams/Photo.php on lines 166..166

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

                  $proposal = substr(create_slug($this->title), 0, 32);
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 55 mins to fix
          lib/Forums/Thread.php on lines 622..622

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

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

                  if (RP_DEBUG) {
                      global $site_debug;
                      $debug_timer_start = microtime(true);
                  }
          Severity: Major
          Found in lib/Events/Event.php and 11 other locations - About 55 mins to fix
          lib/Events/Event.php on lines 341..344
          lib/Forums/Post.php on lines 434..437
          lib/Forums/Thread.php on lines 209..212
          lib/Images/Image.php on lines 611..614
          lib/Links/Links.php on lines 278..281
          lib/News/Article.php on lines 365..368
          lib/News/Base.php on lines 310..313
          lib/PrivateMessages/Folder.php on lines 86..89
          lib/API.php on lines 128..131
          lib/API.php on lines 260..263
          lib/Template.php on lines 332..335

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

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

                  if (RP_DEBUG) {
                      global $site_debug;
                      $debug_timer_start = microtime(true);
                  }
          Severity: Major
          Found in lib/Events/Event.php and 11 other locations - About 55 mins to fix
          lib/Events/Event.php on lines 381..384
          lib/Forums/Post.php on lines 434..437
          lib/Forums/Thread.php on lines 209..212
          lib/Images/Image.php on lines 611..614
          lib/Links/Links.php on lines 278..281
          lib/News/Article.php on lines 365..368
          lib/News/Base.php on lines 310..313
          lib/PrivateMessages/Folder.php on lines 86..89
          lib/API.php on lines 128..131
          lib/API.php on lines 260..263
          lib/Template.php on lines 332..335

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

          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

                  if (!filter_var($this->status)) {
                      $this->status = Events::STATUS_UNAPPROVED;
                  }
          Severity: Major
          Found in lib/Events/Event.php and 4 other locations - About 55 mins to fix
          lib/Locations/Location.php on lines 444..446
          lib/Locos/Correction.php on lines 187..189
          lib/News/Article.php on lines 782..784
          lib/Newsletters/Newsletter.php on lines 155..157

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

          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

                  $this->status = isset($row['status']) ? $row['status'] : Events::STATUS_APPROVED;
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 55 mins to fix
          lib/Glossary/Entry.php on lines 168..168

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

          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 (!empty($row['lat']) && round($row['lat'], 3) != "0.000" && !empty($row['lon']) && round($row['lon'], 3) != "0.000") {
                      $this->Place = Place::Factory($row['lat'], $row['lon']);
                  }
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 55 mins to fix
          lib/Images/Image.php on lines 397..401

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

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

                  if ($this->Organisation instanceof Organisation) {
                      $data['organisation_id'] = $this->Organisation->id;
                  }
          Severity: Major
          Found in lib/Events/Event.php and 2 other locations - About 50 mins to fix
          lib/Locos/LocoClass.php on lines 616..618
          lib/Timetables/Train.php on lines 230..232

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

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

                  $this->meta = json_decode($row['meta'], true);
          Severity: Major
          Found in lib/Events/Event.php and 22 other locations - About 45 mins to fix
          lib/Assets/Asset.php on lines 150..150
          lib/Chronicle/Entry.php on lines 156..156
          lib/Events/EventDate.php on lines 154..154
          lib/Gallery/Album.php on lines 136..136
          lib/Gallery/Image.php on lines 208..208
          lib/Ideas/Idea.php on lines 166..166
          lib/Images/Camera.php on lines 116..116
          lib/Images/Competition.php on lines 180..180
          lib/Images/Competition.php on lines 790..790
          lib/Locos/Date.php on lines 158..158
          lib/Locos/LocoClass.php on lines 417..417
          lib/News/Feed.php on lines 234..234
          lib/News/Feed.php on lines 235..235
          lib/Newsletters/Newsletter.php on lines 128..128
          lib/Newsletters/Newsletter.php on lines 129..129
          lib/Railcams/Storage.php on lines 201..201
          lib/Sightings/Sighting.php on lines 161..161
          lib/Sightings/Sighting.php on lines 162..162
          lib/Timetables/Train.php on lines 174..174
          lib/Users/Group.php on lines 168..168
          lib/Users/User.php on lines 1068..1068
          lib/SiteEvent.php on lines 135..135

          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

                      $this->Redis->delete(sprintf(self::CACHE_KEY, $this->id)); 
          Severity: Major
          Found in lib/Events/Event.php and 7 other locations - About 45 mins to fix
          lib/Forums/Post.php on lines 452..452
          lib/Forums/Post.php on lines 453..453
          lib/Locos/LocoClass.php on lines 1074..1074
          lib/Locos/LocoClass.php on lines 1075..1075
          lib/Locos/Locomotive.php on lines 694..694
          lib/News/Article.php on lines 670..670
          lib/News/Article.php on lines 671..671

          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

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

              public function approve() {
                  $this->status = Events::STATUS_APPROVED;
                  $this->commit(); 
                  
                  return $this;
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 45 mins to fix
          lib/Glossary/Entry.php on lines 363..368

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

          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 (!empty($this->meta['address'])) {
                      return $this->meta['address'];
                  }
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 40 mins to fix
          lib/Events/EventDate.php on lines 405..407

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

                  if (!isset($row['user_id'])) {
                      $row['user_id'] = 45;
                  }
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 40 mins to fix
          lib/Images/Image.php on lines 351..353

          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

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

                  if (!isset($row) || !is_array($row)) {
                      return;
                  }
          Severity: Major
          Found in lib/Events/Event.php and 3 other locations - About 40 mins to fix
          lib/Glossary/Entry.php on lines 160..162
          lib/Locos/LocoClass.php on lines 360..362
          lib/fwlink.php on lines 116..118

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

                  if (!isset($this->meta['coverphoto']) || empty($this->meta['coverphoto'])) {
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 40 mins to fix
          lib/Users/User.php on lines 2896..2896

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

                  if (!$dateObject instanceof DateTime) {
                      throw new Exception("Cannot find dates for this event - no DateTime object given");
                  }
          Severity: Major
          Found in lib/Events/Event.php and 9 other locations - About 35 mins to fix
          lib/Chronicle/Provider/Locos.php on lines 45..47
          lib/Chronicle/Provider/Locos.php on lines 49..51
          lib/Chronicle/Provider/Railcams.php on lines 49..51
          lib/Chronicle/Provider/Railcams.php on lines 53..55
          lib/Locos/Locos.php on lines 769..771
          lib/Locos/Locos.php on lines 772..774
          lib/Notifications/Notification.php on lines 304..306
          lib/Railcams/Footage.php on lines 139..141
          lib/Users/Group.php on lines 352..354

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

          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 (isset($this->mckey)) {
                          $this->Memcached->delete($this->mckey);
                      }
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 35 mins to fix
          lib/Timetables/Train.php on lines 216..218

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

          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

                      $array['place'] = array(
                          "lat" => $this->Place->lat,
                          "lon" => $this->Place->lon
                      );
          Severity: Minor
          Found in lib/Events/Event.php and 1 other location - About 30 mins to fix
          lib/Images/Provider/Flickr.php on lines 150..153

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

                  $this->setAuthor(UserFactory::CreateUser($row['user_id']));
          Severity: Major
          Found in lib/Events/Event.php and 8 other locations - About 30 mins to fix
          lib/Events/EventDate.php on lines 163..163
          lib/Glossary/Entry.php on lines 170..170
          lib/Ideas/Idea.php on lines 172..172
          lib/Images/Collection.php on lines 137..137
          lib/Images/Competition.php on lines 203..203
          lib/Locations/Correction.php on lines 144..144
          lib/PrivateMessages/Message.php on lines 289..289
          lib/PrivateMessages/Message.php on lines 290..290

          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

          Function closing brace must go on the next line following the body; found 1 blank lines before brace
          Open

              }
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Blank line found at start of control structure
          Open

                  if ($this->Place instanceof Place) {
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Blank line found at end of control structure
          Open

                      
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Function closing brace must go on the next line following the body; found 1 blank lines before brace
          Open

              }
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Function closing brace must go on the next line following the body; found 1 blank lines before brace
          Open

              }
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Function closing brace must go on the next line following the body; found 1 blank lines before brace
          Open

              }
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Function closing brace must go on the next line following the body; found 1 blank lines before brace
          Open

              }
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Blank line found at end of control structure
          Open

                      
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          Function closing brace must go on the next line following the body; found 1 blank lines before brace
          Open

              }
          Severity: Minor
          Found in lib/Events/Event.php by phpcodesniffer

          There are no issues that match your filters.

          Category
          Status