railpage/railpagecore

View on GitHub
lib/Images/Image.php

Summary

Maintainability
F
2 wks
Test Coverage

File Image.php has 823 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Store and fetch image data from our local database
 *
Severity: Major
Found in lib/Images/Image.php - About 1 day to fix

    Function populate has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
    Open

        public function populate($force = false, $option = null) {
    
            if ($force === false && !$this->isStale()) {
                return $this;
            }
    Severity: Minor
    Found in lib/Images/Image.php - About 1 day 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 findObjects has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findObjects($namespace = null, $force = false) {
    
            if (is_null($namespace)) {
                throw new Exception("Parameter 1 (namespace) cannot be empty");
            }
    Severity: Minor
    Found in lib/Images/Image.php - About 1 day 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 populate has 239 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function populate($force = false, $option = null) {
    
            if ($force === false && !$this->isStale()) {
                return $this;
            }
    Severity: Major
    Found in lib/Images/Image.php - About 1 day to fix

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

          private function load($option = null) {
      
              Debug::RecordInstance();
      
              $this->mckey = sprintf("railpage:image=%d", $this->id);
      Severity: Minor
      Found in lib/Images/Image.php - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method findObjects has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function findObjects($namespace = null, $force = false) {
      
              if (is_null($namespace)) {
                  throw new Exception("Parameter 1 (namespace) cannot be empty");
              }
      Severity: Major
      Found in lib/Images/Image.php - About 3 hrs to fix

        The class Image has 13 public methods. Consider refactoring Image to keep number of public methods under 10.
        Open

        class Image extends AppCore {
        
            /**
             * Max age of data before it requires refreshing
             */
        Severity: Minor
        Found in lib/Images/Image.php by phpmd

        TooManyPublicMethods

        Since: 0.1

        A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

        By default it ignores methods starting with 'get' or 'set'.

        Example

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

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

        class Image extends AppCore {
        
            /**
             * Max age of data before it requires refreshing
             */
        Severity: Minor
        Found in lib/Images/Image.php by phpmd

        Image has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Image extends AppCore {
        
            /**
             * Max age of data before it requires refreshing
             */
        Severity: Minor
        Found in lib/Images/Image.php - About 2 hrs to fix

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

              private function load($option = null) {
          
                  Debug::RecordInstance();
          
                  $this->mckey = sprintf("railpage:image=%d", $this->id);
          Severity: Major
          Found in lib/Images/Image.php - About 2 hrs to fix

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

                private function cacheGeoData() {
            
                    if (!$this->Place instanceof Place) {
                        return $this;
                    }
            Severity: Major
            Found in lib/Images/Image.php - About 2 hrs to fix

              Method getJSON has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getJSON() {
              
                      if (isset( $this->author )) {
                          $author = clone $this->author;
              
              Severity: Minor
              Found in lib/Images/Image.php - About 1 hr to fix

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

                    public function commit() {
                
                        $this->validate();
                
                        $user_id = isset( $this->author->User ) && $this->author->User instanceof User ? $this->author->User->id : 0;
                Severity: Minor
                Found in lib/Images/Image.php - About 1 hr to fix

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

                      private function cacheGeoData() {
                  
                          if (!$this->Place instanceof Place) {
                              return $this;
                          }
                  Severity: Minor
                  Found in lib/Images/Image.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 suggestLiveries has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function suggestLiveries() {
                  
                          $query = '
                              SELECT livery.livery_id AS id, livery.livery AS name, livery.photo_id
                              FROM loco_livery AS livery
                  Severity: Minor
                  Found in lib/Images/Image.php - About 1 hr to fix

                    The class Image has 21 fields. Consider redesigning Image to keep the number of fields under 15.
                    Open

                    class Image extends AppCore {
                    
                        /**
                         * Max age of data before it requires refreshing
                         */
                    Severity: Minor
                    Found in lib/Images/Image.php by phpmd

                    TooManyFields

                    Since: 0.1

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

                    Example

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

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

                    Consider simplifying this complex logical expression.
                    Open

                            if (( ( !isset( $row['title'] ) || empty( $row['title'] ) || is_null($row['title']) ) && !empty( $this->title ) ) ||
                                ( ( !isset( $row['description'] ) || empty( $row['description'] ) || is_null($row['description']) ) && !empty( $this->description ) )
                            ) {
                                $row['title'] = $this->title;
                                $row['description'] = $this->description;
                    Severity: Critical
                    Found in lib/Images/Image.php - About 1 hr to fix

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

                          public function getJSON() {
                      
                              if (isset( $this->author )) {
                                  $author = clone $this->author;
                      
                      Severity: Minor
                      Found in lib/Images/Image.php - About 45 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Avoid deeply nested control flow statements.
                      Open

                                                      if (!$LocoClass->hasCoverImage()) {
                                                          $LocoClass->setCoverImage($this);
                                                      }
                      Severity: Major
                      Found in lib/Images/Image.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                            if (!$Loco->hasCoverImage()) {
                                                                $Loco->setCoverImage($this);
                                                            }
                        Severity: Major
                        Found in lib/Images/Image.php - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                              if (!$Loco->Class->hasCoverImage()) {
                                                                  $Loco->Class->setCoverImage($this);
                                                              }
                          Severity: Major
                          Found in lib/Images/Image.php - About 45 mins to fix

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

                                public function populateFromArray($row) {
                            
                                    $this->provider = $row['provider'];
                                    $this->photo_id = $row['photo_id'];
                                    $this->Date = new DateTime($row['modified']);
                            Severity: Minor
                            Found in lib/Images/Image.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 load() has an NPath complexity of 22680. The configured NPath complexity threshold is 200.
                            Open

                                private function load($option = null) {
                            
                                    Debug::RecordInstance();
                            
                                    $this->mckey = sprintf("railpage:image=%d", $this->id);
                            Severity: Minor
                            Found in lib/Images/Image.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 findObjects() has 121 lines of code. Current threshold is set to 100. Avoid really long methods.
                            Open

                                public function findObjects($namespace = null, $force = false) {
                            
                                    if (is_null($namespace)) {
                                        throw new Exception("Parameter 1 (namespace) cannot be empty");
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            The class Image has 1505 lines of code. Current threshold is 1000. Avoid really long classes.
                            Open

                            class Image extends AppCore {
                            
                                /**
                                 * Max age of data before it requires refreshing
                                 */
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

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

                                private function load($option = null) {
                            
                                    Debug::RecordInstance();
                            
                                    $this->mckey = sprintf("railpage:image=%d", $this->id);
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            The method populate() has an NPath complexity of 293129856. The configured NPath complexity threshold is 200.
                            Open

                                public function populate($force = false, $option = null) {
                            
                                    if ($force === false && !$this->isStale()) {
                                        return $this;
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.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 findObjects() has an NPath complexity of 1552. The configured NPath complexity threshold is 200.
                            Open

                                public function findObjects($namespace = null, $force = false) {
                            
                                    if (is_null($namespace)) {
                                        throw new Exception("Parameter 1 (namespace) cannot be empty");
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.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 cacheGeoData() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
                            Open

                                private function cacheGeoData() {
                            
                                    if (!$this->Place instanceof Place) {
                                        return $this;
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.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 populate() has 350 lines of code. Current threshold is set to 100. Avoid really long methods.
                            Open

                                public function populate($force = false, $option = null) {
                            
                                    if ($force === false && !$this->isStale()) {
                                        return $this;
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

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

                                private function load($option = null) {
                            
                                    Debug::RecordInstance();
                            
                                    $this->mckey = sprintf("railpage:image=%d", $this->id);
                            Severity: Minor
                            Found in lib/Images/Image.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 cacheGeoData() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                            Open

                                private function cacheGeoData() {
                            
                                    if (!$this->Place instanceof Place) {
                                        return $this;
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.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 findObjects() has a Cyclomatic Complexity of 36. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function findObjects($namespace = null, $force = false) {
                            
                                    if (is_null($namespace)) {
                                        throw new Exception("Parameter 1 (namespace) cannot be empty");
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.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 populate() has a Cyclomatic Complexity of 56. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function populate($force = false, $option = null) {
                            
                                    if ($force === false && !$this->isStale()) {
                                        return $this;
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.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 getJSON() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                            Open

                                public function getJSON() {
                            
                                    if (isset( $this->author )) {
                                        $author = clone $this->author;
                            
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            CyclomaticComplexity

                            Since: 0.1

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

                            Example

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

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

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

                                                    if (!isset( $image_desc )) {
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            UndefinedVariable

                            Since: 2.8.0

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

                            Example

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

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

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

                            class Image extends AppCore {
                            
                                /**
                                 * Max age of data before it requires refreshing
                                 */
                            Severity: Minor
                            Found in lib/Images/Image.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

                            Missing class import via use statement (line '343', column '33').
                            Open

                                        $GalleryImage = new \Railpage\Gallery\Image($this->photo_id);
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            MissingImport

                            Since: 2.7.0

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

                            Example

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

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

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

                                public function findObjects($namespace = null, $force = false) {
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            BooleanArgumentFlag

                            Since: 1.4.0

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

                            Example

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

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

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

                                public function populate($force = false, $option = null) {
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            BooleanArgumentFlag

                            Since: 1.4.0

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

                            Example

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

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

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

                                    } else {
                                        switch ($this->provider) {
                                            case "flickr" :
                                                if (function_exists("base58_encode")) {
                                                    $this->source = "https://flic.kr/p/" . base58_encode($this->photo_id);
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            ElseExpression

                            Since: 1.4.0

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

                            Example

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

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

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

                                private function load($option = null) {
                            
                                    Debug::RecordInstance();
                            
                                    $this->mckey = sprintf("railpage:image=%d", $this->id);
                            Severity: Minor
                            Found in lib/Images/Image.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 '259', column '13').
                            Open

                                public function __construct($id = null, $option = null) {
                            
                                    parent::__construct();
                            
                                    $timer = Debug::getTimer();
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            IfStatementAssignment

                            Since: 2.7.0

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

                            Example

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

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

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

                                    } else {
                                        Debug::LogCLI("No author found in local cache - refreshing from " . $this->provider);
                                        Debug::LogEvent("No author found in local cache - refreshing from " . $this->provider);
                                        $this->populate(true, $option);
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            ElseExpression

                            Since: 1.4.0

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

                            Example

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

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

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

                                public function populate($force = false, $option = null) {
                            
                                    if ($force === false && !$this->isStale()) {
                                        return $this;
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            IfStatementAssignment

                            Since: 2.7.0

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

                            Example

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

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

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

                                                    if (!isset( $image_desc )) {
                            Severity: Minor
                            Found in lib/Images/Image.php by phpmd

                            UnusedLocalVariable

                            Since: 0.2

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

                            Example

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

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

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

                                                        "largest"  => array(
                                                            "width"  => $json['feed']['gphoto$width']['$t'],
                                                            "height" => $json['feed']['gphoto$height']['$t'],
                                                            "source" => str_replace(
                                                                sprintf("/s%d/", $json['feed']['media$group']['media$thumbnail'][0]['width']),
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 5 hrs to fix
                            lib/Images/Image.php on lines 747..755

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

                            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

                                                        "original" => array(
                                                            "width"  => $json['feed']['gphoto$width']['$t'],
                                                            "height" => $json['feed']['gphoto$height']['$t'],
                                                            "source" => str_replace(
                                                                sprintf("/s%d/", $json['feed']['media$group']['media$thumbnail'][0]['width']),
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 5 hrs to fix
                            lib/Images/Image.php on lines 756..764

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

                            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 ($size['width'] <= 1024 && $size['width'] > 500) {
                                                        $this->meta['sizes']['large'] = array(
                                                            "width"  => $size['width'],
                                                            "height" => $size['height'],
                                                            "source" => $size['url']
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 2 hrs to fix
                            lib/Images/Image.php on lines 772..778

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

                            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 ($size['width'] <= 500 && $size['width'] > 200) {
                                                        $this->meta['sizes']['small'] = array(
                                                            "width"  => $size['width'],
                                                            "height" => $size['height'],
                                                            "source" => $size['url']
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 2 hrs to fix
                            lib/Images/Image.php on lines 788..794

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

                            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

                                                "taken"  => $data['dates']['taken'] instanceof DateTime ? $data['dates']['taken']->format("Y-m-d H:i:s") : $data['dates']['taken']['date'],
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 653..653

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

                                                "posted" => $data['dates']['uploaded'] instanceof DateTime ? $data['dates']['uploaded']->format("Y-m-d H:i:s") : $data['dates']['uploaded']['date'],
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 654..654

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

                                    if (( ( !isset( $row['title'] ) || empty( $row['title'] ) || is_null($row['title']) ) && !empty( $this->title ) ) ||
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 360..360

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

                            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

                                        ( ( !isset( $row['description'] ) || empty( $row['description'] ) || is_null($row['description']) ) && !empty( $this->description ) )
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 359..359

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

                            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->Place instanceof Place) {
                                        $data['lat'] = $this->Place->lat;
                                        $data['lon'] = $this->Place->lon;
                                    }
                            Severity: Major
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Events/Event.php on lines 301..304

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

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

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 41.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (filter_var($this->lat, FILTER_VALIDATE_FLOAT) && filter_var($this->lon, FILTER_VALIDATE_FLOAT)) {
                                        $score += 14;
                                    }
                            Severity: Major
                            Found in lib/Images/Image.php and 2 other locations - About 1 hr to fix
                            lib/Chronicle/Entry.php on lines 162..164
                            lib/Chronicle/Entry.php on lines 259..261

                            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

                                                            if (filter_var($LocoClass->id, FILTER_VALIDATE_INT)) {
                                                                $this->addLink($LocoClass->namespace, $LocoClass->id);
                                                            }
                            Severity: Major
                            Found in lib/Images/Image.php and 2 other locations - About 1 hr to fix
                            lib/Images/Image.php on lines 1130..1132
                            lib/Images/Image.php on lines 1198..1200

                            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

                                                        if (filter_var($Loco->id, FILTER_VALIDATE_INT)) {
                                                            $this->addLink($Loco->namespace, $Loco->id);
                                                        }
                            Severity: Major
                            Found in lib/Images/Image.php and 2 other locations - About 1 hr to fix
                            lib/Images/Image.php on lines 1168..1170
                            lib/Images/Image.php on lines 1198..1200

                            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

                                                        if (filter_var($Livery->id, FILTER_VALIDATE_INT)) {
                                                            $this->addLink($Livery->namespace, $Livery->id);
                                                        }
                            Severity: Major
                            Found in lib/Images/Image.php and 2 other locations - About 1 hr to fix
                            lib/Images/Image.php on lines 1130..1132
                            lib/Images/Image.php on lines 1168..1170

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 36.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        Debug::LogCLI("Image ID " . $this->id . " (photo ID " . $this->photo_id . ") is stale");
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Prerender/Home.php on lines 59..59

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

                                                        $this->links->provider = filter_input(
                                                            INPUT_SERVER, 
                                                            "HTTP_REFERER",
                                                            FILTER_SANITIZE_STRING
                                                        );
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 891..895

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

                                                strpos(filter_input(INPUT_SERVER, "HTTP_REFERER", FILTER_SANITIZE_URL), "picasaweb.google.com")
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 828..828

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

                                                empty( $this->meta ) && 
                                                !is_null(filter_input(INPUT_SERVER, "HTTP_REFERER", FILTER_SANITIZE_URL)) && 
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Users/User.php on lines 1712..1712

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

                                            if (strpos(filter_input(INPUT_SERVER, "HTTP_REFERER", FILTER_SANITIZE_URL), "vicsig.net/photo")) {
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 720..720

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

                                                                $this->author->url = filter_input(
                                                                    INPUT_SERVER, 
                                                                    "HTTP_REFERER",
                                                                    FILTER_SANITIZE_STRING
                                                                );
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 1 hr to fix
                            lib/Images/Image.php on lines 923..927

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

                                        "captured"    => $this->DateCaptured instanceof DateTime ? $this->DateCaptured->format("Y-m-d H:i:s") : null,
                            Severity: Major
                            Found in lib/Images/Image.php and 2 other locations - About 55 mins to fix
                            lib/Locos/Date.php on lines 345..345
                            lib/Locos/Date.php on lines 424..424

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

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

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

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

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

                            Refactorings

                            Further Reading

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

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

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 28.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        try {
                                            $this->Place = Place::Factory($row['lat'], $row['lon']);
                                        } catch (Exception $e) {
                                            // Throw it away. Don't care.
                                        }
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 55 mins to fix
                            lib/Events/Event.php on lines 227..229

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 28.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                                    "updateurl"   => sprintf("%s?alt=json", $json['feed']['id']['$t'])
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 50 mins to fix
                            lib/Images/Image.php on lines 744..744

                            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

                                                        "posted" => date("Y-m-d H:i:s", $json['feed']['gphoto$timestamp']['$t']),
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 50 mins to fix
                            lib/Images/Image.php on lines 768..768

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 27.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!filter_var($this->photo_id)) {
                                        throw new Exception("Photo ID from the image provider cannot be empty");
                                    }
                            Severity: Major
                            Found in lib/Images/Image.php and 7 other locations - About 45 mins to fix
                            lib/Forums/Thread.php on lines 445..447
                            lib/Jobs/Scraper.php on lines 96..98
                            lib/Jobs/Scraper.php on lines 192..194
                            lib/Locos/Date.php on lines 258..260
                            lib/News/Scraper.php on lines 86..88
                            lib/Newsletters/Newsletter.php on lines 147..149
                            lib/Notifications/Transport/Email.php on lines 167..169

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 26.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                            $this->DateCaptured = new DateTime($row['meta']['data']['dates']['taken']);
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 45 mins to fix
                            lib/Images/Utility/Updater.php on lines 141..141

                            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

                                    Debug::LogEvent(__METHOD__ . "(\"" . $namespace . "\")", $timer);
                            Severity: Major
                            Found in lib/Images/Image.php and 2 other locations - About 45 mins to fix
                            lib/Locations/Locations.php on lines 129..129
                            lib/Locations/Locations.php on lines 163..163

                            Duplicated Code

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

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

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

                            Tuning

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

                                        "url"         => $this->url instanceof Url ? $this->url->getURLs() : array(),
                            Severity: Major
                            Found in lib/Images/Image.php and 2 other locations - About 40 mins to fix
                            lib/Gallery/Album.php on lines 391..391
                            lib/News/Topic.php on lines 425..425

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 24.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if (!isset( $row['user_id'] )) {
                                        $row['user_id'] = 0;
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 40 mins to fix
                            lib/Events/Event.php on lines 211..213

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 24.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $params = [
                                        "railpage.locos.loco",
                                        "railpage.locos.loco",
                                        $this->id,
                                        $this->id
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 40 mins to fix
                            lib/Images/Image.php on lines 1345..1350

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 24.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        $params = [
                                            "railpage.locos.class",
                                            "railpage.locos.class",
                                            $this->id,
                                            $this->id
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 40 mins to fix
                            lib/Images/Image.php on lines 1335..1340

                            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

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

                                    if (( defined("NOREDIS") && NOREDIS == true ) || !$row = $this->Redis->fetch($this->mckey)) {
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 40 mins to fix
                            lib/Images/Images.php on lines 106..106

                            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

                                    if (filter_var($linkId, FILTER_VALIDATE_INT) && $linkId > 0) {
                                        $where['id = ?'] = $linkId;
                                    }
                            Severity: Major
                            Found in lib/Images/Image.php and 3 other locations - About 40 mins to fix
                            lib/Gallery/Album.php on lines 264..266
                            lib/Railcams/Type.php on lines 52..64
                            lib/Reminders/Reminder.php on lines 142..144

                            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

                                        $this->author = json_decode(json_encode($row['meta']['author']));
                            Severity: Minor
                            Found in lib/Images/Image.php and 2 other locations - About 40 mins to fix
                            lib/Prerender/Home.php on lines 205..205
                            lib/Prerender/Home.php on lines 205..205

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

                                    if (is_null($namespace)) {
                                        throw new Exception("Parameter 1 (namespace) cannot be empty");
                                    }
                            Severity: Major
                            Found in lib/Images/Image.php and 20 other locations - About 35 mins to fix
                            lib/Events/EventDate.php on lines 372..374
                            lib/Images/Image.php on lines 1095..1097
                            lib/Images/Images.php on lines 96..98
                            lib/Images/Images.php on lines 137..139
                            lib/Locations/Region.php on lines 93..95
                            lib/Locos/Locos.php on lines 590..592
                            lib/Locos/Locos.php on lines 901..903
                            lib/Locos/Locos.php on lines 925..927
                            lib/Railcams/Storage/LocalFS.php on lines 127..129
                            lib/Users/User.php on lines 2572..2574
                            lib/Users/User.php on lines 2576..2578
                            lib/Users/User.php on lines 2584..2586
                            lib/Users/Utility/PasswordUtility.php on lines 70..72
                            lib/Users/Utility/PasswordUtility.php on lines 74..76
                            lib/Users/Utility/PasswordUtility.php on lines 78..80
                            lib/API.php on lines 124..126
                            lib/API.php on lines 194..196
                            lib/BanControl/BanControl.php on lines 243..245
                            lib/BanControl/BanControl.php on lines 354..356
                            lib/BanControl/BanControl.php on lines 358..360

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

                                    if (is_null($namespace)) {
                                        throw new Exception("Parameter 1 (namespace) cannot be empty");
                                    }
                            Severity: Major
                            Found in lib/Images/Image.php and 20 other locations - About 35 mins to fix
                            lib/Events/EventDate.php on lines 372..374
                            lib/Images/Image.php on lines 963..965
                            lib/Images/Images.php on lines 96..98
                            lib/Images/Images.php on lines 137..139
                            lib/Locations/Region.php on lines 93..95
                            lib/Locos/Locos.php on lines 590..592
                            lib/Locos/Locos.php on lines 901..903
                            lib/Locos/Locos.php on lines 925..927
                            lib/Railcams/Storage/LocalFS.php on lines 127..129
                            lib/Users/User.php on lines 2572..2574
                            lib/Users/User.php on lines 2576..2578
                            lib/Users/User.php on lines 2584..2586
                            lib/Users/Utility/PasswordUtility.php on lines 70..72
                            lib/Users/Utility/PasswordUtility.php on lines 74..76
                            lib/Users/Utility/PasswordUtility.php on lines 78..80
                            lib/API.php on lines 124..126
                            lib/API.php on lines 194..196
                            lib/BanControl/BanControl.php on lines 243..245
                            lib/BanControl/BanControl.php on lines 354..356
                            lib/BanControl/BanControl.php on lines 358..360

                            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 (stristr($tag, $row['class_tag']) && strlen(str_replace($row['class_tag'] . "-", "", $tag) > 0) ) {
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 35 mins to fix
                            lib/Images/Image.php on lines 1139..1139

                            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

                                                            $loco_num = str_replace($row['class_tag'] . "-", "", $tag);
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 35 mins to fix
                            lib/Images/Image.php on lines 1138..1138

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

                                    if (empty( $this->mckey )) {
                                        $this->mckey = sprintf("railpage:image=%d", $this->id);
                                    }
                            Severity: Major
                            Found in lib/Images/Image.php and 3 other locations - About 35 mins to fix
                            lib/Images/Utility/Url.php on lines 29..31
                            lib/News/Feed.php on lines 252..254
                            lib/Module.php on lines 147..149

                            Duplicated Code

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

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

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

                            Tuning

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

                                    $key = sprintf("railpage:images.image=%d;objects.namespace=%s;lastupdate", $this->id, $namespace);
                            Severity: Major
                            Found in lib/Images/Image.php and 3 other locations - About 35 mins to fix
                            lib/Forums/Forums.php on lines 1113..1113
                            lib/Forums/Forums.php on lines 1193..1193
                            lib/Users/Group.php on lines 466..466

                            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

                                            $this->author->User = UserFactory::CreateUser($row['user_id']);
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 35 mins to fix
                            lib/Locos/Correction.php on lines 143..143

                            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

                                    Debug::LogCLI("Fetching data from " . $this->provider . " for image ID " . $this->id . " (photo ID " . $this->photo_id . ")");
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 35 mins to fix
                            lib/Place.php on lines 546..546

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 22.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    $GeoPlaceID = PlaceUtility::findGeoPlaceID($this->lat, $this->lon);
                            Severity: Major
                            Found in lib/Images/Image.php and 4 other locations - About 30 mins to fix
                            lib/Locations/Location.php on lines 473..473
                            lib/Locations/Location.php on lines 586..586
                            lib/Locations/Location.php on lines 686..686
                            lib/Place.php on lines 490..490

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

                                    $user_id = isset( $this->author->User ) && $this->author->User instanceof User ? $this->author->User->id : 0;
                            Severity: Major
                            Found in lib/Images/Image.php and 3 other locations - About 30 mins to fix
                            lib/Images/PhotoOfTheWeek.php on lines 84..92
                            lib/Locos/Correction.php on lines 255..255
                            lib/Locos/Correction.php on lines 256..256

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

                                                $response = $this->GuzzleClient->get($this->meta['source']);
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 30 mins to fix
                            lib/Pagination.php on lines 359..359

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 21.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($this->id = filter_var($id, FILTER_VALIDATE_INT)) {
                                        $this->load($option);
                                    }
                            Severity: Minor
                            Found in lib/Images/Image.php and 2 other locations - About 30 mins to fix
                            lib/Jobs/Job.php on lines 151..154
                            lib/Locations/Correction.php on lines 105..107

                            Duplicated Code

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

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

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

                            Tuning

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

                                        "provider"    => array(
                                            "name"     => $this->provider,
                                            "photo_id" => $this->photo_id
                                        ),
                            Severity: Major
                            Found in lib/Images/Image.php and 4 other locations - About 30 mins to fix
                            lib/Jobs/Jobs.php on lines 210..213
                            lib/Jobs/Scraper.php on lines 278..281
                            lib/Locos/Locomotive.php on lines 1415..1418
                            lib/Sightings/Sighting.php on lines 187..190

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 20.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                        $this->links->provider = isset( $data['urls']['url'][0]['_content'] ) ? $data['urls']['url'][0]['_content'] : $data['urls'][key($data['urls'])];
                            Severity: Minor
                            Found in lib/Images/Image.php and 2 other locations - About 30 mins to fix
                            lib/Locations/Country.php on lines 112..140
                            lib/Locations/Region.php on lines 192..197

                            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

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

                                        if (isset( $row['meta']['data']['dates']['taken'] )) {
                                            $this->DateCaptured = new DateTime($row['meta']['data']['dates']['taken']);
                                        }
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 30 mins to fix
                            lib/Images/Utility/Updater.php on lines 140..142

                            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

                                        Debug::LogCLI("Fetching data for " . $this->id . " from database");
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 30 mins to fix
                            lib/Images/Collage.php on lines 113..113

                            Duplicated Code

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

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

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

                            Tuning

                            This issue has a mass of 20.

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

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

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

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

                            Refactorings

                            Further Reading

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

                                    if ($option != Images::OPT_NOPLACE && round($row['lat'], 3) != "0.000" && round($row['lon'],
                            Severity: Major
                            Found in lib/Images/Image.php and 3 other locations - About 30 mins to fix
                            lib/Events/Event.php on lines 227..227
                            lib/Events/Event.php on lines 227..227
                            lib/Images/Image.php on lines 394..395

                            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

                                                    $this->Place = Place::Factory($pos[0], $pos[1]);
                            Severity: Minor
                            Found in lib/Images/Image.php and 1 other location - About 30 mins to fix
                            lib/Place.php on lines 694..694

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

                            Blank line found at start of control structure
                            Open

                                                foreach ($images as $element) {
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            The CASE body must start on the line following the statement
                            Open

                                        case "picasaweb" :
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Blank line found at start of control structure
                            Open

                                                        foreach ($text as $k => $line) {
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            The CASE body must start on the line following the statement
                            Open

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

                            Blank line found at end of control structure
                            Open

                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Blank line found at end of control structure
                            Open

                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Blank line found at start of control structure
                            Open

                                    switch ($namespace) {
                            Severity: Minor
                            Found in lib/Images/Image.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/Image.php by phpcodesniffer

                            Blank line found at start of control structure
                            Open

                                        if (in_array($e->getMessage(), $expected)) {
                            Severity: Minor
                            Found in lib/Images/Image.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/Image.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/Image.php by phpcodesniffer

                            Expected 0 spaces before closing bracket; 1 found
                            Open

                                                        if (stristr($tag, $row['class_tag']) && strlen(str_replace($row['class_tag'] . "-", "", $tag) > 0) ) {
                            Severity: Minor
                            Found in lib/Images/Image.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/Image.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/Image.php by phpcodesniffer

                            Expected 0 spaces before closing bracket; 1 found
                            Open

                                                    if (isset( $LocoClass ) && $LocoClass instanceof LocoClass && preg_match("@railpage:loco=([a-zA-Z0-9]+)@", $tag, $matches) ) {
                            Severity: Minor
                            Found in lib/Images/Image.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/Image.php by phpcodesniffer

                            Blank line found at start of control structure
                            Open

                                    if (( defined("NOREDIS") && NOREDIS == true ) || !$row = $this->Redis->fetch($this->mckey)) {
                            Severity: Minor
                            Found in lib/Images/Image.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/Image.php by phpcodesniffer

                            Blank line found at start of control structure
                            Open

                                            if (isset( $this->meta['tags'] )) {
                            Severity: Minor
                            Found in lib/Images/Image.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/Image.php by phpcodesniffer

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

                                                    "@(http|https)://picasaweb.google.com/([a-zA-Z\-\.]+)/(.+)@", "$2",
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

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

                                            $Date = filter_var($this->meta['dates'][$time],
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Multi-line function call not indented correctly; expected 12 spaces but found 20
                            Open

                                                FILTER_VALIDATE_INT)
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Closing parenthesis of a multi-line function call must be on a line by itself
                            Open

                                        array($namespace, $namespaceKey, $this->id))
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Multi-line function call not indented correctly; expected 8 spaces but found 16
                            Open

                                            3) != "0.000"
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

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

                                        if (isset( $data['author']['railpage_id'] ) && filter_var($data['author']['railpage_id'],
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Expected 0 spaces after opening bracket; newline found
                            Open

                                            if (
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Closing parenthesis of a multi-line function call must be on a line by itself
                            Open

                                            3) != "0.000"
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Multi-line function call not indented correctly; expected 8 spaces but found 12
                            Open

                                        array($namespace, $namespaceKey, $this->id))
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Closing parenthesis of a multi-line function call must be on a line by itself
                            Open

                                                FILTER_VALIDATE_INT)
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Closing parenthesis of a multi-line function call must be on a line by itself
                            Open

                                                FILTER_VALIDATE_INT) ? new DateTime("@" . $this->meta['dates'][$time]) : new DateTime($this->meta['dates'][$time]);
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

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

                                    if ($option != Images::OPT_NOPLACE && round($row['lat'], 3) != "0.000" && round($row['lon'],
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            Multi-line function call not indented correctly; expected 16 spaces but found 20
                            Open

                                                FILTER_VALIDATE_INT) ? new DateTime("@" . $this->meta['dates'][$time]) : new DateTime($this->meta['dates'][$time]);
                            Severity: Minor
                            Found in lib/Images/Image.php by phpcodesniffer

                            There are no issues that match your filters.

                            Category
                            Status