railpage/railpagecore

View on GitHub
lib/Events/EventDate.php

Summary

Maintainability
F
4 days
Test Coverage

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

class EventDate extends AppCore {
    
    /**
     * Event date status: running
     * @since Version 3.9.1
Severity: Minor
Found in lib/Events/EventDate.php by phpmd

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

    public function __construct($id = NULL) {
        parent::__construct(); 
        
        $this->Module = new Module("events");
        $this->namespace = $this->Module->namespace;
Severity: Minor
Found in lib/Events/EventDate.php - About 1 hr to fix

    Function __construct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($id = NULL) {
            parent::__construct(); 
            
            $this->Module = new Module("events");
            $this->namespace = $this->Module->namespace;
    Severity: Minor
    Found in lib/Events/EventDate.php - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function getArray() {
            $array = array(
                "id" => $this->id,
                "date" => array(
                    "absolute" => $this->Date->format("Y-m-d H:i:s"),
    Severity: Minor
    Found in lib/Events/EventDate.php - About 1 hr to fix

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

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

        Avoid too many return statements within this method.
        Open

                    return $this->Event->meta['address'];
        Severity: Major
        Found in lib/Events/EventDate.php - About 30 mins to fix

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

              public function getAddress() {
                  
                  if (!empty($this->meta['address'])) {
                      return $this->meta['address'];
                  }
          Severity: Minor
          Found in lib/Events/EventDate.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 __construct() has an NPath complexity of 3024. The configured NPath complexity threshold is 200.
          Open

              public function __construct($id = NULL) {
                  parent::__construct(); 
                  
                  $this->Module = new Module("events");
                  $this->namespace = $this->Module->namespace;
          Severity: Minor
          Found in lib/Events/EventDate.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 __construct() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
          Open

              public function __construct($id = NULL) {
                  parent::__construct(); 
                  
                  $this->Module = new Module("events");
                  $this->namespace = $this->Module->namespace;
          Severity: Minor
          Found in lib/Events/EventDate.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

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

              public function __construct($id = NULL) {
                  parent::__construct(); 
                  
                  $this->Module = new Module("events");
                  $this->namespace = $this->Module->namespace;
          Severity: Minor
          Found in lib/Events/EventDate.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 '356', column '17').
          Open

              public function getArray() {
                  $array = array(
                      "id" => $this->id,
                      "date" => array(
                          "absolute" => $this->Date->format("Y-m-d H:i:s"),
          Severity: Minor
          Found in lib/Events/EventDate.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

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

                  if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                      $where = array(
                          "id = ?" => $this->id
                      );
                      
          Severity: Major
          Found in lib/Events/EventDate.php and 3 other locations - About 2 hrs to fix
          lib/Events/EventCategory.php on lines 155..163
          lib/Forums/Thread.php on lines 346..353
          lib/Railcams/Camera.php on lines 401..410

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

          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/EventDate.php and 1 other location - About 1 hr to fix
          lib/Events/Event.php on lines 553..560

          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 ($row['start'] != "00:00:00") {
                      $this->Start = new DateTime($row['date'] . " " . $row['start']);
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 1 other location - About 1 hr to fix
          lib/Events/EventDate.php on lines 169..171

          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 ($row['end'] != "00:00:00") {
                      $this->End = new DateTime($row['date'] . " " . $row['end']);
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 1 other location - About 1 hr to fix
          lib/Events/EventDate.php on lines 165..167

          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 ($this->Start instanceof DateTime) {
                              $this->Start->setTimezone(new DateTimeZone($this->Event->Place->Region->timezone));
                          }
          Severity: Major
          Found in lib/Events/EventDate.php and 1 other location - About 1 hr to fix
          lib/Events/EventDate.php on lines 193..195

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

          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 ($this->End instanceof DateTime) {
                              $this->End->setTimezone(new DateTimeZone($this->Event->Place->Region->timezone));
                          }
          Severity: Major
          Found in lib/Events/EventDate.php and 1 other location - About 1 hr to fix
          lib/Events/EventDate.php on lines 189..191

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

          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/EventDate.php and 2 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 507..511
          lib/Events/Event.php on lines 516..520

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

                  if (!filter_var($this->status, FILTER_VALIDATE_INT)) {
                      $this->status = Events::STATUS_UNAPPROVED;
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 6 other locations - About 1 hr to fix
          lib/Forums/Forum.php on lines 286..288
          lib/Ideas/Idea.php on lines 264..266
          lib/Locations/Correction.php on lines 180..182
          lib/Notifications/Notification.php on lines 179..181
          lib/Notifications/Notification.php on lines 183..185
          lib/Users/Group.php on lines 384..386

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

          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['lon']) && empty($this->meta['lon'])) {
                      unset($this->meta['lon']);
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 1 other location - About 1 hr to fix
          lib/Events/EventDate.php on lines 173..175

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

          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['lat']) && empty($this->meta['lat'])) {
                      unset($this->meta['lat']);
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 1 other location - About 1 hr to fix
          lib/Events/EventDate.php on lines 177..179

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

          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/EventDate.php and 2 other locations - About 1 hr to fix
          lib/Events/Event.php on lines 502..505
          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 4 locations. Consider refactoring.
          Open

                  if ($this->End instanceof DateTime) {
                      $data['end'] = $this->End->format("H:i:s");
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 3 other locations - About 1 hr to fix
          lib/Events/EventDate.php on lines 253..255
          lib/Locations/Correction.php on lines 206..208
          lib/Users/User.php on lines 1264..1266

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

          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

                  if ($this->Start instanceof DateTime) {
                      $data['start'] = $this->Start->format("H:i:s");
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 3 other locations - About 1 hr to fix
          lib/Events/EventDate.php on lines 257..259
          lib/Locations/Correction.php on lines 206..208
          lib/Users/User.php on lines 1264..1266

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

          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

                  $this->url->approve = sprintf("/events?mode=event.date.setstatus&date_id=%d&status=%d", $this->id, self::STATUS_RUNNING);
          Severity: Major
          Found in lib/Events/EventDate.php and 2 other locations - About 55 mins to fix
          lib/Events/EventDate.php on lines 159..159
          lib/Events/EventDate.php on lines 160..160

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

                  $this->url->reject = sprintf("/events?mode=event.date.setstatus&date_id=%d&status=%d", $this->id, self::STATUS_REJECTED);
          Severity: Major
          Found in lib/Events/EventDate.php and 2 other locations - About 55 mins to fix
          lib/Events/EventDate.php on lines 158..158
          lib/Events/EventDate.php on lines 160..160

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

                  $this->url->cancel = sprintf("/events?mode=event.date.setstatus&date_id=%d&status=%d", $this->id, self::STATUS_CANCELLED);
          Severity: Major
          Found in lib/Events/EventDate.php and 2 other locations - About 55 mins to fix
          lib/Events/EventDate.php on lines 158..158
          lib/Events/EventDate.php on lines 159..159

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

                  $this->meta = json_decode($row['meta'], true);
          Severity: Major
          Found in lib/Events/EventDate.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/Event.php on lines 207..207
          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 2 locations. Consider refactoring.
          Open

                      "start" => $this->Start instanceof DateTime ? $this->Start->format("g:i a") : 0,
          Severity: Minor
          Found in lib/Events/EventDate.php and 1 other location - About 45 mins to fix
          lib/Events/EventDate.php on lines 329..329

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

                      "end" => $this->End instanceof DateTime ? $this->End->format("g:i a") : 0,
          Severity: Minor
          Found in lib/Events/EventDate.php and 1 other location - About 45 mins to fix
          lib/Events/EventDate.php on lines 328..328

          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

                  if (!empty($this->meta['address'])) {
                      return $this->meta['address'];
                  }
          Severity: Minor
          Found in lib/Events/EventDate.php and 1 other location - About 40 mins to fix
          lib/Events/Event.php on lines 545..547

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

                  $this->url->export = sprintf("/events/export/date/%d.ics", $this->id); 
          Severity: Major
          Found in lib/Events/EventDate.php and 30 other locations - About 40 mins to fix
          lib/Content/Page.php on lines 155..155
          lib/Feedback/FeedbackItem.php on lines 147..147
          lib/Feedback/FeedbackItem.php on lines 148..148
          lib/Feedback/FeedbackItem.php on lines 154..154
          lib/Feedback/FeedbackItem.php on lines 155..155
          lib/Forums/Post.php on lines 749..749
          lib/Forums/Post.php on lines 750..750
          lib/Forums/Post.php on lines 751..751
          lib/Forums/Post.php on lines 752..752
          lib/Forums/Post.php on lines 753..753
          lib/Forums/Post.php on lines 754..754
          lib/Forums/Post.php on lines 755..755
          lib/Forums/Post.php on lines 756..756
          lib/Ideas/Idea.php on lines 207..207
          lib/Images/Camera.php on lines 131..131
          lib/Images/Competition.php on lines 431..431
          lib/Locos/Operator.php on lines 114..114
          lib/Locos/Operator.php on lines 115..115
          lib/News/Article.php on lines 481..481
          lib/News/Article.php on lines 482..482
          lib/News/Article.php on lines 483..483
          lib/News/Article.php on lines 484..484
          lib/News/Article.php on lines 485..485
          lib/Newsletters/Newsletter.php on lines 267..267
          lib/Newsletters/Newsletter.php on lines 268..268
          lib/Newsletters/Newsletter.php on lines 269..269
          lib/Newsletters/Newsletter.php on lines 270..270
          lib/Reminders/Reminder.php on lines 165..165
          lib/SiteMessages/SiteMessage.php on lines 193..193
          lib/SiteMessages/SiteMessage.php on lines 194..194

          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

                      case self::STATUS_REJECTED :
                          $this->status = $status;
                          $this->commit(); 
                          
                          break;
          Severity: Minor
          Found in lib/Events/EventDate.php and 1 other location - About 40 mins to fix
          lib/Events/EventDate.php on lines 384..390

          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

                      case self::STATUS_CANCELLED :
                          $this->status = $status;
                          $this->commit(); 
                          
                          // DO something else in the future
          Severity: Minor
          Found in lib/Events/EventDate.php and 1 other location - About 40 mins to fix
          lib/Events/EventDate.php on lines 378..382

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

                  if (is_null($status)) {
                      throw new Exception("No status flag was specified");
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 20 other locations - About 35 mins to fix
          lib/Images/Image.php on lines 963..965
          lib/Images/Image.php on lines 1095..1097
          lib/Images/Images.php on lines 96..98
          lib/Images/Images.php on lines 137..139
          lib/Locations/Region.php on lines 93..95
          lib/Locos/Locos.php on lines 590..592
          lib/Locos/Locos.php on lines 901..903
          lib/Locos/Locos.php on lines 925..927
          lib/Railcams/Storage/LocalFS.php on lines 127..129
          lib/Users/User.php on lines 2572..2574
          lib/Users/User.php on lines 2576..2578
          lib/Users/User.php on lines 2584..2586
          lib/Users/Utility/PasswordUtility.php on lines 70..72
          lib/Users/Utility/PasswordUtility.php on lines 74..76
          lib/Users/Utility/PasswordUtility.php on lines 78..80
          lib/API.php on lines 124..126
          lib/API.php on lines 194..196
          lib/BanControl/BanControl.php on lines 243..245
          lib/BanControl/BanControl.php on lines 354..356
          lib/BanControl/BanControl.php on lines 358..360

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

                  if (!filter_var($id, FILTER_VALIDATE_INT)) {
                      return;
                  }
          Severity: Major
          Found in lib/Events/EventDate.php and 8 other locations - About 30 mins to fix
          lib/Chronicle/Entry.php on lines 140..142
          lib/Chronicle/EntryType.php on lines 80..82
          lib/Feedback/FeedbackItem.php on lines 120..122
          lib/GTFS/StandardRoute.php on lines 68..70
          lib/GTFS/StandardStop.php on lines 97..99
          lib/Ideas/Ideas.php on lines 185..187
          lib/Images/Camera.php on lines 98..100
          lib/Users/Group.php on lines 127..129

          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/EventDate.php and 8 other locations - About 30 mins to fix
          lib/Events/Event.php on lines 215..215
          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

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

                      $data['meta'] = json_encode($this->meta);
          Severity: Minor
          Found in lib/Events/EventDate.php and 1 other location - About 30 mins to fix
          lib/Railcams/Photo.php on lines 366..366

          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

          Blank line found at end of control structure
          Open

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

          Blank line found at start of control structure
          Open

                  if ($this->Place instanceof Place) {
          Severity: Minor
          Found in lib/Events/EventDate.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/EventDate.php by phpcodesniffer

          Blank line found at start of control structure
          Open

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

          Blank line found at end of control structure
          Open

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

          Blank line found at end of control structure
          Open

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

          There are no issues that match your filters.

          Category
          Status