railpage/railpagecore

View on GitHub
lib/Locations/Location.php

Summary

Maintainability
F
6 days
Test Coverage

File Location.php has 417 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
    /**
     * Locations module 
     * @since Version 3.0
     * @package Railpage
Severity: Minor
Found in lib/Locations/Location.php - About 6 hrs to fix

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

        class Location extends Locations {
            
            /**
             * Registry cache key
             * @since Version 3.9.1
    Severity: Minor
    Found in lib/Locations/Location.php by phpmd

    Method getPhotosForSite has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function getPhotosForSite($num = 10, $start = 0) {
                
                $Place = new Place($this->lat, $this->lon); 
                
                return $Place->getPhotosFromSphinx($num); 
    Severity: Major
    Found in lib/Locations/Location.php - About 2 hrs to fix

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

              public function commit() {
                  
                  /**
                   * Fill in the gaps with the new Place object
                   */
      Severity: Major
      Found in lib/Locations/Location.php - About 2 hrs to fix

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

                private function load() {
                    
                    $this->mckey = sprintf("railpage:locations.location=%d", $this->id); 
                    
                    if (!$row = $this->Memcached->fetch($this->mckey)) {
        Severity: Minor
        Found in lib/Locations/Location.php - About 1 hr to fix

          The class Location has 26 fields. Consider redesigning Location to keep the number of fields under 15.
          Open

              class Location extends Locations {
                  
                  /**
                   * Registry cache key
                   * @since Version 3.9.1
          Severity: Minor
          Found in lib/Locations/Location.php by phpmd

          TooManyFields

          Since: 0.1

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

          Example

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

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

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

                  private function validate() {
                      
                      if (!filter_var($this->lat, FILTER_VALIDATE_FLOAT)) {
                          throw new Exception("Cannot validate location - no latitude value"); 
                      }
          Severity: Minor
          Found in lib/Locations/Location.php - About 1 hr to fix

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

                    private function validate() {
                        
                        if (!filter_var($this->lat, FILTER_VALIDATE_FLOAT)) {
                            throw new Exception("Cannot validate location - no latitude value"); 
                        }
            Severity: Minor
            Found in lib/Locations/Location.php - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                    public function commit() {
                        
                        /**
                         * Fill in the gaps with the new Place object
                         */
            Severity: Minor
            Found in lib/Locations/Location.php - About 1 hr to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                    private function load() {
                        
                        $this->mckey = sprintf("railpage:locations.location=%d", $this->id); 
                        
                        if (!$row = $this->Memcached->fetch($this->mckey)) {
            Severity: Minor
            Found in lib/Locations/Location.php - About 45 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                    private function geocode() {
                        
                        if (!empty($this->region) && !empty($this->country) && !empty($this->locality)) {
                            #return;
                        }
            Severity: Minor
            Found in lib/Locations/Location.php - About 25 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            The method load() has an NPath complexity of 720. The configured NPath complexity threshold is 200.
            Open

                    private function load() {
                        
                        $this->mckey = sprintf("railpage:locations.location=%d", $this->id); 
                        
                        if (!$row = $this->Memcached->fetch($this->mckey)) {
            Severity: Minor
            Found in lib/Locations/Location.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 getPhotosForSite() has 105 lines of code. Current threshold is set to 100. Avoid really long methods.
            Open

                    public function getPhotosForSite($num = 10, $start = 0) {
                        
                        $Place = new Place($this->lat, $this->lon); 
                        
                        return $Place->getPhotosFromSphinx($num); 
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

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

                    private function geocode() {
                        
                        if (!empty($this->region) && !empty($this->country) && !empty($this->locality)) {
                            #return;
                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

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

                    private function validate() {
                        
                        if (!filter_var($this->lat, FILTER_VALIDATE_FLOAT)) {
                            throw new Exception("Cannot validate location - no latitude value"); 
                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

            NPathComplexity

            Since: 0.1

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

            Example

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

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

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

                    private function validate() {
                        
                        if (!filter_var($this->lat, FILTER_VALIDATE_FLOAT)) {
                            throw new Exception("Cannot validate location - no latitude value"); 
                        }
            Severity: Minor
            Found in lib/Locations/Location.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 load() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
            Open

                    private function load() {
                        
                        $this->mckey = sprintf("railpage:locations.location=%d", $this->id); 
                        
                        if (!$row = $this->Memcached->fetch($this->mckey)) {
            Severity: Minor
            Found in lib/Locations/Location.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 recommend has a boolean flag argument $user_id, which is a certain sign of a Single Responsibility Principle violation.
            Open

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

                    public function doesUserLike($user_id = false) {
            Severity: Minor
            Found in lib/Locations/Location.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 $location_id, which is a certain sign of a Single Responsibility Principle violation.
            Open

                    public function __construct($location_id = false) {
            Severity: Minor
            Found in lib/Locations/Location.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 '313', column '18').
            Open

                    private function load() {
                        
                        $this->mckey = sprintf("railpage:locations.location=%d", $this->id); 
                        
                        if (!$row = $this->Memcached->fetch($this->mckey)) {
            Severity: Minor
            Found in lib/Locations/Location.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 '293', column '50').
            Open

                    public function __construct($location_id = false) {
                        
                        parent::__construct(); 
                        
                        if ($id = filter_var($location_id, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.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 '722', column '17').
            Open

                    public function getPhotosForSite($num = 10, $start = 0) {
                        
                        $Place = new Place($this->lat, $this->lon); 
                        
                        return $Place->getPhotosFromSphinx($num); 
            Severity: Minor
            Found in lib/Locations/Location.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 '290', column '17').
            Open

                    public function __construct($location_id = false) {
                        
                        parent::__construct(); 
                        
                        if ($id = filter_var($location_id, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.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 commit uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $this->db->insert("location", $data);
                            $this->id = $this->db->lastInsertId();
                            
                            $this->Memcached->delete("railpage:locations.newest");
            Severity: Minor
            Found in lib/Locations/Location.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 '835', column '17').
            Open

                    public function doesUserLike($user_id = false) {
                        
                        if ($user_id instanceof User) {
                            $user_id = $user_id->id;
                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

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

            Example

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

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

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

                        if ($row = $this->db->fetchRow($query, array($this->id, $user_id))) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

            UnusedLocalVariable

            Since: 0.2

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

            Example

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

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

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

                    private function createSlug() {
                        
                        $proposal = ContentUtility::generateUrlSlug($this->name);
                        
                        $result = $this->db->fetchAll("SELECT id FROM location WHERE slug = ?", $proposal); 
            Severity: Major
            Found in lib/Locations/Location.php and 3 other locations - About 3 hrs to fix
            lib/Help/Category.php on lines 140..151
            lib/Ideas/Category.php on lines 142..154
            lib/Locos/LocoClass.php on lines 783..794

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 73.

            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 = $this->Memcached->fetch($this->mckey)) {
                            $query = "SELECT location.*, u.username, count(locations_like.location_id) AS likes FROM location LEFT JOIN locations_like ON location.id = locations_like.location_id LEFT JOIN nuke_users AS u ON u.user_id = location.user_id WHERE location.id = ?";
                            
                            $row = $this->db->fetchRow($query, $this->id);
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 2 other locations - About 1 hr to fix
            lib/Locos/Liveries/Livery.php on lines 185..188
            lib/fwlink.php on lines 108..114

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 48.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (!isset($row) || !is_array($row) || count($row) === 0 || !filter_var($row['id'], FILTER_VALIDATE_INT)) {
            Severity: Major
            Found in lib/Locations/Location.php and 1 other location - About 1 hr to fix
            lib/Locations/Country.php on lines 185..185

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 33.

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

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

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

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

            Refactorings

            Further Reading

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

                        foreach ($nulls as $var) {
                            if (is_null($this->$var)) {
                                $this->$var = "";
                            }
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 3 other locations - About 1 hr to fix
            lib/Locos/Liveries/Livery.php on lines 298..302
            lib/Locos/Locomotive.php on lines 648..652
            lib/Organisations/Organisation.php on lines 327..331

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 33.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 32.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 32.

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

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

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

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

            Refactorings

            Further Reading

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

                        $find = array(
                            "@Victoria@i",
                            "@New South Wales@i",
                            "@Queensland@i",
                            "@South Australia@i",
            Severity: Major
            Found in lib/Locations/Location.php and 3 other locations - About 1 hr to fix
            lib/Images/Collage.php on lines 182..191
            lib/Images/Exif.php on lines 128..137
            lib/Locations/Location.php on lines 608..617

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

                        $replace = array(
                            "VIC", 
                            "NSW",
                            "QLD",
                            "SA",
            Severity: Major
            Found in lib/Locations/Location.php and 3 other locations - About 1 hr to fix
            lib/Images/Collage.php on lines 182..191
            lib/Images/Exif.php on lines 128..137
            lib/Locations/Location.php on lines 597..606

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 32.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (empty(filter_var($this->name, FILTER_SANITIZE_STRING))) {
                            throw new Exception("Cannot validate location - no name specified"); 
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 1 other location - About 1 hr to fix
            lib/Locations/Location.php on lines 428..430

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 32.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (empty(filter_var($this->desc, FILTER_SANITIZE_STRING))) {
                            throw new Exception("Cannot validate location - no description specified"); 
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 1 other location - About 1 hr to fix
            lib/Locations/Location.php on lines 424..426

            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/Locations/Location.php and 2 other locations - About 1 hr to fix
            lib/Organisations/Organisation.php on lines 446..446
            lib/Place.php on lines 366..366

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 31.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (!filter_var($this->topicid, FILTER_VALIDATE_INT)) {
                            $this->topicid = 0;
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 11 other locations - About 1 hr to fix
            lib/Downloads/Download.php on lines 297..299
            lib/Downloads/Download.php on lines 301..303
            lib/Downloads/Download.php on lines 305..307
            lib/Feedback/FeedbackItem.php on lines 184..186
            lib/Forums/Category.php on lines 166..168
            lib/Gallery/Image.php on lines 334..336
            lib/Ideas/Idea.php on lines 268..270
            lib/Ideas/Idea.php on lines 272..274
            lib/Locations/Location.php on lines 440..442
            lib/Locos/Operator.php on lines 129..131
            lib/Users/User.php on lines 1208..1210

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 31.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (!filter_var($this->zoom, FILTER_VALIDATE_INT)) {
                            $this->zoom = 12;
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 11 other locations - About 1 hr to fix
            lib/Downloads/Download.php on lines 297..299
            lib/Downloads/Download.php on lines 301..303
            lib/Downloads/Download.php on lines 305..307
            lib/Feedback/FeedbackItem.php on lines 184..186
            lib/Forums/Category.php on lines 166..168
            lib/Gallery/Image.php on lines 334..336
            lib/Ideas/Idea.php on lines 268..270
            lib/Ideas/Idea.php on lines 272..274
            lib/Locations/Location.php on lines 452..454
            lib/Locos/Operator.php on lines 129..131
            lib/Users/User.php on lines 1208..1210

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

                        $this->url->googlemaps = sprintf("http://maps.google.com.au/maps?q=%s,%s", $this->lat, $this->lon); 
            Severity: Major
            Found in lib/Locations/Location.php and 3 other locations - About 55 mins to fix
            lib/Images/Camera.php on lines 132..132
            lib/Images/Competition.php on lines 792..792
            lib/Images/Competition.php on lines 793..793

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

                        if (!filter_var($this->active)) {
                            $this->active = self::STATUS_INACTIVE; 
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 4 other locations - About 55 mins to fix
            lib/Events/Event.php on lines 262..264
            lib/Locos/Correction.php on lines 187..189
            lib/News/Article.php on lines 782..784
            lib/Newsletters/Newsletter.php on lines 155..157

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

                            "directions_pt" => is_object($this->directions_pt) ? $this->directions_pt->__toString() : $this->directions_pt,
            Severity: Major
            Found in lib/Locations/Location.php and 5 other locations - About 50 mins to fix
            lib/Locations/Location.php on lines 957..957
            lib/Locations/Location.php on lines 958..958
            lib/Locations/Location.php on lines 959..959
            lib/Locations/Location.php on lines 960..960
            lib/Locations/Location.php on lines 962..962

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

                            "traffic" => is_object($this->traffic) ? $this->traffic->__toString() : $this->traffic,
            Severity: Major
            Found in lib/Locations/Location.php and 5 other locations - About 50 mins to fix
            lib/Locations/Location.php on lines 958..958
            lib/Locations/Location.php on lines 959..959
            lib/Locations/Location.php on lines 960..960
            lib/Locations/Location.php on lines 961..961
            lib/Locations/Location.php on lines 962..962

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

                        if (filter_var($this->id, FILTER_VALIDATE_INT) && $this->id > 0) {
                            $where = array(
                                "id = ?" => $this->id
                            );
                            
            Severity: Major
            Found in lib/Locations/Location.php and 4 other locations - About 50 mins to fix
            lib/Chronicle/Entry.php on lines 263..271
            lib/Ideas/Idea.php on lines 574..576
            lib/Jobs/Job.php on lines 278..284
            lib/Railcams/Camera.php on lines 282..284

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 27.

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

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

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

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

            Refactorings

            Further Reading

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

                            "environment" => is_object($this->environment) ? $this->environment->__toString() : $this->environment,
            Severity: Major
            Found in lib/Locations/Location.php and 5 other locations - About 50 mins to fix
            lib/Locations/Location.php on lines 957..957
            lib/Locations/Location.php on lines 959..959
            lib/Locations/Location.php on lines 960..960
            lib/Locations/Location.php on lines 961..961
            lib/Locations/Location.php on lines 962..962

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

                            "directions_parking" => is_object($this->directions_parking) ? $this->directions_parking->__toString() : $this->directions_parking,
            Severity: Major
            Found in lib/Locations/Location.php and 5 other locations - About 50 mins to fix
            lib/Locations/Location.php on lines 957..957
            lib/Locations/Location.php on lines 958..958
            lib/Locations/Location.php on lines 959..959
            lib/Locations/Location.php on lines 961..961
            lib/Locations/Location.php on lines 962..962

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

                            "amenities" => is_object($this->amenities) ? $this->amenities->__toString() : $this->amenities,
            Severity: Major
            Found in lib/Locations/Location.php and 5 other locations - About 50 mins to fix
            lib/Locations/Location.php on lines 957..957
            lib/Locations/Location.php on lines 958..958
            lib/Locations/Location.php on lines 959..959
            lib/Locations/Location.php on lines 960..960
            lib/Locations/Location.php on lines 961..961

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

                            "directions_driving" => is_object($this->directions_driving) ? $this->directions_driving->__toString() : $this->directions_driving,
            Severity: Major
            Found in lib/Locations/Location.php and 5 other locations - About 50 mins to fix
            lib/Locations/Location.php on lines 957..957
            lib/Locations/Location.php on lines 958..958
            lib/Locations/Location.php on lines 960..960
            lib/Locations/Location.php on lines 961..961
            lib/Locations/Location.php on lines 962..962

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

                            if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                                $this->load(); 
                            }
            Severity: Major
            Found in lib/Locations/Location.php and 4 other locations - About 45 mins to fix
            lib/Glossary/Entry.php on lines 211..213
            lib/Locos/Locomotive.php on lines 347..349
            lib/Users/User.php on lines 984..986
            lib/Users/User.php on lines 2368..2370

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

                            if (!empty($Place->Region->name)) {
                                $this->region = $Place->Region->name;
                            }
            Severity: Minor
            Found in lib/Locations/Location.php and 1 other location - About 45 mins to fix
            lib/Locations/Location.php on lines 588..590

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

                            if (!empty($Place->Country->code)) {
                                $this->country = $Place->Country->code;
                            }
            Severity: Minor
            Found in lib/Locations/Location.php and 1 other location - About 45 mins to fix
            lib/Locations/Location.php on lines 592..594

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

                        $nulls = [ "traffic", "environment", "amenities", "directions_pt", "directions_driving", "directions_parking" ];
            Severity: Minor
            Found in lib/Locations/Location.php and 1 other location - About 45 mins to fix
            lib/Organisations/Organisation.php on lines 325..325

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

                        if (empty($this->id)) {
                            throw new Exception("Cannot reject location - no location created yet"); 
                            return false;
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 17 other locations - About 45 mins to fix
            lib/Jobs/Job.php on lines 230..233
            lib/Jobs/Job.php on lines 243..246
            lib/Links/Link.php on lines 136..139
            lib/Links/Link.php on lines 141..144
            lib/Links/Link.php on lines 146..149
            lib/Locations/Location.php on lines 881..884
            lib/Locos/Type.php on lines 117..120
            lib/Locos/WheelArrangement.php on lines 161..164
            lib/News/Topic.php on lines 337..340
            lib/News/Topic.php on lines 356..359
            lib/Sightings/Sighting.php on lines 219..222
            lib/Sightings/Sighting.php on lines 224..227
            lib/Sightings/Sighting.php on lines 229..232
            lib/Sightings/Sighting.php on lines 234..237
            lib/SiteEvent.php on lines 148..151
            lib/SiteEvent.php on lines 153..156
            lib/SiteEvent.php on lines 158..161

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 25.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (empty($this->id)) {
                            throw new Exception("Cannot approve location - no location created yet"); 
                            return false;
                        }
            Severity: Major
            Found in lib/Locations/Location.php and 17 other locations - About 45 mins to fix
            lib/Jobs/Job.php on lines 230..233
            lib/Jobs/Job.php on lines 243..246
            lib/Links/Link.php on lines 136..139
            lib/Links/Link.php on lines 141..144
            lib/Links/Link.php on lines 146..149
            lib/Locations/Location.php on lines 899..902
            lib/Locos/Type.php on lines 117..120
            lib/Locos/WheelArrangement.php on lines 161..164
            lib/News/Topic.php on lines 337..340
            lib/News/Topic.php on lines 356..359
            lib/Sightings/Sighting.php on lines 219..222
            lib/Sightings/Sighting.php on lines 224..227
            lib/Sightings/Sighting.php on lines 229..232
            lib/Sightings/Sighting.php on lines 234..237
            lib/SiteEvent.php on lines 148..151
            lib/SiteEvent.php on lines 153..156
            lib/SiteEvent.php on lines 158..161

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 25.

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

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

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

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

            Refactorings

            Further Reading

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

                        $this->Memcached->save($cachekey, $return, strtotime("+1 day")); 
            Severity: Major
            Found in lib/Locations/Location.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/Locations.php on lines 76..76
            lib/Locations/Locations.php on lines 127..127
            lib/Locations/Locations.php on lines 161..161
            lib/Locations/Locations.php on lines 474..474
            lib/Locos/Locomotive.php on lines 1227..1227
            lib/Locos/Locomotive.php on lines 1538..1538
            lib/Locos/Locos.php on lines 238..238
            lib/PrivateMessages/Folder.php on lines 259..259
            lib/Users/Base.php on lines 82..82
            lib/Users/Timeline.php on lines 241..241
            lib/Place.php on lines 600..600

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 24.

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

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

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

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

            Refactorings

            Further Reading

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

                        if (!$this->id || !$this->db) {
                            return false;
                        }
            Severity: Minor
            Found in lib/Locations/Location.php and 1 other location - About 40 mins to fix
            lib/News/Article.php on lines 571..573

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

                            $this->Image = new MapImage($this->lat, $this->lon);
            Severity: Minor
            Found in lib/Locations/Location.php and 2 other locations - About 40 mins to fix
            lib/Chronicle/Entry.php on lines 163..163
            lib/GTFS/StandardStop.php on lines 114..114

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 23.

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

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

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

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

            Refactorings

            Further Reading

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

                        if ($row = $this->db->fetchRow($query, array($this->id, $user_id))) {
            Severity: Minor
            Found in lib/Locations/Location.php and 1 other location - About 35 mins to fix
            lib/News/Topic.php on lines 409..411

            Duplicated Code

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

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

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

            Tuning

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

                        $id = PlaceUtility::findGeoPlaceID($this->lat, $this->lon); 
            Severity: Major
            Found in lib/Locations/Location.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/Place.php on lines 490..490

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 21.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 21.

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

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

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

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

            Refactorings

            Further Reading

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

                            $Place = Place::Factory($this->lat, $this->lon); 
            Severity: Major
            Found in lib/Locations/Location.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 686..686
            lib/Place.php on lines 490..490

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 21.

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

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

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

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

            Refactorings

            Further Reading

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

                        $data = array(
                            "location_id" => $this->id,
                            "user_id" => $user_id
                        );
            Severity: Major
            Found in lib/Locations/Location.php and 4 other locations - About 30 mins to fix
            lib/PrivateMessages/Message.php on lines 528..531
            lib/Users/Group.php on lines 304..307
            lib/Users/Group.php on lines 327..330
            lib/Users/Group.php on lines 504..507

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 20.

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

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

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

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

            Refactorings

            Further Reading

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

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

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 20.

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

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

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

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

            Refactorings

            Further Reading

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

                        if ($result = $this->Memcached->fetch($cachekey)) {
                            return $result;
                        }
            Severity: Major
            Found in lib/Locations/Location.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/Locations.php on lines 99..101
            lib/Locos/Locomotive.php on lines 1206..1208
            lib/Locos/Locomotive.php on lines 1500..1502
            lib/Users/Timeline.php on lines 209..211
            lib/Place.php on lines 383..385
            lib/Place.php on lines 482..484

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 20.

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

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

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

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

            Refactorings

            Further Reading

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

                            $this->id = $this->db->fetchOne("SELECT id FROM location WHERE slug = ?", $id); 
            Severity: Minor
            Found in lib/Locations/Location.php and 1 other location - About 30 mins to fix
            lib/Organisations/Organisation.php on lines 193..193

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 20.

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

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

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

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

            Refactorings

            Further Reading

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

                            $this->Region = new Region($row['country'], $row['region_slug']);
            Severity: Minor
            Found in lib/Locations/Location.php and 1 other location - About 30 mins to fix
            lib/Timetables/Timetables.php on lines 117..117

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 20.

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

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

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

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

            Refactorings

            Further Reading

            The parameter $user_id is not named in camelCase.
            Open

                    public function recommend($user_id = false) {
                        
                        if ($user_id instanceof User) {
                            $user_id = $user_id->id;
                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

            CamelCaseParameterName

            Since: 0.2

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

            Example

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

            Source

            The parameter $location_id is not named in camelCase.
            Open

                    public function __construct($location_id = false) {
                        
                        parent::__construct(); 
                        
                        if ($id = filter_var($location_id, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

            CamelCaseParameterName

            Since: 0.2

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

            Example

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

            Source

            The parameter $user_id is not named in camelCase.
            Open

                    public function doesUserLike($user_id = false) {
                        
                        if ($user_id instanceof User) {
                            $user_id = $user_id->id;
                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpmd

            CamelCaseParameterName

            Since: 0.2

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

            Example

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

            Source

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

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

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $locality;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $date_modified;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $username;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!empty($this->region) && !empty($this->country) && !empty($this->locality)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            if (!empty($Place->Region->name)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->id)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function getPhotosForSite($num = 10, $start = 0) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($row = $this->db->fetchRow($query, array($this->id, $user_id))) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $traffic;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $amenities;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty(filter_var($this->desc, FILTER_SANITIZE_STRING))) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!filter_var($this->zoom, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $country;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    private function geocode() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $active;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $id; 
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($id != $this->geoplace_id) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function getDates() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $environment;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty(filter_var($this->name, FILTER_SANITIZE_STRING))) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $Region;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->region)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!empty($this->lat) && !empty($this->lon)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $name;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!filter_var($this->topicid, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $zoom;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $user_id;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $directions_driving;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $url;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!isset($row) || !is_array($row) || count($row) === 0 || !filter_var($row['id'], FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 0 spaces, found 4
            Open

                }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->region) || empty($this->country)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!filter_var($user_id, FILTER_VALIDATE_INT)) { 
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function reject() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function getContributors() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $lon;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $likes;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (isset($row)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 0 spaces, found 4
            Open

                class Location extends Locations {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $lat;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($id = filter_var($location_id, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        } elseif (is_string($location_id) && $id = filter_var($location_id, FILTER_SANITIZE_STRING)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    private function load() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        foreach ($nulls as $var) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (filter_var($this->id, FILTER_VALIDATE_INT) && $this->id > 0) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($result = $this->Memcached->fetch($cachekey)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function approve() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->id)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $topicid;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!$this->id || !$this->db) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $date_added;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->slug)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function __construct($location_id = false) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function commit() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        foreach ($this->db->fetchAll($query, $params) as $data) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!filter_var($user_id, FILTER_VALIDATE_INT)) { 
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $desc;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->slug) && filter_var($this->id, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    private function validate() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            if (is_null($this->$var)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->region)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function __toString() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $slug;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($this->geoplace_id == 0) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function doesUserLike($user_id = false) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $region;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    private function createSlug() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!filter_var($this->lat, FILTER_VALIDATE_FLOAT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $directions_parking;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            if (!empty($Place->Country->code)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    private $geoplace_id;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!$row = $this->Memcached->fetch($this->mckey)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (count($result)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        } else {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!filter_var($this->lon, FILTER_VALIDATE_FLOAT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($user_id instanceof User) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public $directions_pt;
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 12 spaces, found 16
            Open

                            if (filter_var($this->id, FILTER_VALIDATE_INT)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (!filter_var($this->active)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($this->doesUserLike($user_id)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        foreach ($this->db->fetchAll($query, array("locations", "id", $this->id, $this->user_id)) as $row) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if ($user_id instanceof User) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->region) || empty($this->country)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    private function updateGeoplace() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function recommend($user_id = false) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        if (empty($this->id)) {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    public function getArray() {
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 8 spaces, found 12
            Open

                        }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            Line indented incorrectly; expected 4 spaces, found 8
            Open

                    }
            Severity: Minor
            Found in lib/Locations/Location.php by phpcodesniffer

            There are no issues that match your filters.

            Category
            Status