railpage/railpagecore

View on GitHub
lib/Glossary/Entry.php

Summary

Maintainability
D
2 days
Test Coverage

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

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

    Method validate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function validate() {
            if (empty($this->name)) {
                throw new Exception("Entry name cannot be empty");
            }
            
    Severity: Minor
    Found in lib/Glossary/Entry.php - About 1 hr to fix

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

          private function validate() {
              if (empty($this->name)) {
                  throw new Exception("Entry name cannot be empty");
              }
              
      Severity: Minor
      Found in lib/Glossary/Entry.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

      The method validate() has an NPath complexity of 768. The configured NPath complexity threshold is 200.
      Open

          private function validate() {
              if (empty($this->name)) {
                  throw new Exception("Entry name cannot be empty");
              }
              
      Severity: Minor
      Found in lib/Glossary/Entry.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 validate() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
      Open

          private function validate() {
              if (empty($this->name)) {
                  throw new Exception("Entry name cannot be empty");
              }
              
      Severity: Minor
      Found in lib/Glossary/Entry.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 '152', column '14').
      Open

          private function populate() {
                  
              if (!$row = $this->Memcached->fetch($this->mckey)) {
                  $query = "SELECT * FROM glossary WHERE id = ?";
                  
      Severity: Minor
      Found in lib/Glossary/Entry.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 5 locations. Consider refactoring.
      Open

              if (!$row = $this->Memcached->fetch($this->mckey)) {
                  $query = "SELECT * FROM glossary WHERE id = ?";
                  
                  $row = $this->db->fetchRow($query, $this->id);
                  
      Severity: Major
      Found in lib/Glossary/Entry.php and 4 other locations - About 2 hrs to fix
      lib/News/Article.php on lines 375..384
      lib/Organisations/Organisation.php on lines 215..220
      lib/PrivateMessages/Message.php on lines 250..261
      lib/Timetables/Train.php on lines 164..169

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 64.

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

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

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

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

      Refactorings

      Further Reading

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

              if (!empty($this->slug)) {
                  $this->url = new Url(sprintf("%s/%s/%s", $this->Module->url, $this->Type->id, $this->slug)); 
              }
      Severity: Major
      Found in lib/Glossary/Entry.php and 1 other location - About 1 hr to fix
      lib/Help/Item.php on lines 231..235

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

      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 (empty($this->status) || !filter_var($this->status, FILTER_VALIDATE_INT)) {
                  $this->status = self::STATUS_UNAPPROVED;
              }
      Severity: Major
      Found in lib/Glossary/Entry.php and 2 other locations - About 1 hr to fix
      lib/Images/Competition.php on lines 237..239
      lib/SiteMessages/SiteMessage.php on lines 134..136

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

              $this->url = new Url(sprintf("%s?mode=entry&id=%d", $this->Module->url, $this->id));
      Severity: Major
      Found in lib/Glossary/Entry.php and 11 other locations - About 1 hr to fix
      lib/Events/Event.php on lines 475..475
      lib/Events/EventCategory.php on lines 232..232
      lib/Gallery/Image.php on lines 207..207
      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 14 locations. Consider refactoring.
      Open

              $this->url->publish = sprintf("%s?mode=entry.publish&id=%d", $this->Module->url, $this->id);
      Severity: Major
      Found in lib/Glossary/Entry.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/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 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=add&id=%d", $this->Module->url, $this->id);
      Severity: Major
      Found in lib/Glossary/Entry.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/Events/Event.php on lines 479..479
      lib/Gallery/Album.php on lines 143..143
      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->reject = sprintf("%s?mode=entry.reject&id=%d", $this->Module->url, $this->id);
      Severity: Major
      Found in lib/Glossary/Entry.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/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/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

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

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

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

              if (!$this->Date instanceof DateTime) {
                  $this->Date = new DateTime;
              }
      Severity: Major
      Found in lib/Glossary/Entry.php and 13 other locations - About 50 mins to fix
      lib/Content/Page.php on lines 172..174
      lib/Downloads/Download.php on lines 285..287
      lib/Gallery/Image.php on lines 177..179
      lib/Gallery/Image.php on lines 326..328
      lib/Ideas/Idea.php on lines 252..254
      lib/Images/Collection.php on lines 192..194
      lib/Locations/Correction.php on lines 172..174
      lib/Locos/Correction.php on lines 183..185
      lib/News/Article.php on lines 778..780
      lib/Notifications/Notification.php on lines 187..189
      lib/Railcams/Camera.php on lines 363..365
      lib/Railcams/Footage.php on lines 143..145
      lib/Warnings/Warning.php on lines 227..229

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

              if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                  $this->commit(); 
              }
      Severity: Major
      Found in lib/Glossary/Entry.php and 4 other locations - About 45 mins to fix
      lib/Locations/Location.php on lines 296..298
      lib/Locos/Locomotive.php on lines 347..349
      lib/Users/User.php on lines 984..986
      lib/Users/User.php on lines 2368..2370

      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 = self::STATUS_APPROVED;
              $this->commit(); 
              
              return $this;
      Severity: Minor
      Found in lib/Glossary/Entry.php and 1 other location - About 45 mins to fix
      lib/Events/Event.php on lines 411..416

      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

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

              if (is_null($this->example)) {
                  $this->example = "";
              }
      Severity: Major
      Found in lib/Glossary/Entry.php and 11 other locations - About 40 mins to fix
      lib/Downloads/Download.php on lines 293..295
      lib/Feedback/FeedbackItem.php on lines 180..182
      lib/Forums/Post.php on lines 351..353
      lib/Locos/Date.php on lines 266..268
      lib/Locos/WheelArrangement.php on lines 170..172
      lib/News/Article.php on lines 766..768
      lib/News/Article.php on lines 770..772
      lib/News/Article.php on lines 786..788
      lib/PrivateMessages/Message.php on lines 302..304
      lib/Sightings/Sighting.php on lines 239..241
      lib/Sightings/Sighting.php on lines 243..245

      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

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

              if (!isset($row) || !is_array($row)) {
                  return;
              }
      Severity: Major
      Found in lib/Glossary/Entry.php and 3 other locations - About 40 mins to fix
      lib/Events/Event.php on lines 201..203
      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 25 locations. Consider refactoring.
      Open

          public function setAuthor(User $userObject) {
              $this->Author = $userObject;
              
              return $this;
          }
      Severity: Major
      Found in lib/Glossary/Entry.php and 24 other locations - About 40 mins to fix
      lib/Feedback/Feedback.php on lines 52..56
      lib/Gallery/Album.php on lines 279..285
      lib/Gallery/Album.php on lines 317..323
      lib/Gallery/Image.php on lines 278..284
      lib/Gallery/Image.php on lines 460..466
      lib/Locations/Correction.php on lines 118..124
      lib/News/Article.php on lines 941..945
      lib/Prerender/Prerender.php on lines 89..94
      lib/Railcams/Footage.php on lines 89..95
      lib/Railcams/Photo.php on lines 143..147
      lib/Railcams/Storage.php on lines 95..101
      lib/Railcams/Storage.php on lines 110..116
      lib/SiteMessages/SiteMessage.php on lines 206..210
      lib/Timetables/Timetables.php on lines 52..56
      lib/Timetables/Timetables.php on lines 64..68
      lib/Timetables/Timetables.php on lines 76..80
      lib/Users/SockpuppetManager.php on lines 61..67
      lib/Warnings/Warning.php on lines 249..255
      lib/Warnings/Warning.php on lines 267..273
      lib/AppCore.php on lines 401..407
      lib/AppCore.php on lines 416..422
      lib/AppCore.php on lines 431..437
      lib/AppCore.php on lines 463..469
      lib/AppCore.php on lines 478..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 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 9 locations. Consider refactoring.
      Open

              $this->setAuthor(UserFactory::CreateUser($row['author']));
      Severity: Major
      Found in lib/Glossary/Entry.php and 8 other locations - About 30 mins to fix
      lib/Events/Event.php on lines 215..215
      lib/Events/EventDate.php on lines 163..163
      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/Glossary/Entry.php by phpcodesniffer

      Blank line found at start of control structure
      Open

              if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
      Severity: Minor
      Found in lib/Glossary/Entry.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/Glossary/Entry.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/Glossary/Entry.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status