railpage/railpagecore

View on GitHub
lib/Forums/Post.php

Summary

Maintainability
F
5 days
Test Coverage

File Post.php has 405 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Forums API
 * @since Version 3.0.1
Severity: Minor
Found in lib/Forums/Post.php - About 5 hrs to fix

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

        public function commit() {
            if (empty($this->bbcode_uid)) {
                $this->bbcode_uid = crc32($this->text);
            }
            
    Severity: Major
    Found in lib/Forums/Post.php - About 4 hrs to fix

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

      class Post extends Forums {
          
          /**
           * Constant: Cache key for edit lookups
           * @since Version 3.11.0
      Severity: Minor
      Found in lib/Forums/Post.php by phpmd

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

          public function __construct($postid = false) {
              $post_timer_start = Debug::GetTimer(); 
              
              parent::__construct();
              
      Severity: Major
      Found in lib/Forums/Post.php - About 2 hrs to fix

        Function commit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function commit() {
                if (empty($this->bbcode_uid)) {
                    $this->bbcode_uid = crc32($this->text);
                }
                
        Severity: Minor
        Found in lib/Forums/Post.php - About 2 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

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

            public function validate() {
                
                if (is_null($this->bbcode_uid)) {
                    $this->bbcode_uid = "sausages";
                }
        Severity: Minor
        Found in lib/Forums/Post.php - About 1 hr to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function validate() {
                
                if (is_null($this->bbcode_uid)) {
                    $this->bbcode_uid = "sausages";
                }
        Severity: Minor
        Found in lib/Forums/Post.php - About 1 hr to fix

          The class Post has 24 fields. Consider redesigning Post to keep the number of fields under 15.
          Open

          class Post extends Forums {
              
              /**
               * Constant: Cache key for edit lookups
               * @since Version 3.11.0
          Severity: Minor
          Found in lib/Forums/Post.php by phpmd

          TooManyFields

          Since: 0.1

          Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

          Example

          class Person {
             protected $one;
             private $two;
             private $three;
             [... many more fields ...]
          }

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

          Method addReputationMarker has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function addReputationMarker($reputation_type_id = false) {
                  if (!filter_var($reputation_type_id, FILTER_VALIDATE_INT)) {
                      throw new Exception("Cannot add a reputation marker to this post because the supplied type ID (\$reputation_type_id) is not valid");
                  }
                  
          Severity: Minor
          Found in lib/Forums/Post.php - About 1 hr to fix

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

                public function __construct($postid = false) {
                    $post_timer_start = Debug::GetTimer(); 
                    
                    parent::__construct();
                    
            Severity: Minor
            Found in lib/Forums/Post.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 addReputationMarker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function addReputationMarker($reputation_type_id = false) {
                    if (!filter_var($reputation_type_id, FILTER_VALIDATE_INT)) {
                        throw new Exception("Cannot add a reputation marker to this post because the supplied type ID (\$reputation_type_id) is not valid");
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.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

            The method commit() has 152 lines of code. Current threshold is set to 100. Avoid really long methods.
            Open

                public function commit() {
                    if (empty($this->bbcode_uid)) {
                        $this->bbcode_uid = crc32($this->text);
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            The method commit() has an NPath complexity of 640. The configured NPath complexity threshold is 200.
            Open

                public function commit() {
                    if (empty($this->bbcode_uid)) {
                        $this->bbcode_uid = crc32($this->text);
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            NPathComplexity

            Since: 0.1

            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

            Example

            class Foo {
                function bar() {
                    // lots of complicated code
                }
            }

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

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

                public function validate() {
                    
                    if (is_null($this->bbcode_uid)) {
                        $this->bbcode_uid = "sausages";
                    }
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            NPathComplexity

            Since: 0.1

            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

            Example

            class Foo {
                function bar() {
                    // lots of complicated code
                }
            }

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

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

                public function validate() {
                    
                    if (is_null($this->bbcode_uid)) {
                        $this->bbcode_uid = "sausages";
                    }
            Severity: Minor
            Found in lib/Forums/Post.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 commit() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
            Open

                public function commit() {
                    if (empty($this->bbcode_uid)) {
                        $this->bbcode_uid = crc32($this->text);
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.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 '$Config' which will lead to PHP notices.
            Open

                    $Memcached->addServer($Config->Memcached->Host, 11211);
            Severity: Minor
            Found in lib/Forums/Post.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

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

                    unset($CurrentPost); unset($dataArray); unset($query);
            Severity: Minor
            Found in lib/Forums/Post.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

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

                                    $Error->save($e); 
            Severity: Minor
            Found in lib/Forums/Post.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

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

                    unset($CurrentPost); unset($dataArray); unset($query);
            Severity: Minor
            Found in lib/Forums/Post.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 class Post has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13.
            Open

            class Post extends Forums {
                
                /**
                 * Constant: Cache key for edit lookups
                 * @since Version 3.11.0
            Severity: Minor
            Found in lib/Forums/Post.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

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

                public function addReputationMarker($reputation_type_id = false) {
            Severity: Minor
            Found in lib/Forums/Post.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 getReputationMarkers has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public function getReputationMarkers($force = false) {
            Severity: Minor
            Found in lib/Forums/Post.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 __construct has a boolean flag argument $postid, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public function __construct($postid = false) {
            Severity: Minor
            Found in lib/Forums/Post.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

            Missing class import via use statement (line '487', column '38').
            Open

                                    $Event = new \Railpage\SiteEvent; 
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            MissingImport

            Since: 2.7.0

            Importing all external classes in a file through use statements makes them clearly visible.

            Example

            function make() {
                return new \stdClass();
            }

            Source http://phpmd.org/rules/cleancode.html#MissingImport

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

                    } else {
                        $this->db->insert("nuke_bbposts", $data); 
                        $this->id = $this->db->lastInsertId(); 
                        
                        $text['post_id'] = $this->id;
            Severity: Minor
            Found in lib/Forums/Post.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 '854', column '24').
            Open

                public function getReputationMarkers($force = false) {
                    $mckey = sprintf("railpage:forums.post;id=%d;getreputationmarkers", $this->id);
                    
                    $Registry = Registry::getInstance();
                    
            Severity: Minor
            Found in lib/Forums/Post.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 '628', column '14').
            Open

                public function getEdits() {
                    
                    $cacheKey = sprintf(self::CACHEKEY_EDITS, $this->id); 
                    
                    if (!$edits = AppCore::getMemcached()->fetch($cacheKey)) {
            Severity: Minor
            Found in lib/Forums/Post.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 '272', column '14').
            Open

                public function __construct($postid = false) {
                    $post_timer_start = Debug::GetTimer(); 
                    
                    parent::__construct();
                    
            Severity: Minor
            Found in lib/Forums/Post.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 addReputationMarker uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $this->db->insert("nuke_bbposts_reputation", $data); 
                        $id = $this->db->lastInsertId(); 
                    }
            Severity: Minor
            Found in lib/Forums/Post.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 '662', column '13').
            Open

                public function getNumEdits() {
                    
                    $cacheKey = sprintf(self::CACHEKEY_EDITS, $this->id); 
                    
                    if ($edits = AppCore::getMemcached()->fetch($cacheKey)) {
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($foo = 'bar') { // possible typo
                        // ...
                    }
                    if ($baz = 0) { // always false
                        // ...
                    }
                }
            }

            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                    $Memcached->addServer($Config->Memcached->Host, 11211);
            Severity: Minor
            Found in lib/Forums/Post.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 '$Registry'.
            Open

                    $Registry = Registry::getInstance();
            Severity: Minor
            Found in lib/Forums/Post.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 '$Error'.
            Open

                                    $Error->save($e); 
            Severity: Minor
            Found in lib/Forums/Post.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 '$CurrentPost'.
            Open

                    unset($CurrentPost); unset($dataArray); unset($query);
            Severity: Minor
            Found in lib/Forums/Post.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 '$query'.
            Open

                    unset($CurrentPost); unset($dataArray); unset($query);
            Severity: Minor
            Found in lib/Forums/Post.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

                public function setThread(Thread $Thread) {
                    if (!$this->thread instanceof Thread || !filter_var($this->thread->id, FILTER_VALIDATE_INT)) {
                        $this->thread = $Thread;
                    }
                    
            Severity: Major
            Found in lib/Forums/Post.php and 1 other location - About 2 hrs to fix
            lib/Forums/Thread.php on lines 594..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 60.

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

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

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

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

            Refactorings

            Further Reading

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

                    $this->url = new Url(sprintf("/f-p%d.htm#%d", $this->id, $this->id));
            Severity: Major
            Found in lib/Forums/Post.php and 2 other locations - About 1 hr to fix
            lib/Events/Month.php on lines 85..85
            lib/Images/Competition.php on lines 791..791

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 33.

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

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

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

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

            Refactorings

            Further Reading

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

                    if (filter_var($id, FILTER_VALIDATE_INT)) {
                        $where = array(
                            "id = ?" => $id
                        );
                        
            Severity: Major
            Found in lib/Forums/Post.php and 1 other location - About 1 hr to fix
            lib/Railcams/Photo.php on lines 398..403

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 31.

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

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

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

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

            Refactorings

            Further Reading

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

                        $this->pinned = isset($row['pinned']) ? (bool) $row['pinned'] : false;
            Severity: Major
            Found in lib/Forums/Post.php and 2 other locations - About 1 hr to fix
            lib/News/Article.php on lines 398..398
            lib/News/Article.php on lines 399..399

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 30.

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

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

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

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

            Refactorings

            Further Reading

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

                    if (RP_DEBUG) {
                        global $site_debug;
                        $debug_timer_start = microtime(true);
                    }
            Severity: Major
            Found in lib/Forums/Post.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/Thread.php on lines 209..212
            lib/Images/Image.php on lines 611..614
            lib/Links/Links.php on lines 278..281
            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 2 locations. Consider refactoring.
            Open

                    if (empty($this->bbcode_uid)) {
                        $this->bbcode_uid = crc32($this->text);
                    }
            Severity: Minor
            Found in lib/Forums/Post.php and 1 other location - About 50 mins to fix
            lib/News/Article.php on lines 790..792

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

                    $this->Redis->delete(sprintf(self::CACHEKEY_EDITS, $this->id));
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 45 mins to fix
            lib/Events/Event.php on lines 313..313
            lib/Forums/Post.php on lines 452..452
            lib/Locos/LocoClass.php on lines 1074..1074
            lib/Locos/LocoClass.php on lines 1075..1075
            lib/Locos/Locomotive.php on lines 694..694
            lib/News/Article.php on lines 670..670
            lib/News/Article.php on lines 671..671

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 26.

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

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

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

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

            Refactorings

            Further Reading

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

                    $this->Memcached->delete(sprintf(self::CACHEKEY_EDITS, $this->id));
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 45 mins to fix
            lib/Events/Event.php on lines 313..313
            lib/Forums/Post.php on lines 453..453
            lib/Locos/LocoClass.php on lines 1074..1074
            lib/Locos/LocoClass.php on lines 1075..1075
            lib/Locos/Locomotive.php on lines 694..694
            lib/News/Article.php on lines 670..670
            lib/News/Article.php on lines 671..671

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 26.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

                    if (is_null($this->edit_count)) {
                        $this->edit_count = 0;
                    }
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 40 mins to fix
            lib/Feedback/FeedbackItem.php on lines 172..174
            lib/Feedback/FeedbackItem.php on lines 176..178
            lib/Forums/Post.php on lines 355..357
            lib/Forums/Post.php on lines 359..361
            lib/Forums/Post.php on lines 363..365
            lib/Forums/Thread.php on lines 288..290
            lib/Jobs/Job.php on lines 252..254

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

                    if (is_null($this->lat)) {
                        $this->lat = 0;
                    }
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 40 mins to fix
            lib/Feedback/FeedbackItem.php on lines 172..174
            lib/Feedback/FeedbackItem.php on lines 176..178
            lib/Forums/Post.php on lines 359..361
            lib/Forums/Post.php on lines 363..365
            lib/Forums/Post.php on lines 367..369
            lib/Forums/Thread.php on lines 288..290
            lib/Jobs/Job.php on lines 252..254

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

                    $this->Redis->delete(sprintf("railpage:forums.post=%d;processed_message", $this->id));
            Severity: Major
            Found in lib/Forums/Post.php and 3 other locations - About 40 mins to fix
            lib/News/Article.php on lines 665..665
            lib/News/Article.php on lines 667..667
            lib/News/Article.php on lines 668..668

            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

                            $rs = $this->Memcached->save($this->mckey, $row, 43200);
            Severity: Minor
            Found in lib/Forums/Post.php and 1 other location - About 40 mins to fix
            lib/Forums/Post.php on lines 292..292

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

                    if (is_null($this->lon)) {
                        $this->lon = 0;
                    }
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 40 mins to fix
            lib/Feedback/FeedbackItem.php on lines 172..174
            lib/Feedback/FeedbackItem.php on lines 176..178
            lib/Forums/Post.php on lines 355..357
            lib/Forums/Post.php on lines 363..365
            lib/Forums/Post.php on lines 367..369
            lib/Forums/Thread.php on lines 288..290
            lib/Jobs/Job.php on lines 252..254

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

                    if (is_null($this->edit_timestamp)) {
                        $this->edit_timestamp = 0;
                    }
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 40 mins to fix
            lib/Feedback/FeedbackItem.php on lines 172..174
            lib/Feedback/FeedbackItem.php on lines 176..178
            lib/Forums/Post.php on lines 355..357
            lib/Forums/Post.php on lines 359..361
            lib/Forums/Post.php on lines 367..369
            lib/Forums/Thread.php on lines 288..290
            lib/Jobs/Job.php on lines 252..254

            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

                            $rs = $this->Memcached->save($this->mckey, $row, 43200);
            Severity: Minor
            Found in lib/Forums/Post.php and 1 other location - About 40 mins to fix
            lib/Forums/Post.php on lines 281..281

            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

                        $this->User->addNote(sprintf("Rated <a href='%s'>Post ID %d</a> as %s", $this->url->url, $this->id, $reputation_type_name));
            Severity: Minor
            Found in lib/Forums/Post.php and 1 other location - About 40 mins to fix
            lib/Ideas/Idea.php on lines 199..199

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

                    $cacheKey = sprintf(self::CACHEKEY_EDITS, $this->id); 
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 35 mins to fix
            lib/Forums/Post.php on lines 660..660
            lib/Images/Camera.php on lines 207..207
            lib/Images/Competition.php on lines 338..338
            lib/Locos/LocoClass.php on lines 657..657
            lib/Locos/Locomotive.php on lines 692..692
            lib/Locos/Locomotive.php on lines 1498..1498
            lib/Users/User.php on lines 1282..1282

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

                    $cacheKey = sprintf(self::CACHEKEY_EDITS, $this->id); 
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 35 mins to fix
            lib/Forums/Post.php on lines 626..626
            lib/Images/Camera.php on lines 207..207
            lib/Images/Competition.php on lines 338..338
            lib/Locos/LocoClass.php on lines 657..657
            lib/Locos/Locomotive.php on lines 692..692
            lib/Locos/Locomotive.php on lines 1498..1498
            lib/Users/User.php on lines 1282..1282

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

                        if (empty($this->url_slug)) {
                            $this->createSlug();
                            $this->commit();
                        }
            Severity: Minor
            Found in lib/Forums/Post.php and 2 other locations - About 30 mins to fix
            lib/Forums/Thread.php on lines 252..255
            lib/Locos/WheelArrangement.php on lines 111..114

            Duplicated Code

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

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

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

            Tuning

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

                        $this->old_text = stripslashes($row['post_text']);
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 30 mins to fix
            lib/Forums/Post.php on lines 314..314
            lib/Images/Competition.php on lines 420..420
            lib/Locations/Date.php on lines 71..71
            lib/Locations/Location.php on lines 498..498
            lib/Notifications/Notification.php on lines 135..135
            lib/PrivateMessages/Message.php on lines 275..275
            lib/Users/User.php on lines 1060..1060

            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

                        $this->text = stripslashes($row['post_text']);
            Severity: Major
            Found in lib/Forums/Post.php and 7 other locations - About 30 mins to fix
            lib/Forums/Post.php on lines 315..315
            lib/Images/Competition.php on lines 420..420
            lib/Locations/Date.php on lines 71..71
            lib/Locations/Location.php on lines 498..498
            lib/Notifications/Notification.php on lines 135..135
            lib/PrivateMessages/Message.php on lines 275..275
            lib/Users/User.php on lines 1060..1060

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

                    if (!$this->Author instanceof User) {
                        $this->loadAuthor();
                    }
            Severity: Minor
            Found in lib/Forums/Post.php and 2 other locations - About 30 mins to fix
            lib/Gallery/Image.php on lines 322..324
            lib/Locos/Date.php on lines 409..411

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 20.

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

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

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

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

            Refactorings

            Further Reading

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

                        $site_debug[] = "Zend_DB: " . $verb . " Forum post ID " . $this->id . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
            Severity: Minor
            Found in lib/Forums/Post.php and 1 other location - About 30 mins to fix
            lib/Newsletters/Newsletters.php on lines 152..152

            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

            The parameter $Staff is not named in camelCase.
            Open

                public function delete(User $Staff) {
                    if ($this->thread->id == "9448") {
                        return $this;
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            CamelCaseParameterName

            Since: 0.2

            It is considered best practice to use the camelCase notation to name parameters.

            Example

            class ClassName {
                public function doSomething($user_name) {
                }
            }

            Source

            The parameter $Thread is not named in camelCase.
            Open

                public function setThread(Thread $Thread) {
                    if (!$this->thread instanceof Thread || !filter_var($this->thread->id, FILTER_VALIDATE_INT)) {
                        $this->thread = $Thread;
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            CamelCaseParameterName

            Since: 0.2

            It is considered best practice to use the camelCase notation to name parameters.

            Example

            class ClassName {
                public function doSomething($user_name) {
                }
            }

            Source

            The parameter $reputation_type_id is not named in camelCase.
            Open

                public function addReputationMarker($reputation_type_id = false) {
                    if (!filter_var($reputation_type_id, FILTER_VALIDATE_INT)) {
                        throw new Exception("Cannot add a reputation marker to this post because the supplied type ID (\$reputation_type_id) is not valid");
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            CamelCaseParameterName

            Since: 0.2

            It is considered best practice to use the camelCase notation to name parameters.

            Example

            class ClassName {
                public function doSomething($user_name) {
                }
            }

            Source

            The parameter $User is not named in camelCase.
            Open

                public function setAuthor(User $User) {
                    if (!$this->Author instanceof User) {
                        $this->Author = $User;
                    }
                    
            Severity: Minor
            Found in lib/Forums/Post.php by phpmd

            CamelCaseParameterName

            Since: 0.2

            It is considered best practice to use the camelCase notation to name parameters.

            Example

            class ClassName {
                public function doSomething($user_name) {
                }
            }

            Source

            Function closing brace must go on the next line following the body; found 1 blank lines before brace
            Open

                }
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Each PHP statement must be on a line by itself
            Open

                    unset($CurrentPost); unset($dataArray); unset($query);
            Severity: Minor
            Found in lib/Forums/Post.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/Forums/Post.php by phpcodesniffer

            Each PHP statement must be on a line by itself
            Open

                    unset($CurrentPost); unset($dataArray); unset($query);
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Only one argument is allowed per line in a multi-line function call
            Open

                        $this->thread->url, $this->thread->title, $this->thread->id,
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Only one argument is allowed per line in a multi-line function call
            Open

                        $this->thread->forum->url, $this->thread->forum->name, $this->thread->forum->id,
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Only one argument is allowed per line in a multi-line function call
            Open

                        $this->thread->url, $this->thread->title, $this->thread->id,
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Only one argument is allowed per line in a multi-line function call
            Open

                        $this->thread->forum->url, $this->thread->forum->name, $this->thread->forum->id,
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Only one argument is allowed per line in a multi-line function call
            Open

                        $Staff->url, $Staff->username, $Staff->id
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Only one argument is allowed per line in a multi-line function call
            Open

                        $Staff->url, $Staff->username, $Staff->id
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            Opening parenthesis of a multi-line function call must be the last content on the line
            Open

                    $string = sprintf("From topic [url=%s]%s[/url] (#%d), forum [url=%s]%s[/url] (#%d), post #%d, deleted by [url=%s]%s[/url] (uid %d)\n\n", 
            Severity: Minor
            Found in lib/Forums/Post.php by phpcodesniffer

            There are no issues that match your filters.

            Category
            Status