railpage/railpagecore

View on GitHub
lib/ContentUtility.php

Summary

Maintainability
F
4 days
Test Coverage

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

class ContentUtility {
    
    /**
     * Text format parser version
     * Bump this when a change to formatText() has been made to bust previously rendered (and cached) text blocks
Severity: Minor
Found in lib/ContentUtility.php by phpmd

Method relativeTime has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function relativeTime($timestamp, $now = null, $format = null) {
        
        if ($timestamp instanceof DateTime) {
            $timestamp = $timestamp->getTimestamp(); 
        }
Severity: Minor
Found in lib/ContentUtility.php - About 1 hr to fix

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

        public static function formatText($string, $options) {
            
            AppCore::getSmarty()->addStylesheet("/themes/jiffy_simple/style/opt.embedded.css"); 
            
            $defaultOptions = [
    Severity: Minor
    Found in lib/ContentUtility.php - About 1 hr to fix

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

          public static function convertCurrency($amount, $dateObject = null) {
              
              if (!$dateObject instanceof DateTime) {
                  return;
              }
      Severity: Minor
      Found in lib/ContentUtility.php - About 1 hr to fix

        Function relativeTime has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function relativeTime($timestamp, $now = null, $format = null) {
                
                if ($timestamp instanceof DateTime) {
                    $timestamp = $timestamp->getTimestamp(); 
                }
        Severity: Minor
        Found in lib/ContentUtility.php - About 55 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

        Avoid too many return statements within this method.
        Open

                    return sprintf($diff > 1 ? '%s months ago' : 'last month', $diff);
        Severity: Major
        Found in lib/ContentUtility.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return sprintf($diff > 1 ? '%s years ago' : 'last year', $diff);
          Severity: Major
          Found in lib/ContentUtility.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return sprintf($diff > 1 ? '%s weeks ago' : 'one week ago', $diff);
            Severity: Major
            Found in lib/ContentUtility.php - About 30 mins to fix

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

                  public static function GetOpenGraphTags($url) {
                      
                      $Memcached = AppCore::GetMemcached(); 
                      
                      $mckey = md5($url); 
              Severity: Minor
              Found in lib/ContentUtility.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

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

                  public static function convertCurrency($amount, $dateObject = null) {
                      
                      if (!$dateObject instanceof DateTime) {
                          return;
                      }
              Severity: Minor
              Found in lib/ContentUtility.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 relativeTime() has an NPath complexity of 11664. The configured NPath complexity threshold is 200.
              Open

                  public static function relativeTime($timestamp, $now = null, $format = null) {
                      
                      if ($timestamp instanceof DateTime) {
                          $timestamp = $timestamp->getTimestamp(); 
                      }
              Severity: Minor
              Found in lib/ContentUtility.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 relativeTime() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
              Open

                  public static function relativeTime($timestamp, $now = null, $format = null) {
                      
                      if ($timestamp instanceof DateTime) {
                          $timestamp = $timestamp->getTimestamp(); 
                      }
              Severity: Minor
              Found in lib/ContentUtility.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 ContentUtility has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
              Open

              class ContentUtility {
                  
                  /**
                   * Text format parser version
                   * Bump this when a change to formatText() has been made to bust previously rendered (and cached) text blocks
              Severity: Minor
              Found in lib/ContentUtility.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 '427', column '13').
              Open

                  public static function GetOpenGraphTags($url) {
                      
                      $Memcached = AppCore::GetMemcached(); 
                      
                      $mckey = md5($url); 
              Severity: Minor
              Found in lib/ContentUtility.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 '67', column '13').
              Open

                  public static function formatText($string, $options) {
                      
                      AppCore::getSmarty()->addStylesheet("/themes/jiffy_simple/style/opt.embedded.css"); 
                      
                      $defaultOptions = [
              Severity: Minor
              Found in lib/ContentUtility.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 parameters such as '$url'.
              Open

                  public static function url_exists($url) {
              Severity: Minor
              Found in lib/ContentUtility.php by phpmd

              UnusedFormalParameter

              Since: 0.2

              Avoid passing parameters to methods or constructors and then not using those parameters.

              Example

              class Foo
              {
                  private function bar($howdy)
                  {
                      // $howdy is not used
                  }
              }

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

              Avoid unused local variables such as '$rs'.
              Open

                      $rs = $cacheProvider->save($cacheKey, $string, 0); // 3600 * 24 * 30); 
              Severity: Minor
              Found in lib/ContentUtility.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 2 locations. Consider refactoring.
              Open

                      if (is_array($parsedUrl['query'])) {
                          $parsedUrl['query'] = implode("&", $parsedUrl['query']); 
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 1 other location - About 1 hr to fix
              lib/Images/Image.php on lines 1413..1415

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

              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

                          require_once("vendor" . DS . "scottmac" . DS . "opengraph" . DS . "OpenGraph.php");
              Severity: Major
              Found in lib/ContentUtility.php and 1 other location - About 1 hr to fix
              lib/News/Article.php on lines 803..803

              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 (!is_array($sub)) {
                                  return iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode($sub)); 
                              } 
              Severity: Major
              Found in lib/ContentUtility.php and 1 other location - About 1 hr to fix
              lib/ContentUtility.php on lines 301..303

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

              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 (!is_array($row)) {
                              return iconv('UTF-8', 'UTF-8//IGNORE', utf8_encode($row)); 
                          }
              Severity: Major
              Found in lib/ContentUtility.php and 1 other location - About 1 hr to fix
              lib/ContentUtility.php on lines 306..308

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

              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 ($diff < 7) {
                          return sprintf($diff > 1 ? '%s days ago' : 'yesterday', $diff);
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 4 other locations - About 1 hr to fix
              lib/ContentUtility.php on lines 149..151
              lib/ContentUtility.php on lines 155..157
              lib/ContentUtility.php on lines 161..163
              lib/ContentUtility.php on lines 178..180

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

                      if ($diff < 12) {
                          return sprintf($diff > 1 ? '%s months ago' : 'last month', $diff);
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 4 other locations - About 1 hr to fix
              lib/ContentUtility.php on lines 149..151
              lib/ContentUtility.php on lines 155..157
              lib/ContentUtility.php on lines 161..163
              lib/ContentUtility.php on lines 167..169

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 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 5 locations. Consider refactoring.
              Open

                      if ($diff < 60) {
                          return sprintf($diff > 1 ? '%s minutes ago' : 'one minute ago', $diff);
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 4 other locations - About 1 hr to fix
              lib/ContentUtility.php on lines 149..151
              lib/ContentUtility.php on lines 161..163
              lib/ContentUtility.php on lines 167..169
              lib/ContentUtility.php on lines 178..180

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

                      if ($diff < 60) {
                          return sprintf($diff > 1 ? '%s seconds ago' : 'a second ago', $diff);
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 4 other locations - About 1 hr to fix
              lib/ContentUtility.php on lines 155..157
              lib/ContentUtility.php on lines 161..163
              lib/ContentUtility.php on lines 167..169
              lib/ContentUtility.php on lines 178..180

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

                      if ($diff < 24) {
                          return sprintf($diff > 1 ? '%s hours ago' : 'an hour ago', $diff);
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 4 other locations - About 1 hr to fix
              lib/ContentUtility.php on lines 149..151
              lib/ContentUtility.php on lines 155..157
              lib/ContentUtility.php on lines 167..169
              lib/ContentUtility.php on lines 178..180

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

                          if ($dateStart->diff($dateEnd)->format("%m") > 1) {
                              $age .= "s";
                          }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 55 mins to fix
              lib/ContentUtility.php on lines 200..202

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

                      if ($dateStart->diff($dateEnd)->format("%Y") > 1) {
                          $age .= "s";
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 55 mins to fix
              lib/ContentUtility.php on lines 207..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 4 locations. Consider refactoring.
              Open

                      $query    = isset($parsedUrl['query']) ? '?' . $parsedUrl['query'] : ''; 
              Severity: Major
              Found in lib/ContentUtility.php and 3 other locations - About 50 mins to fix
              lib/ContentUtility.php on lines 401..401
              lib/ContentUtility.php on lines 403..403
              lib/ContentUtility.php on lines 407..407

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 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 4 locations. Consider refactoring.
              Open

                      $fragment = isset($parsedUrl['fragment']) ? '#' . $parsedUrl['fragment'] : ''; 
              Severity: Major
              Found in lib/ContentUtility.php and 3 other locations - About 50 mins to fix
              lib/ContentUtility.php on lines 401..401
              lib/ContentUtility.php on lines 403..403
              lib/ContentUtility.php on lines 406..406

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

                      $port     = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : ''; 
              Severity: Major
              Found in lib/ContentUtility.php and 3 other locations - About 50 mins to fix
              lib/ContentUtility.php on lines 403..403
              lib/ContentUtility.php on lines 406..406
              lib/ContentUtility.php on lines 407..407

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 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 4 locations. Consider refactoring.
              Open

                      $pass     = isset($parsedUrl['pass']) ? ':' . $parsedUrl['pass']  : ''; 
              Severity: Major
              Found in lib/ContentUtility.php and 3 other locations - About 50 mins to fix
              lib/ContentUtility.php on lines 401..401
              lib/ContentUtility.php on lines 406..406
              lib/ContentUtility.php on lines 407..407

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 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 2 locations. Consider refactoring.
              Open

                      if (function_exists("html_entity_decode_utf8")) {
                          $text = html_entity_decode_utf8($text);
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 45 mins to fix
              lib/Formatting/MakeClickable.php on lines 269..271

              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 (substr($text, -1) === "-") {
                          $text = substr($text, 0, -1);
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 40 mins to fix
              lib/ContentUtility.php on lines 281..283

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

                      if (substr($text, -1) == ".") {
                          $text = substr($text, 0, -1);
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 40 mins to fix
              lib/ContentUtility.php on lines 115..117

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 23.

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

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

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

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

              Refactorings

              Further Reading

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

                      if ($dateObject->format("Y") > 1966) {
                          $url .= "annualDecimal.html";
                          $data['body']['annualDollar'] = $amount;
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 40 mins to fix
              lib/ContentUtility.php on lines 344..347

              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

                  public static function relativeTime($timestamp, $now = null, $format = null) {
                      
                      if ($timestamp instanceof DateTime) {
                          $timestamp = $timestamp->getTimestamp(); 
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 40 mins to fix
              lib/Locos/Locos.php on lines 1093..1122

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 23.

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

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

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

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

              Refactorings

              Further Reading

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

                      if ($dateObject->format("Y") <= 1966) {
                          $url .= "annualPreDecimal.html";
                          $data['body']['annualPound'] = $amount;
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 40 mins to fix
              lib/ContentUtility.php on lines 349..352

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

                      if (is_object($string)) {
                          $string = $string->__toString(); 
                      }
              Severity: Minor
              Found in lib/ContentUtility.php and 2 other locations - About 35 mins to fix
              lib/Formatting/EmoticonsUtility.php on lines 75..77
              lib/News/Utility/ArticleUtility.php on lines 100..102

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 22.

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

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

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

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

              Refactorings

              Further Reading

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

                          $exp = $Memcached->fetch(sprintf("%s-exp", $mckey)); 
              Severity: Minor
              Found in lib/ContentUtility.php and 1 other location - About 35 mins to fix
              lib/Users/Factory.php on lines 37..37

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

                      $text = strtolower(trim($text)); 
              Severity: Major
              Found in lib/ContentUtility.php and 6 other locations - About 30 mins to fix
              lib/Images/Utility/CompNotify.php on lines 88..88
              lib/Images/Utility/ImageUtility.php on lines 94..94
              lib/Jobs/Locations.php on lines 78..78
              lib/Railcams/Camera.php on lines 856..856
              lib/AppCore.php on lines 561..561
              lib/Memcached.php on lines 65..65

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

                      $string = Html::cleanupBadHtml($string, $options['editor_version']); 
              Severity: Minor
              Found in lib/ContentUtility.php and 2 other locations - About 30 mins to fix
              lib/ContentUtility.php on lines 77..77
              lib/ContentUtility.php on lines 80..80

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

                      $string = EmoticonsUtility::Process($string, $options['flag_emoticons']); 
              Severity: Minor
              Found in lib/ContentUtility.php and 2 other locations - About 30 mins to fix
              lib/ContentUtility.php on lines 78..78
              lib/ContentUtility.php on lines 80..80

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

                      $string = BbcodeUtility::Process($string, $options['flag_bbcode']); 
              Severity: Minor
              Found in lib/ContentUtility.php and 2 other locations - About 30 mins to fix
              lib/ContentUtility.php on lines 77..77
              lib/ContentUtility.php on lines 78..78

              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

                          $cost = pq($e)->attr("value"); 
              Severity: Major
              Found in lib/ContentUtility.php and 8 other locations - About 30 mins to fix
              lib/Formatting/Html.php on lines 47..47
              lib/Formatting/Html.php on lines 50..50
              lib/Formatting/Html.php on lines 51..51
              lib/Formatting/Html.php on lines 52..52
              lib/Formatting/MultimediaUtility.php on lines 355..355
              lib/Formatting/MultimediaUtility.php on lines 433..433
              lib/Formatting/MultimediaUtility.php on lines 470..470
              lib/Url.php on lines 163..163

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 20.

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

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

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

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

              Refactorings

              Further Reading

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

                      if ($now instanceof DateTime) {
                          $now = $now->getTimestamp(); 
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 3 other locations - About 30 mins to fix
              lib/ContentUtility.php on lines 134..136
              lib/Debug.php on lines 233..235
              lib/Session.php on lines 317..319

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 20.

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

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

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

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

              Refactorings

              Further Reading

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

                      if ($timestamp instanceof DateTime) {
                          $timestamp = $timestamp->getTimestamp(); 
                      }
              Severity: Major
              Found in lib/ContentUtility.php and 3 other locations - About 30 mins to fix
              lib/ContentUtility.php on lines 138..140
              lib/Debug.php on lines 233..235
              lib/Session.php on lines 317..319

              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/ContentUtility.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/ContentUtility.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/ContentUtility.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/ContentUtility.php by phpcodesniffer

              Blank line found at end of control structure
              Open

                          
              Severity: Minor
              Found in lib/ContentUtility.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/ContentUtility.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/ContentUtility.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/ContentUtility.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/ContentUtility.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/ContentUtility.php by phpcodesniffer

              There are no issues that match your filters.

              Category
              Status