railpage/railpagecore

View on GitHub
lib/Links/Links.php

Summary

Maintainability
F
4 days
Test Coverage

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

class Links extends Appcore {
    
    /**
     * Get categories
     */
Severity: Minor
Found in lib/Links/Links.php by phpmd

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

    public function getCategories($parent = 0, $children = true) {
        $parent = intval($parent);
        
        $mckey = "railpage:links.categories.parent=" . $parent . ".children=" . (bool)$children; 
        
Severity: Minor
Found in lib/Links/Links.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 createSlug has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createSlug($categoryId = false) {
        if (RP_DEBUG) {
            global $site_debug;
            $debug_timer_start = microtime(true);
        }
Severity: Minor
Found in lib/Links/Links.php - About 1 hr to fix

    Method getCategories has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getCategories($parent = 0, $children = true) {
            $parent = intval($parent);
            
            $mckey = "railpage:links.categories.parent=" . $parent . ".children=" . (bool)$children; 
            
    Severity: Minor
    Found in lib/Links/Links.php - About 1 hr to fix

      Function createSlug has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createSlug($categoryId = false) {
              if (RP_DEBUG) {
                  global $site_debug;
                  $debug_timer_start = microtime(true);
              }
      Severity: Minor
      Found in lib/Links/Links.php - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function makePermaLink($entity = false) {
              if (!$entity) {
                  return false;
              }
              
      Severity: Minor
      Found in lib/Links/Links.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

      Function getLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getLinks($categoryId = false, $sort = "title", $direction = "ASC") {
              if (!$this->db || !$categoryId) {
                  return false;
              }
              
      Severity: Minor
      Found in lib/Links/Links.php - About 45 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 getNewest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getNewest($categoryId = false, $limit = 20, $start = 0) {
              
              $params = array(); 
              $query = "SELECT l.*, c.title as category_title, c.cdescription as category_description FROM nuke_links_links l, nuke_links_categories c WHERE l.cid = c.cid AND l.link_approved = 1";
              
      Severity: Minor
      Found in lib/Links/Links.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 getCategories() has an NPath complexity of 480. The configured NPath complexity threshold is 200.
      Open

          public function getCategories($parent = 0, $children = true) {
              $parent = intval($parent);
              
              $mckey = "railpage:links.categories.parent=" . $parent . ".children=" . (bool)$children; 
              
      Severity: Minor
      Found in lib/Links/Links.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 createSlug() has an NPath complexity of 384. The configured NPath complexity threshold is 200.
      Open

          public function createSlug($categoryId = false) {
              if (RP_DEBUG) {
                  global $site_debug;
                  $debug_timer_start = microtime(true);
              }
      Severity: Minor
      Found in lib/Links/Links.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 createSlug() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
      Open

          public function createSlug($categoryId = false) {
              if (RP_DEBUG) {
                  global $site_debug;
                  $debug_timer_start = microtime(true);
              }
      Severity: Minor
      Found in lib/Links/Links.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 method getCategories() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
      Open

          public function getCategories($parent = 0, $children = true) {
              $parent = intval($parent);
              
              $mckey = "railpage:links.categories.parent=" . $parent . ".children=" . (bool)$children; 
              
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

      Avoid using undefined variables such as '$poposal' which will lead to PHP notices.
      Open

                  $proposal = substr($poposal, 0, 200); 
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      UndefinedVariable

      Since: 2.8.0

      Detects when a variable is used that has not been defined before.

      Example

      class Foo
      {
          private function bar()
          {
              // $message is undefined
              echo $message;
          }
      }

      Source https://phpmd.org/rules/cleancode.html#undefinedvariable

      The method broken has a boolean flag argument $id, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function broken($id = false, $username = false) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method getLink has a boolean flag argument $id, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function getLink($id = false) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method broken has a boolean flag argument $username, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function broken($id = false, $username = false) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method reject has a boolean flag argument $id, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function reject($id = false) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method createSlug has a boolean flag argument $categoryId, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function createSlug($categoryId = false) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method makePermaLink has a boolean flag argument $entity, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function makePermaLink($entity = false) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method getNewest has a boolean flag argument $categoryId, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function getNewest($categoryId = false, $limit = 20, $start = 0) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method approve has a boolean flag argument $id, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function approve($id = false) { 
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method getCategories has a boolean flag argument $children, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function getCategories($parent = 0, $children = true) {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method getLinks has a boolean flag argument $categoryId, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function getLinks($categoryId = false, $sort = "title", $direction = "ASC") {
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method createSlug uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      $site_debug[] = "Zend_DB: SUCCESS create url slug for link category ID " . $categoryId . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                  }
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

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

          public function getCategories($parent = 0, $children = true) {
              $parent = intval($parent);
              
              $mckey = "railpage:links.categories.parent=" . $parent . ".children=" . (bool)$children; 
              
      Severity: Minor
      Found in lib/Links/Links.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

      The method makePermaLink uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

                  } else {
                      $slug = $row['slug']; 
                  }
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

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

          public function getLinks($categoryId = false, $sort = "title", $direction = "ASC") {
              if (!$this->db || !$categoryId) {
                  return false;
              }
              
      Severity: Minor
      Found in lib/Links/Links.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

      The method createSlug uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  return false;
              }
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method makePermaLink uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $slug = $entity;
              }
      Severity: Minor
      Found in lib/Links/Links.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

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

                  $proposal = substr($poposal, 0, 200); 
      Severity: Minor
      Found in lib/Links/Links.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

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

              foreach ($find as $item) {
      Severity: Minor
      Found in lib/Links/Links.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 (RP_DEBUG) {
                  if ($rs === false) {
                      $site_debug[] = "Zend_DB: FAILED create url slug for link category ID " . $categoryId . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                  } else {
                      $site_debug[] = "Zend_DB: SUCCESS create url slug for link category ID " . $categoryId . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
      Severity: Major
      Found in lib/Links/Links.php and 1 other location - About 5 hrs to fix
      lib/News/Base.php on lines 386..392

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

      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 ($categoryId) {
                  $title = $this->db->fetchOne("SELECT title FROM nuke_links_categories WHERE cid = ?", $categoryId); 
              } elseif (isset($this->title) && !empty($this->title)) {
                  $title = $this->title;
                  $categoryId = $this->id;
      Severity: Major
      Found in lib/Links/Links.php and 1 other location - About 2 hrs to fix
      lib/News/Base.php on lines 338..345

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

      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 (stripos($return['url'], "http") === false) {
                  $return['url'] = "http://".$return['url']; 
              }
      Severity: Major
      Found in lib/Links/Links.php and 2 other locations - About 1 hr to fix
      lib/Links/Links.php on lines 122..124
      lib/Links/Links.php on lines 206..208

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 45.

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

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

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

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

      Refactorings

      Further Reading

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

                  if (stripos($row['url'], "http") === false) {
                      $row['url'] = "http://".$row['url']; 
                  }
      Severity: Major
      Found in lib/Links/Links.php and 2 other locations - About 1 hr to fix
      lib/Links/Links.php on lines 122..124
      lib/Links/Links.php on lines 147..149

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 45.

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

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

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

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

      Refactorings

      Further Reading

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

                      if (stripos($row['url'], "http") === false) {
                          $row['url'] = "http://".$row['url']; 
                      }
      Severity: Major
      Found in lib/Links/Links.php and 2 other locations - About 1 hr to fix
      lib/Links/Links.php on lines 147..149
      lib/Links/Links.php on lines 206..208

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 45.

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

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

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

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

      Refactorings

      Further Reading

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

              if (strlen($proposal) >= 256) {
                  $proposal = substr($poposal, 0, 200); 
              }
      Severity: Major
      Found in lib/Links/Links.php and 1 other location - About 1 hr to fix
      lib/News/Base.php on lines 354..356

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 36.

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

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

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

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

      Refactorings

      Further Reading

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

          public function reject($id = false) {
              $where = array(
                  "lid = ?" => $id
              );
              
      Severity: Major
      Found in lib/Links/Links.php and 1 other location - About 1 hr to fix
      lib/Images/Screener.php on lines 208..213

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 31.

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

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

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

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

      Refactorings

      Further Reading

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

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

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 28.

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

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

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

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

      Refactorings

      Further Reading

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

                      if ($row['parentid'] != 0) {
                          $return[$row['parentid']]['children'][$row['cid']] = $row; 
                      }
      Severity: Major
      Found in lib/Links/Links.php and 2 other locations - About 55 mins to fix
      lib/Forums/Forums.php on lines 365..367
      lib/Forums/Forums.php on lines 391..393

      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 (!$id || !$username || !$this->db) {
                  return false;
              }
      Severity: Minor
      Found in lib/Links/Links.php and 1 other location - About 50 mins to fix
      lib/Locations/Locations.php on lines 287..289

      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

              $result = $this->db->fetchAll("SELECT cid FROM nuke_links_categories WHERE slug = ? AND cid != ?", array($proposal, $categoryId)); 
      Severity: Major
      Found in lib/Links/Links.php and 3 other locations - About 45 mins to fix
      lib/Images/Images.php on lines 109..109
      lib/News/Base.php on lines 362..362
      lib/Organisations/Base.php on lines 138..138

      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->Memcached->save($mckey, $return, strtotime("+24 hours")); 
      Severity: Major
      Found in lib/Links/Links.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 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/Users/Timeline.php on lines 241..241
      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 22 locations. Consider refactoring.
      Open

                  $this->Memcached->save($mckey, $return, strtotime("+24 hours")); 
      Severity: Major
      Found in lib/Links/Links.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/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/Users/Timeline.php on lines 241..241
      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 15 locations. Consider refactoring.
      Open

          public function getPending() {
              $query = "SELECT * FROM nuke_links_links WHERE link_approved = 0";
              
              return $this->db->fetchAll($query);
          }
      Severity: Major
      Found in lib/Links/Links.php and 14 other locations - About 35 mins to fix
      lib/Images/Competitions.php on lines 332..341
      lib/Images/Screener.php on lines 258..269
      lib/Images/Statistics.php on lines 93..104
      lib/Images/Statistics.php on lines 112..133
      lib/Images/Statistics.php on lines 141..147
      lib/Images/Statistics.php on lines 155..170
      lib/Images/Statistics.php on lines 250..256
      lib/Images/Statistics.php on lines 264..270
      lib/Locations/Locations.php on lines 204..213
      lib/Locations/Locations.php on lines 531..535
      lib/Locos/Liveries/Liveries.php on lines 86..96
      lib/Users/Admin.php on lines 34..39
      lib/Users/Base.php on lines 234..238
      lib/Users/Base.php on lines 271..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 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

          public function getNewest($categoryId = false, $limit = 20, $start = 0) {
              
              $params = array(); 
              $query = "SELECT l.*, c.title as category_title, c.cdescription as category_description FROM nuke_links_links l, nuke_links_categories c WHERE l.cid = c.cid AND l.link_approved = 1";
              
      Severity: Minor
      Found in lib/Links/Links.php and 1 other location - About 35 mins to fix
      lib/Users/Utility/AvatarUtility.php on lines 38..178

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

              $rs = $this->db->update("nuke_links_categories", $data, $where); 
      Severity: Major
      Found in lib/Links/Links.php and 4 other locations - About 30 mins to fix
      lib/Links/Link.php on lines 194..194
      lib/Locos/Locomotive.php on lines 687..687
      lib/News/Base.php on lines 384..384
      lib/Organisations/Base.php on lines 160..160

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 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

              if ($categoryId) {
                  $query .= " AND l.cid = ?";
                  $params[] = $categoryId;
              }
      Severity: Minor
      Found in lib/Links/Links.php and 2 other locations - About 30 mins to fix
      lib/Forums/Forums.php on lines 471..474
      lib/PlaceUtility.php on lines 262..265

      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

              if ($return = $this->Memcached->fetch($mckey)) {
                  return $return;
              }
      Severity: Major
      Found in lib/Links/Links.php and 8 other locations - About 30 mins to fix
      lib/Chronicle/Chronicle.php on lines 105..107
      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/Users/Timeline.php on lines 209..211
      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

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

              $name = str_replace($find, $replace, $title);
      Severity: Major
      Found in lib/Links/Links.php and 7 other locations - About 30 mins to fix
      lib/Formatting/BbcodeUtility.php on lines 109..109
      lib/Formatting/BbcodeUtility.php on lines 124..124
      lib/Formatting/MultimediaUtility.php on lines 191..191
      lib/Images/Exif.php on lines 230..230
      lib/News/Base.php on lines 347..347
      lib/News/Utility/ArticleUtility.php on lines 97..97
      lib/AppCore.php on lines 700..700

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

      There are no issues that match your filters.

      Category
      Status