railpage/railpagecore

View on GitHub
lib/Images/Utility/Finder.php

Summary

Maintainability
F
1 wk
Test Coverage

File Finder.php has 430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Find images
 * @since Version 3.9.1
Severity: Minor
Found in lib/Images/Utility/Finder.php - About 6 hrs to fix

    Function makeQuery has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function makeQuery() {
            
            $basequery = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
                    g.region_name, g.neighbourhood, g.timezone, X(g.point) AS geoplace_lat, Y(g.point) AS geoplace_lon
                FROM image
    Severity: Minor
    Found in lib/Images/Utility/Finder.php - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public static function find() {
            
            $args       = func_get_args(); 
            $Loco       = false;
            $LocoClass  = false;
    Severity: Minor
    Found in lib/Images/Utility/Finder.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    class Finder {
        
        /**
         * Filters
         * @since Version 3.9.1
    Severity: Minor
    Found in lib/Images/Utility/Finder.php by phpmd

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

        public static function getPhotoContext(Image $imageObject, $unapprovedOnly = null) {
            
            $Database = (new AppCore)->getDatabaseConnection(); 
            
            if ($unapprovedOnly == false || $unapprovedOnly == null) {
    Severity: Major
    Found in lib/Images/Utility/Finder.php - About 3 hrs to fix

      Method find has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function find() {
              
              $args       = func_get_args(); 
              $Loco       = false;
              $LocoClass  = false;
      Severity: Major
      Found in lib/Images/Utility/Finder.php - About 2 hrs to fix

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

            public static function getPhotoContext(Image $imageObject, $unapprovedOnly = null) {
                
                $Database = (new AppCore)->getDatabaseConnection(); 
                
                if ($unapprovedOnly == false || $unapprovedOnly == null) {
        Severity: Minor
        Found in lib/Images/Utility/Finder.php - About 2 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            private static function makeQuery() {
                
                $basequery = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
                        g.region_name, g.neighbourhood, g.timezone, X(g.point) AS geoplace_lat, Y(g.point) AS geoplace_lon
                    FROM image
        Severity: Minor
        Found in lib/Images/Utility/Finder.php - About 1 hr to fix

          Method randomImage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function randomImage($namespace, $namespaceKey) {
                  
                  $Database = (new AppCore)->getDatabaseConnection(); 
                  
                  if (is_null($namespace) && !is_null($namespaceKey)) {
          Severity: Minor
          Found in lib/Images/Utility/Finder.php - About 1 hr to fix

            Method GuessCoverPhoto has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function GuessCoverPhoto($searchQuery) {
                    
                    $defaultPhoto = "https://static.railpage.com.au/i/logo-fb.jpg";
                    
                    $cachekey = sprintf("railpage:coverphoto=%s", md5($searchQuery)); 
            Severity: Minor
            Found in lib/Images/Utility/Finder.php - About 1 hr to fix

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

                  public static function randomImage($namespace, $namespaceKey) {
                      
                      $Database = (new AppCore)->getDatabaseConnection(); 
                      
                      if (is_null($namespace) && !is_null($namespaceKey)) {
              Severity: Minor
              Found in lib/Images/Utility/Finder.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 GuessCoverPhoto has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function GuessCoverPhoto($searchQuery) {
                      
                      $defaultPhoto = "https://static.railpage.com.au/i/logo-fb.jpg";
                      
                      $cachekey = sprintf("railpage:coverphoto=%s", md5($searchQuery)); 
              Severity: Minor
              Found in lib/Images/Utility/Finder.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 getPhotoContext() has 115 lines of code. Current threshold is set to 100. Avoid really long methods.
              Open

                  public static function getPhotoContext(Image $imageObject, $unapprovedOnly = null) {
                      
                      $Database = (new AppCore)->getDatabaseConnection(); 
                      
                      if ($unapprovedOnly == false || $unapprovedOnly == null) {
              Severity: Minor
              Found in lib/Images/Utility/Finder.php by phpmd

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

                  public static function find() {
                      
                      $args       = func_get_args(); 
                      $Loco       = false;
                      $LocoClass  = false;
              Severity: Minor
              Found in lib/Images/Utility/Finder.php by phpmd

              The method find() has an NPath complexity of 7778. The configured NPath complexity threshold is 200.
              Open

                  public static function find() {
                      
                      $args       = func_get_args(); 
                      $Loco       = false;
                      $LocoClass  = false;
              Severity: Minor
              Found in lib/Images/Utility/Finder.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 find() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
              Open

                  public static function find() {
                      
                      $args       = func_get_args(); 
                      $Loco       = false;
                      $LocoClass  = false;
              Severity: Minor
              Found in lib/Images/Utility/Finder.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 getPhotoContext() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
              Open

                  public static function getPhotoContext(Image $imageObject, $unapprovedOnly = null) {
                      
                      $Database = (new AppCore)->getDatabaseConnection(); 
                      
                      if ($unapprovedOnly == false || $unapprovedOnly == null) {
              Severity: Minor
              Found in lib/Images/Utility/Finder.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 makeQuery() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
              Open

                  private static function makeQuery() {
                      
                      $basequery = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
                              g.region_name, g.neighbourhood, g.timezone, X(g.point) AS geoplace_lat, Y(g.point) AS geoplace_lon
                          FROM image
              Severity: Minor
              Found in lib/Images/Utility/Finder.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 makeQuery uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                          } else {
                              
                              foreach ($data as $row) {
                                  foreach ($row as $key => $val) {
                                      $where[] = $key;
              Severity: Minor
              Found in lib/Images/Utility/Finder.php by phpmd

              ElseExpression

              Since: 1.4.0

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

              Example

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

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

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

                          } else {
                          
                              $query = "(SELECT image.id, image.provider, image.photo_id, image.captured, image.title, image.description, image.meta FROM image LEFT JOIN image_flags AS f ON image.id = f.image_id WHERE COALESCE(f.rejected, 0) = 0 AND image.id <= ? AND image.id != ? ORDER BY image.captured DESC LIMIT 0, ?)
                                          UNION (SELECT id, image.provider, image.photo_id, image.captured, title, description, meta FROM image WHERE id = ?)
                                          UNION (SELECT image.id, image.provider, image.photo_id, image.captured, image.title, image.description, image.meta FROM image LEFT JOIN image_flags AS f ON image.id = f.image_id WHERE COALESCE(f.rejected, 0) = 0 AND image.id >= ? AND image.id != ? ORDER BY captured ASC LIMIT 0, ?)";
              Severity: Minor
              Found in lib/Images/Utility/Finder.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

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

                  public static function getScreenersChoice() {
                      
                      $Database = (new AppCore)->getDatabaseConnection(); 
                      
                      $query = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 1 other location - About 5 hrs to fix
              lib/Images/Utility/Finder.php on lines 424..454

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

              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

                  public static function getPhotoPool() {
                      
                      $Database = (new AppCore)->getDatabaseConnection(); 
                      
                      $query = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 1 other location - About 5 hrs to fix
              lib/Images/Utility/Finder.php on lines 525..556

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

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

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

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

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

              Refactorings

              Further Reading

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

                      foreach ($result as $key => $data) {
                          $result[$key]['meta'] = json_decode($data['meta'], true); 
                          $result[$key]['meta']['sizes'] = Images::NormaliseSizes($result[$key]['meta']['sizes']); 
                      }
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 1 other location - About 3 hrs to fix
              lib/Images/Images.php on lines 404..407

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

              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 ($arg instanceof Livery) {
                              $Livery = clone $arg;
                              
                              $filter = [ 
                                  "namespace" => $Livery->namespace,
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 2 hrs to fix
              lib/Images/Utility/Finder.php on lines 168..179
              lib/Images/Utility/Finder.php on lines 194..205

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 55.

              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 ($arg instanceof Locomotive) {
                              $Loco = clone $arg;
                              
                              $filter = [ 
                                  "namespace" => $Loco->namespace,
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 2 hrs to fix
              lib/Images/Utility/Finder.php on lines 168..179
              lib/Images/Utility/Finder.php on lines 181..192

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

              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 ($arg instanceof LocoClass) {
                              $LocoClass = clone $arg;
                              
                              $filter = [ 
                                  "namespace" => $LocoClass->namespace,
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 2 hrs to fix
              lib/Images/Utility/Finder.php on lines 181..192
              lib/Images/Utility/Finder.php on lines 194..205

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 55.

              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 (is_array($arg) && isset($arg['region_code'])) {
                              
                              $filter = [ "region_code" => $arg['region_code'] ];
                              
                              self::addFilter("g", $filter);
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 2 hrs to fix
              lib/Images/Utility/Finder.php on lines 121..127
              lib/Images/Utility/Finder.php on lines 137..143

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 52.

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

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

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

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

              Refactorings

              Further Reading

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

                          if (is_array($arg) && isset($arg['country_code'])) {
                              
                              $filter = [ "country_code" => $arg['country_code'] ];
                              
                              self::addFilter("g", $filter);
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 2 hrs to fix
              lib/Images/Utility/Finder.php on lines 129..135
              lib/Images/Utility/Finder.php on lines 137..143

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 52.

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

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

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

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

              Refactorings

              Further Reading

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

                          if (is_array($arg) && isset($arg['geoplace'])) {
                              
                              $filter = [ "geoplace" => $arg['geoplace'] ];
                              
                              self::addFilter("image", $filter);
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 2 hrs to fix
              lib/Images/Utility/Finder.php on lines 121..127
              lib/Images/Utility/Finder.php on lines 129..135

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 52.

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

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

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

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

              Refactorings

              Further Reading

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

                                  foreach ($data[2] as $key => $val) {
                                      $subwhere[] = $alias . "." . $key; 
                                      $params[] = $val;
                                  }
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 1 other location - About 1 hr to fix
              lib/Images/Utility/Finder.php on lines 275..278

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

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

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

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

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

              Refactorings

              Further Reading

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

                              foreach ($data[1] as $key => $val) {
                                  $where[] = $alias . "." . $key;
                                  $params[] = $val;
                              }
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 1 other location - About 1 hr to fix
              lib/Images/Utility/Finder.php on lines 285..288

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 38.

              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

                                  $subquery = " image.id IN ( SELECT " . $alias . ".image_id FROM " . $table . " AS " . $alias . " WHERE ";
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 1 hr to fix
              lib/GTFS/StandardProvider.php on lines 114..132
              lib/Jobs/Utility/SlugUtility.php on lines 37..37

              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

                          $row['sizes'] = Images::normaliseSizes($row['meta']['sizes']); 
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 3 other locations - About 45 mins to fix
              lib/Images/Utility/Finder.php on lines 649..649
              lib/Images/Utility/Finder.php on lines 704..704
              lib/Images/Utility/Finder.php on lines 784..784

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

                          $row['sizes'] = Images::normaliseSizes($row['meta']['sizes']);
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 3 other locations - About 45 mins to fix
              lib/Images/Utility/Finder.php on lines 704..704
              lib/Images/Utility/Finder.php on lines 733..733
              lib/Images/Utility/Finder.php on lines 784..784

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

                          $row['sizes'] = Images::normaliseSizes($row['meta']['sizes']); 
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 3 other locations - About 45 mins to fix
              lib/Images/Utility/Finder.php on lines 649..649
              lib/Images/Utility/Finder.php on lines 733..733
              lib/Images/Utility/Finder.php on lines 784..784

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

                      $photo['sizes'] = Images::NormaliseSizes($photo['meta']['sizes']); 
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 3 other locations - About 45 mins to fix
              lib/Images/Utility/Finder.php on lines 649..649
              lib/Images/Utility/Finder.php on lines 704..704
              lib/Images/Utility/Finder.php on lines 733..733

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

                          $row['url'] = Url::CreateFromImageID($row['id'])->getURLs();
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 3 other locations - About 45 mins to fix
              lib/Images/Favourites.php on lines 72..72
              lib/Images/PhotoOfTheWeek.php on lines 153..153
              lib/Images/PhotoOfTheWeek.php on lines 215..215

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

                      $cachekey = sprintf("railpage:coverphoto=%s", md5($searchQuery)); 
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 5 other locations - About 40 mins to fix
              lib/Downloads/DownloadsFactory.php on lines 34..34
              lib/Glossary/Glossary.php on lines 85..85
              lib/Images/Collage.php on lines 229..229
              lib/Timetables/Train.php on lines 279..279
              lib/Url.php on lines 115..115

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 24.

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

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

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

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

              Refactorings

              Further Reading

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

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

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 22.

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

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

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

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

              Refactorings

              Further Reading

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

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

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 22.

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

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

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

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

              Refactorings

              Further Reading

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

                          if ($size['width'] > 400 && $size['height'] > 300) {
                              
                              $Memcached->save($cachekey, $size['source'], 0); 
                              
                              return $size['source'];
              Severity: Minor
              Found in lib/Images/Utility/Finder.php and 1 other location - About 35 mins to fix
              lib/Images/Utility/ImageUtility.php on lines 41..43

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 22.

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

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

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

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

              Refactorings

              Further Reading

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

                              $latlng = explode(",", $arg['latlng']);
              Severity: Major
              Found in lib/Images/Utility/Finder.php and 3 other locations - About 30 mins to fix
              lib/Forums/Forums.php on lines 553..553
              lib/News/Topic.php on lines 236..236
              lib/Railcams/Camera.php on lines 279..279

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

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

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 20.

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

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

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

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

              Refactorings

              Further Reading

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

                      if (is_null($namespace) && is_null($namespaceKey)) {
                          
                          $query = "SELECT * FROM image AS r1 JOIN (SELECT CEIL(RAND() * (SELECT MAX(id) FROM image)) AS randomid) AS r2 WHERE r1.id >= r2.randomid ORDER BY r1.id ASC LIMIT 1";
                          
                          $row = $Database->fetchRow($query); 
              Severity: Minor
              Found in lib/Images/Utility/Finder.php and 2 other locations - About 30 mins to fix
              lib/News/Base.php on lines 79..104
              lib/News/Topic.php on lines 279..312

              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

                          $photoCollection instanceof Collection ? $photoCollection->namespace : $photoCollection['namespace'],
              Severity: Minor
              Found in lib/Images/Utility/Finder.php and 1 other location - About 30 mins to fix
              lib/Images/Utility/Finder.php on lines 481..481

              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

                      $SphinxQL->select()->from("idx_images")->match(array("title", "description"), $words, true); 
              Severity: Minor
              Found in lib/Images/Utility/Finder.php and 1 other location - About 30 mins to fix
              lib/News/Article.php on lines 963..965

              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

                          $photoCollection instanceof Collection ? $photoCollection->id : $photoCollection['id'],
              Severity: Minor
              Found in lib/Images/Utility/Finder.php and 1 other location - About 30 mins to fix
              lib/Images/Utility/Finder.php on lines 480..480

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 20.

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

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

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

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

              Refactorings

              Further Reading

              Blank line found at end of control structure
              Open

                              

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

                  }

              Blank line found at end of control structure
              Open

                              

              Blank line found at start of control structure
              Open

                      if ($unapprovedOnly == false || $unapprovedOnly == null) {

              Blank line found at start of control structure
              Open

                      if (!is_null($namespace)) {

              Blank line found at start of control structure
              Open

                          if (is_array($arg) && isset($arg['country_code'])) {

              Blank line found at start of control structure
              Open

                          if (is_array($arg) && isset($arg['region_code'])) {

              Blank line found at start of control structure
              Open

                          if (is_array($arg) && isset($arg['decade'])) {

              Blank line found at end of control structure
              Open

                              

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

                  }

              Blank line found at end of control structure
              Open

                          

              Blank line found at start of control structure
              Open

                          if ($size['width'] > 400 && $size['height'] > 300) {

              Blank line found at start of control structure
              Open

                          } else {

              Blank line found at end of control structure
              Open

                              

              Blank line found at end of control structure
              Open

                              

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

                  }

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

                  }

              Blank line found at end of control structure
              Open

                              

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

                  }

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

                  }

              Blank line found at start of control structure
              Open

                          if (is_array($arg) && isset($arg['geoplace'])) {

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

                  }

              Blank line found at start of control structure
              Open

                          if ($imageObject->DateCaptured instanceof DateTime) {

              Blank line found at end of control structure
              Open

                          

              Blank line found at start of control structure
              Open

                      } elseif ($imageObject->DateCaptured instanceof DateTime) {

              Blank line found at start of control structure
              Open

                          if (is_array($arg) && isset($arg['latlng'])) {

              Blank line found at end of control structure
              Open

                          

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

                  }

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

                  }

              Blank line found at start of control structure
              Open

                          } else {

              Blank line found at end of control structure
              Open

                          

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

                  }

              Blank line found at start of control structure
              Open

                      if (is_null($namespace) && is_null($namespaceKey)) {

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

                  }

              Blank line found at end of control structure
              Open

                              

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

                  }

              Blank line found at end of control structure
              Open

                              

              Blank line found at start of control structure
              Open

                      } elseif (!$imageObject->DateCaptured instanceof DateTime) {

              There are no issues that match your filters.

              Category
              Status