railpage/railpagecore

View on GitHub
lib/Place.php

Summary

Maintainability
F
1 wk
Test Coverage

File Place.php has 419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Where on Earth is this place?
 * Geolookup
Severity: Minor
Found in lib/Place.php - About 6 hrs to fix

    Function getWOEData has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getWOEData($lookup = false, $types = false) {
            if ($lookup === false) {
                return false;
            }
            
    Severity: Minor
    Found in lib/Place.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

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

    class Place extends AppCore {
        
        /**
         * Name
         * @var string $name
    Severity: Minor
    Found in lib/Place.php by phpmd

    Method getWeatherForecast has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getWeatherForecast($days = 14) {
            
            return false;
            
            $weather = false;
    Severity: Major
    Found in lib/Place.php - About 3 hrs to fix

      Method getWOEData has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getWOEData($lookup = false, $types = false) {
              if ($lookup === false) {
                  return false;
              }
              
      Severity: Major
      Found in lib/Place.php - About 3 hrs to fix

        Method getPhotos has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getPhotos($num = 10) {
                $lat = $this->lat;
                $lon = $this->lon;
                
                $query = "SELECT flickr_geodata.*, 3956 * 2 * ASIN(SQRT(POWER(SIN((" . $lat . " - flickr_geodata.lat) * pi() / 180 / 2), 2) + COS(" . $lat . " * pi() / 180) * COS(" . $lat . " * pi() / 180) * POWER(SIN((" . $lon . " - flickr_geodata.lon) * pi() / 180 / 2), 2))) AS distance 
        Severity: Major
        Found in lib/Place.php - About 2 hrs to fix

          Function getWeatherForecast has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getWeatherForecast($days = 14) {
                  
                  return false;
                  
                  $weather = false;
          Severity: Minor
          Found in lib/Place.php - About 2 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function getAddress() {
                  
                  $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
                  
                  if ($address = $this->Memcached->fetch($mckey)) {
          Severity: Minor
          Found in lib/Place.php - About 2 hrs to fix

          Cognitive Complexity

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

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

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

          Further reading

          Method getAddress has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAddress() {
                  
                  $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
                  
                  if ($address = $this->Memcached->fetch($mckey)) {
          Severity: Minor
          Found in lib/Place.php - About 1 hr to fix

            Method getPhotosFromSphinx has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getPhotosFromSphinx($num = 10) {
                    
                    $Sphinx = AppCore::getSphinxAPI(); 
                    
                    $Sphinx->SetGeoAnchor("lat", "lon", deg2rad($this->lat), deg2rad($this->lon)); 
            Severity: Minor
            Found in lib/Place.php - About 1 hr to fix

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

                  private function load() {
                      
                      /**
                       * Fetch the WOE (Where On Earth) data from Yahoo
                       */
              Severity: Minor
              Found in lib/Place.php - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Avoid too many return statements within this method.
              Open

                      return $return;
              Severity: Major
              Found in lib/Place.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return $weather;
                Severity: Major
                Found in lib/Place.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $weather[$Date->format("Y-m-d")];
                  Severity: Major
                  Found in lib/Place.php - About 30 mins to fix

                    The method getWeatherForecast() has an NPath complexity of 10368. The configured NPath complexity threshold is 200.
                    Open

                        public function getWeatherForecast($days = 14) {
                            
                            return false;
                            
                            $weather = false;
                    Severity: Minor
                    Found in lib/Place.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 getWeatherForecast() has 140 lines of code. Current threshold is set to 100. Avoid really long methods.
                    Open

                        public function getWeatherForecast($days = 14) {
                            
                            return false;
                            
                            $weather = false;
                    Severity: Minor
                    Found in lib/Place.php by phpmd

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

                        public static function getWOEData($lookup = false, $types = false) {
                            if ($lookup === false) {
                                return false;
                            }
                            
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    The method getWOEData() has an NPath complexity of 36864. The configured NPath complexity threshold is 200.
                    Open

                        public static function getWOEData($lookup = false, $types = false) {
                            if ($lookup === false) {
                                return false;
                            }
                            
                    Severity: Minor
                    Found in lib/Place.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 getWOEData() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10.
                    Open

                        public static function getWOEData($lookup = false, $types = false) {
                            if ($lookup === false) {
                                return false;
                            }
                            
                    Severity: Minor
                    Found in lib/Place.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 getWeatherForecast() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                    Open

                        public function getWeatherForecast($days = 14) {
                            
                            return false;
                            
                            $weather = false;
                    Severity: Minor
                    Found in lib/Place.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 getAddress() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                    Open

                        public function getAddress() {
                            
                            $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
                            
                            if ($address = $this->Memcached->fetch($mckey)) {
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

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

                    Example

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

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

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

                    class Place extends AppCore {
                        
                        /**
                         * Name
                         * @var string $name
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    CouplingBetweenObjects

                    Since: 1.1.0

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

                    Example

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

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

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

                        public static function getWOEData($lookup = false, $types = false) {
                    Severity: Minor
                    Found in lib/Place.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 getWOEData has a boolean flag argument $types, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                        public static function getWOEData($lookup = false, $types = false) {
                    Severity: Minor
                    Found in lib/Place.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 Factory has a boolean flag argument $lat, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                        public static function Factory($lat = false, $lon = false) {
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    BooleanArgumentFlag

                    Since: 1.4.0

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

                    Example

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

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

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

                        public function __construct($lat = false, $lon = false, $radius = 0.1) {
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    BooleanArgumentFlag

                    Since: 1.4.0

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

                    Example

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

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

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

                        public function __construct($lat = false, $lon = false, $radius = 0.1) {
                    Severity: Minor
                    Found in lib/Place.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 Factory has a boolean flag argument $lon, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                        public static function Factory($lat = false, $lon = false) {
                    Severity: Minor
                    Found in lib/Place.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

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

                        public function getWeatherForecast($days = 14) {
                            
                            return false;
                            
                            $weather = false;
                    Severity: Minor
                    Found in lib/Place.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 '397', column '13').
                    Open

                        public function getAddress() {
                            
                            $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
                            
                            if ($address = $this->Memcached->fetch($mckey)) {
                    Severity: Minor
                    Found in lib/Place.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 getWeatherForecast uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                $url = "http://api.openweathermap.org/data/2.5/forecast/daily?lat=" . $this->lat . "&lon=" . $this->lon . "&units=metric&cnt=" . $days;
                            }
                    Severity: Minor
                    Found in lib/Place.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 '719', column '26').
                    Open

                        public static function getWOEData($lookup = false, $types = false) {
                            if ($lookup === false) {
                                return false;
                            }
                            
                    Severity: Minor
                    Found in lib/Place.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 '383', column '13').
                    Open

                        public function getAddress() {
                            
                            $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
                            
                            if ($address = $this->Memcached->fetch($mckey)) {
                    Severity: Minor
                    Found in lib/Place.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 '657', column '13').
                    Open

                        public static function getWOEData($lookup = false, $types = false) {
                            if ($lookup === false) {
                                return false;
                            }
                            
                    Severity: Minor
                    Found in lib/Place.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 '635', column '13').
                    Open

                        public static function getWOEData($lookup = false, $types = false) {
                            if ($lookup === false) {
                                return false;
                            }
                            
                    Severity: Minor
                    Found in lib/Place.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 '482', column '13').
                    Open

                        public function getWeatherForecast($days = 14) {
                            
                            return false;
                            
                            $weather = false;
                    Severity: Minor
                    Found in lib/Place.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 getWeatherForecast uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                $query = "SELECT date, min, max, weather, icon FROM geoplace_forecast WHERE date >= ? AND geoplace = ? LIMIT 0, ?";
                                $params = array(
                                    date("Y-m-d"),
                                    $GeoplaceID,
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                            } else {
                                $lookup = sprintf("place/%s", $lookup);
                            }
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                            } else {
                                $url = sprintf("http://where.yahooapis.com/v1/places\$and(.q('%s'),.type(%s))?lang=en&appid=%s&format=json", $latlng, implode(",", $types), $Config->Yahoo->ApplicationID);
                            }
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    ElseExpression

                    Since: 1.4.0

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

                    Example

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

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

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

                            $Memcached = AppCore::getMemcached(); 
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    UnusedLocalVariable

                    Since: 0.2

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

                    Example

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

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

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

                            $Redis = AppCore::getRedis(); 
                    Severity: Minor
                    Found in lib/Place.php by phpmd

                    UnusedLocalVariable

                    Since: 0.2

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

                    Example

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

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

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

                            foreach ($woe['places']['place'][0] as $key => $val) {
                    Severity: Minor
                    Found in lib/Place.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

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

                            if (!$return && isset($response) && $response->getStatusCode() == 200) {
                                $return = json_decode($response->getBody(), true);
                            }
                    Severity: Major
                    Found in lib/Place.php and 2 other locations - About 1 hr to fix
                    lib/PlaceUtility.php on lines 87..89
                    lib/PlaceUtility.php on lines 356..358

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                            $this->boundingBox->southWest->lat = floatval($woe['places']['place'][0]['boundingBox']['southWest']['latitude']);
                    Severity: Major
                    Found in lib/Place.php and 3 other locations - About 1 hr to fix
                    lib/Place.php on lines 161..161
                    lib/Place.php on lines 162..162
                    lib/Place.php on lines 166..166

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

                            $this->boundingBox->northEast->lat = floatval($woe['places']['place'][0]['boundingBox']['northEast']['latitude']);
                    Severity: Major
                    Found in lib/Place.php and 3 other locations - About 1 hr to fix
                    lib/Place.php on lines 162..162
                    lib/Place.php on lines 165..165
                    lib/Place.php on lines 166..166

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

                            $this->boundingBox->northEast->lon = floatval($woe['places']['place'][0]['boundingBox']['northEast']['longitude']);
                    Severity: Major
                    Found in lib/Place.php and 3 other locations - About 1 hr to fix
                    lib/Place.php on lines 161..161
                    lib/Place.php on lines 165..165
                    lib/Place.php on lines 166..166

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

                            $this->boundingBox->southWest->lon = floatval($woe['places']['place'][0]['boundingBox']['southWest']['longitude']);
                    Severity: Major
                    Found in lib/Place.php and 3 other locations - About 1 hr to fix
                    lib/Place.php on lines 161..161
                    lib/Place.php on lines 162..162
                    lib/Place.php on lines 165..165

                    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

                            $query = "SELECT flickr_geodata.*, 3956 * 2 * ASIN(SQRT(POWER(SIN((" . $lat . " - flickr_geodata.lat) * pi() / 180 / 2), 2) + COS(" . $lat . " * pi() / 180) * COS(" . $lat . " * pi() / 180) * POWER(SIN((" . $lon . " - flickr_geodata.lon) * pi() / 180 / 2), 2))) AS distance 
                                FROM flickr_geodata 
                                WHERE flickr_geodata.lon BETWEEN (
                                        " . $lon . " - " . $this->radius . " / abs(cos(radians(" . $lat . ")) * 69)
                    Severity: Major
                    Found in lib/Place.php and 1 other location - About 1 hr to fix
                    lib/Locations/Locations.php on lines 296..317

                    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 ($response->getStatusCode() == 200) {
                                $result = json_decode($response->getBody(), true);
                            }
                    Severity: Major
                    Found in lib/Place.php and 1 other location - About 1 hr to fix
                    lib/Place.php on lines 561..563

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

                    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 ($response->getStatusCode() == 200) {
                                $forecast = json_decode($response->getBody(), true);
                            }
                    Severity: Major
                    Found in lib/Place.php and 1 other location - About 1 hr to fix
                    lib/Place.php on lines 407..409

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                                    if ($row['types'][0] == "street_address") {
                                        $return['street_address'] = $row['formatted_address'];
                                    }
                    Severity: Major
                    Found in lib/Place.php and 2 other locations - About 1 hr to fix
                    lib/Place.php on lines 421..423
                    lib/Place.php on lines 425..427

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 32.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                    if ($row['types'][0] == "administrative_area_level_1") {
                                        $return['region'] = $row['formatted_address'];
                                    }
                    Severity: Major
                    Found in lib/Place.php and 2 other locations - About 1 hr to fix
                    lib/Place.php on lines 417..419
                    lib/Place.php on lines 421..423

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 32.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                    if ($row['types'][0] == "locality") {
                                        $return['locality'] = $row['formatted_address'];
                                    }
                    Severity: Major
                    Found in lib/Place.php and 2 other locations - About 1 hr to fix
                    lib/Place.php on lines 417..419
                    lib/Place.php on lines 425..427

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 32.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                "url" => $this->url instanceof Url ? $this->url->getURLs() : array("url" => $this->url)
                    Severity: Major
                    Found in lib/Place.php and 2 other locations - About 1 hr to fix
                    lib/Locations/Location.php on lines 963..963
                    lib/Organisations/Organisation.php on lines 446..446

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 31.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                round(str_pad($this->lon, 12, 0), 8)
                    Severity: Minor
                    Found in lib/Place.php and 1 other location - About 55 mins to fix
                    lib/Place.php on lines 393..393

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 28.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                round(str_pad($this->lat, 12, 0), 8), 
                    Severity: Minor
                    Found in lib/Place.php and 1 other location - About 55 mins to fix
                    lib/Place.php on lines 394..394

                    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

                                if (isset($val['type']) && strtolower($val['type']) != "country") {
                                    $this->Region = LocationsFactory::CreateRegion($val['woeid']);
                                    break;
                                }
                    Severity: Minor
                    Found in lib/Place.php and 1 other location - About 50 mins to fix
                    lib/PlaceUtility.php on lines 149..154

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 27.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if (!isset($woe['places']['place'][0])) {
                                throw new Exception("Could not find a place matching coordinates " . $this->lat . "," . $this->lon);
                            }
                    Severity: Minor
                    Found in lib/Place.php and 1 other location - About 50 mins to fix
                    lib/SocketIO.php on lines 69..71

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

                                $this->url = sprintf("/place?lat=%s&lon=%s", $this->lat, $this->lon);
                    Severity: Major
                    Found in lib/Place.php and 2 other locations - About 45 mins to fix
                    lib/Images/PhotoOfTheWeek.php on lines 89..89
                    lib/Images/Utility/PushNotify.php on lines 48..48

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 26.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            $this->Redis->save($mckey, $weather, strtotime("+24 hours"));
                    Severity: Major
                    Found in lib/Place.php and 21 other locations - About 40 mins to fix
                    lib/Chronicle/Chronicle.php on lines 119..119
                    lib/Config/Base.php on lines 40..40
                    lib/Config/Base.php on lines 111..111
                    lib/Downloads/Download.php on lines 530..530
                    lib/Glossary/Glossary.php on lines 107..107
                    lib/Images/Images.php on lines 110..110
                    lib/Links/Links.php on lines 94..94
                    lib/Links/Links.php on lines 129..129
                    lib/Locations/Country.php on lines 179..179
                    lib/Locations/Country.php on lines 180..180
                    lib/Locations/Location.php on lines 811..811
                    lib/Locations/Locations.php on lines 76..76
                    lib/Locations/Locations.php on lines 127..127
                    lib/Locations/Locations.php on lines 161..161
                    lib/Locations/Locations.php on lines 474..474
                    lib/Locos/Locomotive.php on lines 1227..1227
                    lib/Locos/Locomotive.php on lines 1538..1538
                    lib/Locos/Locos.php on lines 238..238
                    lib/PrivateMessages/Folder.php on lines 259..259
                    lib/Users/Base.php on lines 82..82
                    lib/Users/Timeline.php on lines 241..241

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

                                "region" => array(
                                    "name" => $this->Region->name,
                                    "code" => $this->Country->code
                                ),
                    Severity: Major
                    Found in lib/Place.php and 5 other locations - About 40 mins to fix
                    lib/Images/Competitions.php on lines 251..254
                    lib/Jobs/Job.php on lines 339..342
                    lib/Jobs/Job.php on lines 343..346
                    lib/Jobs/Job.php on lines 347..350
                    lib/Place.php on lines 362..365

                    Duplicated Code

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

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

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

                    Tuning

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

                                        "weather" => array(
                                            "title" => $row['weather'],
                                            "icon" => $row['icon']
                                        )
                    Severity: Major
                    Found in lib/Place.php and 4 other locations - About 40 mins to fix
                    lib/Feedback/Feedback.php on lines 88..91
                    lib/Feedback/Feedback.php on lines 92..95
                    lib/Locations/Locations.php on lines 577..580
                    lib/Timetables/Timetables.php on lines 138..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 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 4 locations. Consider refactoring.
                    Open

                            $url = sprintf("https://maps.googleapis.com/maps/api/geocode/json?latlng=%s,%s&sensor=false", $this->lat, $this->lon);
                    Severity: Major
                    Found in lib/Place.php and 3 other locations - About 40 mins to fix
                    lib/Locos/Utility/CoverImageUtility.php on lines 83..83
                    lib/Users/Group.php on lines 356..356
                    lib/Place.php on lines 381..381

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

                                "country" => array(
                                    "name" => $this->Country->name,
                                    "code" => $this->Country->code
                                ),
                    Severity: Major
                    Found in lib/Place.php and 5 other locations - About 40 mins to fix
                    lib/Images/Competitions.php on lines 251..254
                    lib/Jobs/Job.php on lines 339..342
                    lib/Jobs/Job.php on lines 343..346
                    lib/Jobs/Job.php on lines 347..350
                    lib/Place.php on lines 358..361

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

                            $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
                    Severity: Major
                    Found in lib/Place.php and 3 other locations - About 40 mins to fix
                    lib/Locos/Utility/CoverImageUtility.php on lines 83..83
                    lib/Users/Group.php on lines 356..356
                    lib/Place.php on lines 403..403

                    Duplicated Code

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

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

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

                    Tuning

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

                                $url = "http://api.openweathermap.org/data/2.5/forecast/daily?lat=" . $this->lat . "&lon=" . $this->lon . "&units=metric&cnt=" . $days;
                    Severity: Minor
                    Found in lib/Place.php and 1 other location - About 35 mins to fix
                    lib/Images/Image.php on lines 605..605

                    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/Place.php and 4 other locations - About 30 mins to fix
                    lib/Images/Image.php on lines 1478..1478
                    lib/Locations/Location.php on lines 473..473
                    lib/Locations/Location.php on lines 586..586
                    lib/Locations/Location.php on lines 686..686

                    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

                                if (!is_array($return) && is_string($return)) {
                                    $return = json_decode($return, true); 
                                }
                    Severity: Minor
                    Found in lib/Place.php and 1 other location - About 30 mins to fix
                    lib/Users/User.php on lines 2771..2773

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

                                    "distance" => round($row['attrs']['@geodist']),
                    Severity: Major
                    Found in lib/Place.php and 6 other locations - About 30 mins to fix
                    lib/Place.php on lines 220..220
                    lib/Place.php on lines 221..221
                    lib/Place.php on lines 573..573
                    lib/Place.php on lines 574..574
                    lib/Place.php on lines 585..585
                    lib/Place.php on lines 586..586

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

                                    "min" => round($row['temp']['min']),
                    Severity: Major
                    Found in lib/Place.php and 6 other locations - About 30 mins to fix
                    lib/Place.php on lines 219..219
                    lib/Place.php on lines 220..220
                    lib/Place.php on lines 221..221
                    lib/Place.php on lines 574..574
                    lib/Place.php on lines 585..585
                    lib/Place.php on lines 586..586

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

                                    "max" => round($row['temp']['max']),
                    Severity: Major
                    Found in lib/Place.php and 6 other locations - About 30 mins to fix
                    lib/Place.php on lines 219..219
                    lib/Place.php on lines 220..220
                    lib/Place.php on lines 221..221
                    lib/Place.php on lines 573..573
                    lib/Place.php on lines 585..585
                    lib/Place.php on lines 586..586

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

                                    "lat" => rad2deg($row['attrs']['lat']),
                    Severity: Major
                    Found in lib/Place.php and 6 other locations - About 30 mins to fix
                    lib/Place.php on lines 219..219
                    lib/Place.php on lines 221..221
                    lib/Place.php on lines 573..573
                    lib/Place.php on lines 574..574
                    lib/Place.php on lines 585..585
                    lib/Place.php on lines 586..586

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 20.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if ($weather = $this->Redis->fetch($mckey)) {
                                return $weather;
                            }
                    Severity: Major
                    Found in lib/Place.php and 8 other locations - About 30 mins to fix
                    lib/Chronicle/Chronicle.php on lines 105..107
                    lib/Links/Links.php on lines 40..42
                    lib/Locations/Location.php on lines 722..724
                    lib/Locations/Locations.php on lines 99..101
                    lib/Locos/Locomotive.php on lines 1206..1208
                    lib/Locos/Locomotive.php on lines 1500..1502
                    lib/Users/Timeline.php on lines 209..211
                    lib/Place.php on lines 383..385

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 20.

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

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

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

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

                    Refactorings

                    Further Reading

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

                            if ($address = $this->Memcached->fetch($mckey)) {
                                return $address; 
                            }
                    Severity: Major
                    Found in lib/Place.php and 8 other locations - About 30 mins to fix
                    lib/Chronicle/Chronicle.php on lines 105..107
                    lib/Links/Links.php on lines 40..42
                    lib/Locations/Location.php on lines 722..724
                    lib/Locations/Locations.php on lines 99..101
                    lib/Locos/Locomotive.php on lines 1206..1208
                    lib/Locos/Locomotive.php on lines 1500..1502
                    lib/Users/Timeline.php on lines 209..211
                    lib/Place.php on lines 482..484

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 20.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                    "lon" => rad2deg($row['attrs']['lon']),
                    Severity: Major
                    Found in lib/Place.php and 6 other locations - About 30 mins to fix
                    lib/Place.php on lines 219..219
                    lib/Place.php on lines 220..220
                    lib/Place.php on lines 573..573
                    lib/Place.php on lines 574..574
                    lib/Place.php on lines 585..585
                    lib/Place.php on lines 586..586

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

                            $regkey = sprintf("railpage.place;lat=%s;lon=%s", $lat, $lon); 
                    Severity: Major
                    Found in lib/Place.php and 5 other locations - About 30 mins to fix
                    lib/Images/Images.php on lines 104..104
                    lib/Images/Provider/FiveHundredPx.php on lines 287..287
                    lib/Images/Utility/Finder.php on lines 230..230
                    lib/Locations/Factory.php on lines 88..88
                    lib/PlaceUtility.php on lines 329..329

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

                                    "max" => round($row['temp']['max']),
                    Severity: Major
                    Found in lib/Place.php and 6 other locations - About 30 mins to fix
                    lib/Place.php on lines 219..219
                    lib/Place.php on lines 220..220
                    lib/Place.php on lines 221..221
                    lib/Place.php on lines 573..573
                    lib/Place.php on lines 574..574
                    lib/Place.php on lines 585..585

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

                                    "min" => round($row['temp']['min']),
                    Severity: Major
                    Found in lib/Place.php and 6 other locations - About 30 mins to fix
                    lib/Place.php on lines 219..219
                    lib/Place.php on lines 220..220
                    lib/Place.php on lines 221..221
                    lib/Place.php on lines 573..573
                    lib/Place.php on lines 574..574
                    lib/Place.php on lines 586..586

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 20.

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

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

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

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

                    Refactorings

                    Further Reading

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

                                $return = PlaceUtility::LatLonWoELookup($tmp[0], $tmp[1]);
                    Severity: Minor
                    Found in lib/Place.php and 1 other location - About 30 mins to fix
                    lib/Images/Image.php on lines 805..805

                    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

                    Blank line found at end of control structure
                    Open

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

                    Blank line found at start of control structure
                    Open

                            foreach ((new GTFS)->getProviders() as $Provider) {
                    Severity: Minor
                    Found in lib/Place.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/Place.php by phpcodesniffer

                    Blank line found at end of control structure
                    Open

                                
                    Severity: Minor
                    Found in lib/Place.php by phpcodesniffer

                    Blank line found at end of control structure
                    Open

                                
                    Severity: Minor
                    Found in lib/Place.php by phpcodesniffer

                    Blank line found at end of control structure
                    Open

                                    
                    Severity: Minor
                    Found in lib/Place.php by phpcodesniffer

                    There must be no space before the colon in a DEFAULT statement
                    Open

                                    default : 
                    Severity: Minor
                    Found in lib/Place.php by phpcodesniffer

                    Blank line found at start of control structure
                    Open

                            if ($return = $Database->fetchOne($query, md5($mckey))) {
                    Severity: Minor
                    Found in lib/Place.php by phpcodesniffer

                    There are no issues that match your filters.

                    Category
                    Status