railpage/railpagecore

View on GitHub
lib/Images/Competition.php

Summary

Maintainability
F
1 wk
Test Coverage

File Competition.php has 654 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Photo competition!
 * @since Version 3.9.1
Severity: Major
Found in lib/Images/Competition.php - About 1 day to fix

    Competition has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Competition extends AppCore {
        
        /**
         * Registry key
         * @since Version 3.10.0
    Severity: Minor
    Found in lib/Images/Competition.php - About 3 hrs to fix

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

      class Competition extends AppCore {
          
          /**
           * Registry key
           * @since Version 3.10.0
      Severity: Minor
      Found in lib/Images/Competition.php by phpmd

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

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

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

          private function validate() {
              if (empty($this->title)) {
                  throw new Exception("Competition title cannot be empty");
              }
              
      Severity: Major
      Found in lib/Images/Competition.php - About 2 hrs to fix

        Function getWinningPhoto has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getWinningPhoto() {
                
                if ($this->VotingDateClose >= new DateTime) {
                    return false;
                }
        Severity: Minor
        Found in lib/Images/Competition.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 getArray has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getArray() {
                //$now = new DateTime;
                
                $voting_open = Utility\CompetitionUtility::isVotingWindowOpen($this);
                $submissions_open = Utility\CompetitionUtility::isSubmissionWindowOpen($this);
        Severity: Minor
        Found in lib/Images/Competition.php - About 1 hr to fix

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

              public function commit() {
                  
                  $this->validate(); 
                  
                  $data = array(
          Severity: Minor
          Found in lib/Images/Competition.php - About 1 hr to fix

            Method getWinningPhoto has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getWinningPhoto() {
                    
                    if ($this->VotingDateClose >= new DateTime) {
                        return false;
                    }
            Severity: Minor
            Found in lib/Images/Competition.php - About 1 hr to fix

              Method load has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function load() {
                      
                      $query = "SELECT * FROM image_competition WHERE id = ?";
                      
                      $row = $this->db->fetchRow($query, $this->id);
              Severity: Minor
              Found in lib/Images/Competition.php - About 1 hr to fix

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

                    public function getPhoto($image) {
                        
                        if (is_array($image) && !isset($image['status'])) {
                            $query = "SELECT * FROM image_competition_submissions WHERE competition_id = ? AND image_id = ? ORDER BY date_added DESC";
                            $params = array(
                Severity: Minor
                Found in lib/Images/Competition.php - About 1 hr to fix

                  Method canUserVote has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function canUserVote(User $userObject, $imageObject = null) {
                          if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                              return false;
                          }
                          
                  Severity: Minor
                  Found in lib/Images/Competition.php - About 1 hr to fix

                    Method notifySubmissionsOpen has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function notifySubmissionsOpen() {
                            
                            /**
                             * Return if we're not within the submissions bounds
                             */
                    Severity: Minor
                    Found in lib/Images/Competition.php - About 1 hr to fix

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

                          public function canUserVote(User $userObject, $imageObject = null) {
                              if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                  return false;
                              }
                              
                      Severity: Minor
                      Found in lib/Images/Competition.php - About 55 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                          public function commit() {
                              
                              $this->validate(); 
                              
                              $data = array(
                      Severity: Minor
                      Found in lib/Images/Competition.php - About 35 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Avoid too many return statements within this method.
                      Open

                                  return false;
                      Severity: Major
                      Found in lib/Images/Competition.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return true;
                        Severity: Major
                        Found in lib/Images/Competition.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return false;
                          Severity: Major
                          Found in lib/Images/Competition.php - About 30 mins to fix

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

                                private function load() {
                                    
                                    $query = "SELECT * FROM image_competition WHERE id = ?";
                                    
                                    $row = $this->db->fetchRow($query, $this->id);
                            Severity: Minor
                            Found in lib/Images/Competition.php - About 25 mins to fix

                            Cognitive Complexity

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

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

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

                            Further reading

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

                                public function canUserSubmitPhoto(User $userObject) {
                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        return false;
                                    }
                                    
                            Severity: Minor
                            Found in lib/Images/Competition.php - About 25 mins to fix

                            Cognitive Complexity

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

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

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

                            Further reading

                            The method canUserVote() has an NPath complexity of 576. The configured NPath complexity threshold is 200.
                            Open

                                public function canUserVote(User $userObject, $imageObject = null) {
                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        return false;
                                    }
                                    
                            Severity: Minor
                            Found in lib/Images/Competition.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 getWinningPhoto() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
                            Open

                                public function getWinningPhoto() {
                                    
                                    if ($this->VotingDateClose >= new DateTime) {
                                        return false;
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.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 class Competition has 1219 lines of code. Current threshold is 1000. Avoid really long classes.
                            Open

                            class Competition extends AppCore {
                                
                                /**
                                 * Registry key
                                 * @since Version 3.10.0
                            Severity: Minor
                            Found in lib/Images/Competition.php by phpmd

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

                                private function validate() {
                                    if (empty($this->title)) {
                                        throw new Exception("Competition title cannot be empty");
                                    }
                                    
                            Severity: Minor
                            Found in lib/Images/Competition.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 commit() has an NPath complexity of 320. The configured NPath complexity threshold is 200.
                            Open

                                public function commit() {
                                    
                                    $this->validate(); 
                                    
                                    $data = array(
                            Severity: Minor
                            Found in lib/Images/Competition.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 canUserVote() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function canUserVote(User $userObject, $imageObject = null) {
                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        return false;
                                    }
                                    
                            Severity: Minor
                            Found in lib/Images/Competition.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 validate() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                            Open

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

                                public function getWinningPhoto() {
                                    
                                    if ($this->VotingDateClose >= new DateTime) {
                                        return false;
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.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 11. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function commit() {
                                    
                                    $this->validate(); 
                                    
                                    $data = array(
                            Severity: Minor
                            Found in lib/Images/Competition.php by phpmd

                            CyclomaticComplexity

                            Since: 0.1

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

                            Example

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

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

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

                            class Competition extends AppCore {
                                
                                /**
                                 * Registry key
                                 * @since Version 3.10.0
                            Severity: Minor
                            Found in lib/Images/Competition.php by phpmd

                            CouplingBetweenObjects

                            Since: 1.1.0

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

                            Example

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

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

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

                                public function getPhotosAsArray($force = null) {
                                    $key = sprintf("railpage:comp=%d;images.array", $this->id);
                                    
                                    $this->Memcached = AppCore::getMemcached();
                                    
                            Severity: Minor
                            Found in lib/Images/Competition.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 '154', column '13').
                            Open

                                public function __construct($id = null) {
                                    parent::__construct(); 
                                    
                                    $this->Module = new Module("images.competitions"); 
                                    $this->Module->namespace = sprintf("%s.competition", $this->Module->namespace); 
                            Severity: Minor
                            Found in lib/Images/Competition.php by phpmd

                            IfStatementAssignment

                            Since: 2.7.0

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

                            Example

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

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

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

                                        "submissions" => array(
                                            "status" => $submissions_open,
                                            "open" => array(
                                                "absolute" => $this->SubmissionsDateOpen->format("Y-m-d H:i:s"),
                                                "formatted" => $this->SubmissionsDateOpen->format("F jS"),
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 4 hrs to fix
                            lib/Images/Competition.php on lines 912..924

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

                            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

                                        "voting" => array(
                                            "status" => $voting_open,
                                            "open" => array(
                                                "absolute" => $this->VotingDateOpen->format("Y-m-d H:i:s"),
                                                "formatted" => $this->VotingDateOpen->format("F jS"),
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 4 hrs to fix
                            lib/Images/Competition.php on lines 925..937

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

                            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

                                    $max_votes = isset($this->meta['maxvotes']) && filter_var($this->meta['maxvotes'], FILTER_VALIDATE_INT) ? $this->meta['maxvotes'] : Competitions::MAX_VOTES_PER_USER;
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 2 hrs to fix
                            lib/Images/Competition.php on lines 487..487

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

                            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

                                    $max_votes = isset($this->meta['maxvotes']) && filter_var($this->meta['maxvotes'], FILTER_VALIDATE_INT) ? $this->meta['maxvotes'] : Competitions::MAX_VOTES_PER_USER;
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 2 hrs to fix
                            lib/Images/Competition.php on lines 571..571

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

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                                        $where = array(
                                            "id = ?" => $this->id
                                        );
                                        
                            Severity: Major
                            Found in lib/Images/Competition.php and 4 other locations - About 2 hrs to fix
                            lib/Downloads/Category.php on lines 170..176
                            lib/Gallery/Album.php on lines 494..497
                            lib/Images/Camera.php on lines 192..196
                            lib/Images/Collection.php on lines 219..222

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

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                        $this->db->insert("image_competition", $data);
                                        $this->id = $this->db->lastInsertId(); 
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 4 other locations - About 1 hr to fix
                            lib/Downloads/Category.php on lines 178..181
                            lib/Gallery/Album.php on lines 500..503
                            lib/Images/Camera.php on lines 198..201
                            lib/Images/Collection.php on lines 224..227

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

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (empty($this->status) || !filter_var($this->status, FILTER_VALIDATE_INT)) {
                                        $this->status = Competitions::STATUS_CLOSED;
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 2 other locations - About 1 hr to fix
                            lib/Glossary/Entry.php on lines 274..276
                            lib/SiteMessages/SiteMessage.php on lines 134..136

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 42.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->VotingDateClose->format("H:i:s") === "00:00:00") {
                                        $this->VotingDateClose = new DateTime($this->VotingDateClose->format("Y-m-d 23:59:59"));
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 1 hr to fix
                            lib/Images/Competition.php on lines 199..201
                            lib/Images/Competition.php on lines 286..288
                            lib/Images/Competition.php on lines 290..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 41.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->SubmissionsDateClose->format("H:i:s") === "00:00:00") {
                                        $this->SubmissionsDateClose = new DateTime($this->SubmissionsDateClose->format("Y-m-d 23:59:59"));
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 1 hr to fix
                            lib/Images/Competition.php on lines 195..197
                            lib/Images/Competition.php on lines 286..288
                            lib/Images/Competition.php on lines 290..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 41.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->VotingDateClose->format("H:i:s") === "00:00:00") {
                                        $this->VotingDateClose = new DateTime($this->VotingDateClose->format("Y-m-d 23:59:59"));
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 1 hr to fix
                            lib/Images/Competition.php on lines 195..197
                            lib/Images/Competition.php on lines 199..201
                            lib/Images/Competition.php on lines 290..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 41.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->SubmissionsDateClose->format("H:i:s") === "00:00:00") {
                                        $this->SubmissionsDateClose = new DateTime($this->SubmissionsDateClose->format("Y-m-d 23:59:59"));
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 1 hr to fix
                            lib/Images/Competition.php on lines 195..197
                            lib/Images/Competition.php on lines 199..201
                            lib/Images/Competition.php on lines 286..288

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 41.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        if ($num_votes === false) {
                                            $num_votes = count($photo['votes']); 
                                            $tied[] = $photo;
                                            continue;
                                        }
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 1 hr to fix
                            lib/Images/Utility/CompetitionUtility.php on lines 615..619

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

                            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

                                    $Photo->Meta = isset($image['meta']) ? json_decode($image['meta'], true) : [];
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 1 hr to fix
                            lib/Forums/Thread.php on lines 250..250
                            lib/Locos/Locomotive.php on lines 461..461
                            lib/Railcams/Camera.php on lines 268..268

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

                            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 (isset($image['dateadded']['absolute'])) {
                                        $Photo->DateAdded = new DateTime($image['dateadded']['absolute']);
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 1 hr to fix
                            lib/Gallery/Utility/ImageUtility.php on lines 116..118

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 39.

                            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

                                    $body = sprintf(
                                        "Hi [username],\n\nWe wanted to let you know that a new photo competition, <a href='%s'>%s</a>, is open for submissions until %s.\n\nYou've received this email because you've participated in a previous photo competition.\n\nThanks\nThe Railpage team.",
                                        $this->url->email, 
                                        $this->title, 
                                        $this->SubmissionsDateClose->format("F jS")
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 1 hr to fix
                            lib/Images/Competition.php on lines 1215..1220

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 37.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $body = sprintf(
                                        "Hi [username],\n\nWe wanted to let you know that the <a href='%s'>%s</a> photo competition is open for voting until %s.\n\nYou've received this email because you've participated in a previous photo competition.\n\nThanks\nThe Railpage team.",
                                        $this->url->email, 
                                        $this->title, 
                                        $this->VotingDateClose->format("F jS")
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 1 hr to fix
                            lib/Images/Competition.php on lines 1167..1172

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 37.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    foreach ($this->db->fetchAll($query, $params) as $day) {
                                        $votes[$day['day']] = $day['votes'];
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 1 hr to fix
                            lib/Module.php on lines 285..287

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 36.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        $return->url = new Url(sprintf("/gallery?mode=competition.image&comp_id=%d&image_id=%d", $this->id, $imageObject->id));
                            Severity: Major
                            Found in lib/Images/Competition.php and 2 other locations - About 1 hr to fix
                            lib/Events/Month.php on lines 85..85
                            lib/Forums/Post.php on lines 748..748

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

                                    if (!filter_var($imageObject->id, FILTER_VALIDATE_INT)) {
                                        throw new Exception("The supplied image appears to be invalid...");
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 24 other locations - About 1 hr to fix
                            lib/Downloads/Download.php on lines 313..315
                            lib/Events/Event.php on lines 425..427
                            lib/Events/Events.php on lines 130..132
                            lib/Images/Competition.php on lines 624..626
                            lib/Images/Competition.php on lines 654..656
                            lib/Images/Competition.php on lines 823..825
                            lib/Images/Favourites.php on lines 112..114
                            lib/Images/Favourites.php on lines 178..180
                            lib/Jobs/Classification.php on lines 80..82
                            lib/Locations/Location.php on lines 406..408
                            lib/Locations/Location.php on lines 410..412
                            lib/Locos/Locomotive.php on lines 622..624
                            lib/Locos/Locomotive.php on lines 626..628
                            lib/Locos/Locomotive.php on lines 897..899
                            lib/News/Article.php on lines 361..363
                            lib/News/Article.php on lines 834..836
                            lib/Newsletters/Newsletters.php on lines 135..137
                            lib/PrivateMessages/Message.php on lines 244..246
                            lib/PrivateMessages/Message.php on lines 452..454
                            lib/Railcams/Photo.php on lines 330..332
                            lib/Railcams/Storage.php on lines 224..226
                            lib/Sightings/Sighting.php on lines 133..135
                            lib/Users/Group.php on lines 236..238
                            lib/Warnings/Warning.php on lines 209..211

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 32.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        throw new Exception("Invalid user ID");
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 24 other locations - About 1 hr to fix
                            lib/Downloads/Download.php on lines 313..315
                            lib/Events/Event.php on lines 425..427
                            lib/Events/Events.php on lines 130..132
                            lib/Images/Competition.php on lines 654..656
                            lib/Images/Competition.php on lines 823..825
                            lib/Images/Competition.php on lines 860..862
                            lib/Images/Favourites.php on lines 112..114
                            lib/Images/Favourites.php on lines 178..180
                            lib/Jobs/Classification.php on lines 80..82
                            lib/Locations/Location.php on lines 406..408
                            lib/Locations/Location.php on lines 410..412
                            lib/Locos/Locomotive.php on lines 622..624
                            lib/Locos/Locomotive.php on lines 626..628
                            lib/Locos/Locomotive.php on lines 897..899
                            lib/News/Article.php on lines 361..363
                            lib/News/Article.php on lines 834..836
                            lib/Newsletters/Newsletters.php on lines 135..137
                            lib/PrivateMessages/Message.php on lines 244..246
                            lib/PrivateMessages/Message.php on lines 452..454
                            lib/Railcams/Photo.php on lines 330..332
                            lib/Railcams/Storage.php on lines 224..226
                            lib/Sightings/Sighting.php on lines 133..135
                            lib/Users/Group.php on lines 236..238
                            lib/Warnings/Warning.php on lines 209..211

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 32.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!filter_var($imageObject->id, FILTER_VALIDATE_INT)) {
                                        throw new Exception("The supplied image appears to be invalid...");
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 24 other locations - About 1 hr to fix
                            lib/Downloads/Download.php on lines 313..315
                            lib/Events/Event.php on lines 425..427
                            lib/Events/Events.php on lines 130..132
                            lib/Images/Competition.php on lines 624..626
                            lib/Images/Competition.php on lines 654..656
                            lib/Images/Competition.php on lines 860..862
                            lib/Images/Favourites.php on lines 112..114
                            lib/Images/Favourites.php on lines 178..180
                            lib/Jobs/Classification.php on lines 80..82
                            lib/Locations/Location.php on lines 406..408
                            lib/Locations/Location.php on lines 410..412
                            lib/Locos/Locomotive.php on lines 622..624
                            lib/Locos/Locomotive.php on lines 626..628
                            lib/Locos/Locomotive.php on lines 897..899
                            lib/News/Article.php on lines 361..363
                            lib/News/Article.php on lines 834..836
                            lib/Newsletters/Newsletters.php on lines 135..137
                            lib/PrivateMessages/Message.php on lines 244..246
                            lib/PrivateMessages/Message.php on lines 452..454
                            lib/Railcams/Photo.php on lines 330..332
                            lib/Railcams/Storage.php on lines 224..226
                            lib/Sightings/Sighting.php on lines 133..135
                            lib/Users/Group.php on lines 236..238
                            lib/Warnings/Warning.php on lines 209..211

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 32.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        throw new Exception("Invalid user ID");
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 24 other locations - About 1 hr to fix
                            lib/Downloads/Download.php on lines 313..315
                            lib/Events/Event.php on lines 425..427
                            lib/Events/Events.php on lines 130..132
                            lib/Images/Competition.php on lines 624..626
                            lib/Images/Competition.php on lines 823..825
                            lib/Images/Competition.php on lines 860..862
                            lib/Images/Favourites.php on lines 112..114
                            lib/Images/Favourites.php on lines 178..180
                            lib/Jobs/Classification.php on lines 80..82
                            lib/Locations/Location.php on lines 406..408
                            lib/Locations/Location.php on lines 410..412
                            lib/Locos/Locomotive.php on lines 622..624
                            lib/Locos/Locomotive.php on lines 626..628
                            lib/Locos/Locomotive.php on lines 897..899
                            lib/News/Article.php on lines 361..363
                            lib/News/Article.php on lines 834..836
                            lib/Newsletters/Newsletters.php on lines 135..137
                            lib/PrivateMessages/Message.php on lines 244..246
                            lib/PrivateMessages/Message.php on lines 452..454
                            lib/Railcams/Photo.php on lines 330..332
                            lib/Railcams/Storage.php on lines 224..226
                            lib/Sightings/Sighting.php on lines 133..135
                            lib/Users/Group.php on lines 236..238
                            lib/Warnings/Warning.php on lines 209..211

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 32.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        "url" => isset($this->url) && $this->url instanceof Url ? $this->url->getURLs() : array(),
                            Severity: Major
                            Found in lib/Images/Competition.php and 1 other location - About 1 hr to fix
                            lib/Newsletters/Newsletter.php on lines 247..247

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 32.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $Photo->url = new Url(sprintf("%s/%d", $this->url->url, $Photo->Image->id));
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 1 hr to fix
                            lib/Warnings/Warning.php on lines 218..224

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 30.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        return false;
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 13 other locations - About 55 mins to fix
                            lib/Forums/Thread.php on lines 763..765
                            lib/Images/Competition.php on lines 588..590
                            lib/Images/Screener.php on lines 363..365
                            lib/Links/Link.php on lines 108..110
                            lib/Links/Link.php on lines 210..212
                            lib/Links/Link.php on lines 230..232
                            lib/Users/User.php on lines 1009..1011
                            lib/Users/User.php on lines 1489..1491
                            lib/Users/User.php on lines 1520..1522
                            lib/Users/User.php on lines 1682..1684
                            lib/Users/User.php on lines 1708..1710
                            lib/Users/User.php on lines 1751..1753
                            lib/Users/User.php on lines 1930..1932

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 28.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        return false;
                                    }
                            Severity: Major
                            Found in lib/Images/Competition.php and 13 other locations - About 55 mins to fix
                            lib/Forums/Thread.php on lines 763..765
                            lib/Images/Competition.php on lines 536..538
                            lib/Images/Screener.php on lines 363..365
                            lib/Links/Link.php on lines 108..110
                            lib/Links/Link.php on lines 210..212
                            lib/Links/Link.php on lines 230..232
                            lib/Users/User.php on lines 1009..1011
                            lib/Users/User.php on lines 1489..1491
                            lib/Users/User.php on lines 1520..1522
                            lib/Users/User.php on lines 1682..1684
                            lib/Users/User.php on lines 1708..1710
                            lib/Users/User.php on lines 1751..1753
                            lib/Users/User.php on lines 1930..1932

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 28.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        $return->url->reject = sprintf("/gallery?mode=competition.photo.manage&comp_id=%d&image_id=%d&action=reject", $this->id, $imageObject->id);
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 55 mins to fix
                            lib/Images/Camera.php on lines 132..132
                            lib/Images/Competition.php on lines 792..792
                            lib/Locations/Location.php on lines 365..365

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 28.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        $return->url->approve = sprintf("/gallery?mode=competition.photo.manage&comp_id=%d&image_id=%d&action=approve", $this->id, $imageObject->id);
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 55 mins to fix
                            lib/Images/Camera.php on lines 132..132
                            lib/Images/Competition.php on lines 793..793
                            lib/Locations/Location.php on lines 365..365

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 28.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $lookup = array(
                                        "voting_date_open" => "VotingDateOpen",
                                        "voting_date_close" => "VotingDateClose",
                                        "submissions_date_open" => "SubmissionsDateOpen",
                                        "submissions_date_close" => "SubmissionsDateClose"
                            Severity: Major
                            Found in lib/Images/Competition.php and 2 other locations - About 55 mins to fix
                            lib/Images/Provider/FiveHundredPx.php on lines 148..153
                            lib/Images/Provider/Flickr.php on lines 156..161

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 28.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                public function getVotes() {
                                    $query = "SELECT v.*, u.username FROM image_competition_votes AS v LEFT JOIN nuke_users AS u ON u.user_id = v.user_id WHERE v.competition_id = ? ORDER BY v.date DESC";
                                    
                                    return $this->db->fetchAll($query, $this->id);
                                }
                            Severity: Major
                            Found in lib/Images/Competition.php and 2 other locations - About 50 mins to fix
                            lib/Images/Camera.php on lines 248..259
                            lib/Locos/Locomotive.php on lines 787..795

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 27.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->VotingDateClose <= new DateTime) {
                                        $this->status = Competitions::STATUS_CLOSED;
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 50 mins to fix
                            lib/Images/Competition.php on lines 278..280

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 27.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->SubmissionsDateOpen <= new DateTime) {
                                        $this->status = Competitions::STATUS_OPEN;
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 50 mins to fix
                            lib/Images/Competition.php on lines 282..284

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

                                        $return->Meta = json_decode($row['meta'], true);
                            Severity: Major
                            Found in lib/Images/Competition.php and 22 other locations - About 45 mins to fix
                            lib/Assets/Asset.php on lines 150..150
                            lib/Chronicle/Entry.php on lines 156..156
                            lib/Events/Event.php on lines 207..207
                            lib/Events/EventDate.php on lines 154..154
                            lib/Gallery/Album.php on lines 136..136
                            lib/Gallery/Image.php on lines 208..208
                            lib/Ideas/Idea.php on lines 166..166
                            lib/Images/Camera.php on lines 116..116
                            lib/Images/Competition.php on lines 180..180
                            lib/Locos/Date.php on lines 158..158
                            lib/Locos/LocoClass.php on lines 417..417
                            lib/News/Feed.php on lines 234..234
                            lib/News/Feed.php on lines 235..235
                            lib/Newsletters/Newsletter.php on lines 128..128
                            lib/Newsletters/Newsletter.php on lines 129..129
                            lib/Railcams/Storage.php on lines 201..201
                            lib/Sightings/Sighting.php on lines 161..161
                            lib/Sightings/Sighting.php on lines 162..162
                            lib/Timetables/Train.php on lines 174..174
                            lib/Users/Group.php on lines 168..168
                            lib/Users/User.php on lines 1068..1068
                            lib/SiteEvent.php on lines 135..135

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

                                    $this->meta = json_decode($row['meta'], true);
                            Severity: Major
                            Found in lib/Images/Competition.php and 22 other locations - About 45 mins to fix
                            lib/Assets/Asset.php on lines 150..150
                            lib/Chronicle/Entry.php on lines 156..156
                            lib/Events/Event.php on lines 207..207
                            lib/Events/EventDate.php on lines 154..154
                            lib/Gallery/Album.php on lines 136..136
                            lib/Gallery/Image.php on lines 208..208
                            lib/Ideas/Idea.php on lines 166..166
                            lib/Images/Camera.php on lines 116..116
                            lib/Images/Competition.php on lines 790..790
                            lib/Locos/Date.php on lines 158..158
                            lib/Locos/LocoClass.php on lines 417..417
                            lib/News/Feed.php on lines 234..234
                            lib/News/Feed.php on lines 235..235
                            lib/Newsletters/Newsletter.php on lines 128..128
                            lib/Newsletters/Newsletter.php on lines 129..129
                            lib/Railcams/Storage.php on lines 201..201
                            lib/Sightings/Sighting.php on lines 161..161
                            lib/Sightings/Sighting.php on lines 162..162
                            lib/Timetables/Train.php on lines 174..174
                            lib/Users/Group.php on lines 168..168
                            lib/Users/User.php on lines 1068..1068
                            lib/SiteEvent.php on lines 135..135

                            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

                                        "voting_date_close" => $this->VotingDateClose instanceof DateTime ? $this->VotingDateClose->format("Y-m-d H:i:s") : "0000-00-00 00:00:00",
                            Severity: Major
                            Found in lib/Images/Competition.php and 7 other locations - About 45 mins to fix
                            lib/Images/Competition.php on lines 314..314
                            lib/Images/Competition.php on lines 316..316
                            lib/Images/Competition.php on lines 317..317
                            lib/Notifications/Notification.php on lines 225..225
                            lib/Reminders/Reminder.php on lines 224..224
                            lib/SiteMessages/SiteMessage.php on lines 158..158
                            lib/SiteMessages/SiteMessage.php on lines 159..159

                            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

                                        "voting_date_open" => $this->VotingDateOpen instanceof DateTime ? $this->VotingDateOpen->format("Y-m-d H:i:s") : "0000-00-00 00:00:00",
                            Severity: Major
                            Found in lib/Images/Competition.php and 7 other locations - About 45 mins to fix
                            lib/Images/Competition.php on lines 315..315
                            lib/Images/Competition.php on lines 316..316
                            lib/Images/Competition.php on lines 317..317
                            lib/Notifications/Notification.php on lines 225..225
                            lib/Reminders/Reminder.php on lines 224..224
                            lib/SiteMessages/SiteMessage.php on lines 158..158
                            lib/SiteMessages/SiteMessage.php on lines 159..159

                            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

                                        "submissions_date_close" => $this->SubmissionsDateClose instanceof DateTime ? $this->SubmissionsDateClose->format("Y-m-d H:i:s") : "0000-00-00 00:00:00",
                            Severity: Major
                            Found in lib/Images/Competition.php and 7 other locations - About 45 mins to fix
                            lib/Images/Competition.php on lines 314..314
                            lib/Images/Competition.php on lines 315..315
                            lib/Images/Competition.php on lines 316..316
                            lib/Notifications/Notification.php on lines 225..225
                            lib/Reminders/Reminder.php on lines 224..224
                            lib/SiteMessages/SiteMessage.php on lines 158..158
                            lib/SiteMessages/SiteMessage.php on lines 159..159

                            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

                                        "submissions_date_open" => $this->SubmissionsDateOpen instanceof DateTime ? $this->SubmissionsDateOpen->format("Y-m-d H:i:s") : "0000-00-00 00:00:00",
                            Severity: Major
                            Found in lib/Images/Competition.php and 7 other locations - About 45 mins to fix
                            lib/Images/Competition.php on lines 314..314
                            lib/Images/Competition.php on lines 315..315
                            lib/Images/Competition.php on lines 317..317
                            lib/Notifications/Notification.php on lines 225..225
                            lib/Reminders/Reminder.php on lines 224..224
                            lib/SiteMessages/SiteMessage.php on lines 158..158
                            lib/SiteMessages/SiteMessage.php on lines 159..159

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

                                    $this->Module->namespace = sprintf("%s.competition", $this->Module->namespace); 
                            Severity: Major
                            Found in lib/Images/Competition.php and 22 other locations - About 45 mins to fix
                            lib/Chronicle/Chronicle.php on lines 42..42
                            lib/Chronicle/Chronicle.php on lines 43..43
                            lib/Chronicle/Chronicle.php on lines 44..44
                            lib/Chronicle/Chronicle.php on lines 45..45
                            lib/Chronicle/Chronicle.php on lines 46..46
                            lib/Jobs/Job.php on lines 196..196
                            lib/Locos/Locomotive.php on lines 432..432
                            lib/Locos/Locomotive.php on lines 433..433
                            lib/Railcams/Camera.php on lines 258..258
                            lib/Railcams/Camera.php on lines 259..259
                            lib/Railcams/Camera.php on lines 261..261
                            lib/Railcams/Camera.php on lines 262..262
                            lib/Railcams/Camera.php on lines 263..263
                            lib/Railcams/Camera.php on lines 264..264
                            lib/Railcams/Camera.php on lines 266..266
                            lib/Timetables/Point.php on lines 115..115
                            lib/Timetables/Timetables.php on lines 41..41
                            lib/Timetables/Timetables.php on lines 42..42
                            lib/Timetables/Timetables.php on lines 43..43
                            lib/Timetables/Train.php on lines 183..183
                            lib/Users/Group.php on lines 222..222
                            lib/Users/Group.php on lines 223..223

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 25.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    return $this->db->fetchAll($query, array($this->id, $imageObject->id));
                            Severity: Major
                            Found in lib/Images/Competition.php and 2 other locations - About 40 mins to fix
                            lib/Locos/Locomotive.php on lines 829..838
                            lib/Locos/Manufacturer.php on lines 192..196

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 24.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $Photo->url->vote = sprintf("%s/vote", $Photo->url);
                            Severity: Major
                            Found in lib/Images/Competition.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/Forums/Post.php on lines 756..756
                            lib/Ideas/Idea.php on lines 207..207
                            lib/Images/Camera.php on lines 131..131
                            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 4 locations. Consider refactoring.
                            Open

                                    $params = array(
                                        $this->id,
                                        $userObject->id,
                                        $imageObject->id
                                    );
                            Severity: Major
                            Found in lib/Images/Competition.php and 3 other locations - About 40 mins to fix
                            lib/Forums/Forum.php on lines 563..567
                            lib/Forums/Thread.php on lines 536..540
                            lib/News/Article.php on lines 1156..1160

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 23.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->SubmissionsDateClose > $this->VotingDateOpen) {
                                        throw new Exception("SubmissionsDateClose is greater than VotingDateOpen");
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 2 other locations - About 40 mins to fix
                            lib/Images/Competition.php on lines 266..268
                            lib/Images/Competition.php on lines 270..272

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 23.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->VotingDateOpen > $this->VotingDateClose) {
                                        throw new Exception("VotingDateOpen is greater than VotingDateClose");
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 2 other locations - About 40 mins to fix
                            lib/Images/Competition.php on lines 270..272
                            lib/Images/Competition.php on lines 274..276

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 23.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->SubmissionsDateOpen > $this->SubmissionsDateClose) {
                                        throw new Exception("SubmissionsDateOpen is greater than SubmissionsDateClose");
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 2 other locations - About 40 mins to fix
                            lib/Images/Competition.php on lines 266..268
                            lib/Images/Competition.php on lines 274..276

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

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

                            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

                                    $regkey = sprintf(self::CACHE_KEY, $this->id);
                            Severity: Major
                            Found in lib/Images/Competition.php and 7 other locations - About 35 mins to fix
                            lib/Forums/Post.php on lines 626..626
                            lib/Forums/Post.php on lines 660..660
                            lib/Images/Camera.php on lines 207..207
                            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

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

                                    $Config->set("image.competition.suggestedthemes", json_encode($themes), "Photo competition themes"); 
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 35 mins to fix
                            lib/Images/Competitions.php on lines 260..260

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 22.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->db->fetchAll($query, $where)) {
                                        return false;
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 35 mins to fix
                            lib/Images/Competition.php on lines 685..687

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 22.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->db->fetchAll($query, $where)) {
                                        return true;
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 35 mins to fix
                            lib/Images/Competition.php on lines 606..608

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 22.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        if (count($photo['votes']) < $num_votes) {
                                            continue;
                                        }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 30 mins to fix
                            lib/Images/Utility/CompetitionUtility.php on lines 625..627

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 21.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $this->setAuthor(UserFactory::CreateUser($row['author']));
                            Severity: Major
                            Found in lib/Images/Competition.php and 8 other locations - About 30 mins to fix
                            lib/Events/Event.php on lines 215..215
                            lib/Events/EventDate.php on lines 163..163
                            lib/Glossary/Entry.php on lines 170..170
                            lib/Ideas/Idea.php on lines 172..172
                            lib/Images/Collection.php on lines 137..137
                            lib/Locations/Correction.php on lines 144..144
                            lib/PrivateMessages/Message.php on lines 289..289
                            lib/PrivateMessages/Message.php on lines 290..290

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 20.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $dates = [ "VotingDateOpen", "VotingDateClose", "SubmissionsDateOpen", "SubmissionsDateClose" ];
                            Severity: Major
                            Found in lib/Images/Competition.php and 8 other locations - About 30 mins to fix
                            lib/Downloads/Base.php on lines 141..146
                            lib/Formatting/BbcodeUtility.php on lines 111..116
                            lib/Formatting/MakeClickable.php on lines 256..256
                            lib/Forums/Forum.php on lines 294..299
                            lib/Gallery/Utility/CreateSizes.php on lines 153..153
                            lib/Images/Utility/Tagger.php on lines 131..136
                            lib/Locos/Locomotive.php on lines 634..634
                            lib/Locos/Locomotive.php on lines 646..646

                            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

                                    $Photo->status = intval($image['status']); 
                            Severity: Major
                            Found in lib/Images/Competition.php and 7 other locations - About 30 mins to fix
                            lib/Forums/Post.php on lines 314..314
                            lib/Forums/Post.php on lines 315..315
                            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 2 locations. Consider refactoring.
                            Open

                                    if (!Utility\CompetitionUtility::isVotingWindowOpen($this)) {
                                        return false;
                                    }
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 30 mins to fix
                            lib/Locos/Utility/CoverImageUtility.php on lines 79..81

                            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

                                        $num = count($this->db->fetchAll($query, $proposal));
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 30 mins to fix
                            lib/Images/Competition.php on lines 812..812

                            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

                                    return count($this->db->fetchAll($query, $where)); 
                            Severity: Minor
                            Found in lib/Images/Competition.php and 1 other location - About 30 mins to fix
                            lib/Images/Competition.php on lines 245..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 20.

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

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

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

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

                            Refactorings

                            Further Reading

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

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

                            Blank line found at end of control structure
                            Open

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

                            There are no issues that match your filters.

                            Category
                            Status