railpage/railpagecore

View on GitHub
lib/Users/Timeline.php

Summary

Maintainability
D
2 days
Test Coverage

Function GenerateTimeline has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public function GenerateTimeline($dateFrom, $dateTo) {
        
        $page = false;
        $items_per_page = false;
        
Severity: Minor
Found in lib/Users/Timeline.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method GenerateTimeline has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function GenerateTimeline($dateFrom, $dateTo) {
        
        $page = false;
        $items_per_page = false;
        
Severity: Major
Found in lib/Users/Timeline.php - About 2 hrs to fix

    Method getFilteredForums has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getFilteredForums() {
            
            $timer = Debug::GetTimer(); 
            
            if (!isset($this->User->Guest) || !$this->User->Guest instanceof User) {
    Severity: Minor
    Found in lib/Users/Timeline.php - About 1 hr to fix

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

          private function getFilteredForums() {
              
              $timer = Debug::GetTimer(); 
              
              if (!isset($this->User->Guest) || !$this->User->Guest instanceof User) {
      Severity: Minor
      Found in lib/Users/Timeline.php - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      The method GenerateTimeline() has an NPath complexity of 19152. The configured NPath complexity threshold is 200.
      Open

          public function GenerateTimeline($dateFrom, $dateTo) {
              
              $page = false;
              $items_per_page = false;
              
      Severity: Minor
      Found in lib/Users/Timeline.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 GenerateTimeline() has 152 lines of code. Current threshold is set to 100. Avoid really long methods.
      Open

          public function GenerateTimeline($dateFrom, $dateTo) {
              
              $page = false;
              $items_per_page = false;
              
      Severity: Minor
      Found in lib/Users/Timeline.php by phpmd

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

          public function GenerateTimeline($dateFrom, $dateTo) {
              
              $page = false;
              $items_per_page = false;
              
      Severity: Minor
      Found in lib/Users/Timeline.php by phpmd

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

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

      class Timeline extends AppCore {
          
          /**
           * Extract a user's timeline 
           * @since Version 3.9.1
      Severity: Minor
      Found in lib/Users/Timeline.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

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

      Example

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

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

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

          private function getFilteredForums() {
              
              $timer = Debug::GetTimer(); 
              
              if (!isset($this->User->Guest) || !$this->User->Guest instanceof User) {
      Severity: Minor
      Found in lib/Users/Timeline.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 '87', column '13').
      Open

          public function GenerateTimeline($dateFrom, $dateTo) {
              
              $page = false;
              $items_per_page = false;
              
      Severity: Minor
      Found in lib/Users/Timeline.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 unused local variables such as '$acl'.
      Open

              $acl = $Forums->setUser($this->User->Guest)->getACL();
      Severity: Minor
      Found in lib/Users/Timeline.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

              if (!$this->User instanceof User) {
                  throw new InvalidArgumentException("No user object has been provided (hint: " . __CLASS__ . "::setUser(\$User))"); 
              }
      Severity: Major
      Found in lib/Users/Timeline.php and 2 other locations - About 1 hr to fix
      lib/Chronicle/Entry.php on lines 200..202
      lib/Images/Provider/Flickr.php on lines 565..567

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 32.

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

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

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

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

      Refactorings

      Further Reading

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

              if (!isset($this->User->Guest) || !$this->User->Guest instanceof User) {
                  return "";
              }
      Severity: Major
      Found in lib/Users/Timeline.php and 2 other locations - About 45 mins to fix
      lib/Images/Favourites.php on lines 124..126
      lib/Locos/Correction.php on lines 316..318

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

              if (filter_var($dateFrom, FILTER_VALIDATE_INT)) {
                  $page = $dateFrom;
              }
      Severity: Major
      Found in lib/Users/Timeline.php and 2 other locations - About 45 mins to fix
      lib/Users/Timeline.php on lines 52..54
      lib/fwlink.php on lines 83..85

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

              if (filter_var($dateTo, FILTER_VALIDATE_INT)) {
                  $items_per_page = $dateTo;
              }
      Severity: Major
      Found in lib/Users/Timeline.php and 2 other locations - About 45 mins to fix
      lib/Users/Timeline.php on lines 48..50
      lib/fwlink.php on lines 83..85

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

              $this->Redis->save($mckey, $forum_post_filter, strtotime("+1 week"));
      Severity: Major
      Found in lib/Users/Timeline.php and 21 other locations - About 40 mins to fix
      lib/Chronicle/Chronicle.php on lines 119..119
      lib/Config/Base.php on lines 40..40
      lib/Config/Base.php on lines 111..111
      lib/Downloads/Download.php on lines 530..530
      lib/Glossary/Glossary.php on lines 107..107
      lib/Images/Images.php on lines 110..110
      lib/Links/Links.php on lines 94..94
      lib/Links/Links.php on lines 129..129
      lib/Locations/Country.php on lines 179..179
      lib/Locations/Country.php on lines 180..180
      lib/Locations/Location.php on lines 811..811
      lib/Locations/Locations.php on lines 76..76
      lib/Locations/Locations.php on lines 127..127
      lib/Locations/Locations.php on lines 161..161
      lib/Locations/Locations.php on lines 474..474
      lib/Locos/Locomotive.php on lines 1227..1227
      lib/Locos/Locomotive.php on lines 1538..1538
      lib/Locos/Locos.php on lines 238..238
      lib/PrivateMessages/Folder.php on lines 259..259
      lib/Users/Base.php on lines 82..82
      lib/Place.php on lines 600..600

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 24.

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

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

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

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

      Refactorings

      Further Reading

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

                  $this->Redis->save($mckey, "", strtotime("+1 week"));
      Severity: Minor
      Found in lib/Users/Timeline.php and 1 other location - About 40 mins to fix
      lib/Users/Group.php on lines 477..477

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 24.

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

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

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

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

      Refactorings

      Further Reading

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

                  if ($page && $items_per_page) {
                      $timeline['page'] = $page;
                      $timeline['perpage'] = $items_per_page;
                  }
      Severity: Minor
      Found in lib/Users/Timeline.php and 1 other location - About 40 mins to fix
      lib/Downloads/Download.php on lines 396..399

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 23.

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

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

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

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

      Refactorings

      Further Reading

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

              $row['event']['action'] = Grammar::getAction($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

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

              $row['event']['article'] = Grammar::getArticle_AnA($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331

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

                  $row['meta']['url'] = Timeline\Utility\Url::createUrl($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

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

              $row['event']['article'] = Grammar::getArticle_OfIn($row); 
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 332..332

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

              $row['event']['object'] = Grammar::getObject($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

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

              $row['event']['preposition'] = Grammar::getPrepositionFrom($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

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

                  $row['timestamp_nice'] = ContentUtility::relativeTime($row['timestamp']);
      Severity: Major
      Found in lib/Users/Timeline.php and 14 other locations - About 35 mins to fix
      lib/Formatting/MultimediaUtility.php on lines 263..263
      lib/Images/Competition.php on lines 351..351
      lib/Images/Exif.php on lines 145..145
      lib/Images/Exif.php on lines 146..146
      lib/Images/Exif.php on lines 147..147
      lib/Images/ImageFactory.php on lines 229..229
      lib/Images/Utility/Finder.php on lines 706..706
      lib/Images/Utility/Finder.php on lines 735..735
      lib/Locos/Utility/LocosUtility.php on lines 56..56
      lib/News/Topic.php on lines 233..233
      lib/News/Topic.php on lines 290..290
      lib/News/Topic.php on lines 292..292
      lib/Newsletters/Weekly.php on lines 412..412
      lib/Newsletters/Weekly.php on lines 414..414

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

              $row['event']['preposition'] = Grammar::getPrepositionOf($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

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

              $row['event']['preposition'] = Grammar::getPrepositionTo($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

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

              $row['event']['preposition'] = Grammar::getPrepositionIn($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 153..153
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 22.

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

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

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

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

      Refactorings

      Further Reading

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

                      $row['timestamp'] = new DateTime($row['timestamp']); 
      Severity: Minor
      Found in lib/Users/Timeline.php and 2 other locations - About 35 mins to fix
      lib/SiteEvent/Base.php on lines 48..48
      lib/SiteEvent/Base.php on lines 107..107

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

                  $row['meta']['namespace'] = Timeline\Utility\General::getModuleNamespace($row);
      Severity: Major
      Found in lib/Users/Timeline.php and 9 other locations - About 35 mins to fix
      lib/Users/Timeline.php on lines 159..159
      lib/Users/Timeline.php on lines 282..282
      lib/Users/Timeline.php on lines 283..283
      lib/Users/Timeline.php on lines 309..309
      lib/Users/Timeline.php on lines 310..310
      lib/Users/Timeline.php on lines 311..311
      lib/Users/Timeline.php on lines 312..312
      lib/Users/Timeline.php on lines 331..331
      lib/Users/Timeline.php on lines 332..332

      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 ($forum_post_filter = $this->Redis->fetch($mckey)) {
                  return $forum_post_filter;
              }
      Severity: Major
      Found in lib/Users/Timeline.php and 8 other locations - About 30 mins to fix
      lib/Chronicle/Chronicle.php on lines 105..107
      lib/Links/Links.php on lines 40..42
      lib/Locations/Location.php on lines 722..724
      lib/Locations/Locations.php on lines 99..101
      lib/Locos/Locomotive.php on lines 1206..1208
      lib/Locos/Locomotive.php on lines 1500..1502
      lib/Place.php on lines 383..385
      lib/Place.php on lines 482..484

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 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/Users/Timeline.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/Users/Timeline.php by phpcodesniffer

      Expected 1 blank line at end of file; 2 found
      Open

      }
      Severity: Minor
      Found in lib/Users/Timeline.php by phpcodesniffer

      Blank line found at start of control structure
      Open

              foreach ($timeline['timeline'] as $key => $row) {
      Severity: Minor
      Found in lib/Users/Timeline.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/Users/Timeline.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status