railpage/railpagecore

View on GitHub
lib/Images/Exif.php

Summary

Maintainability
F
4 days
Test Coverage

File Exif.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * EXIF data handler
 * @since Version 3.10.0
Severity: Minor
Found in lib/Images/Exif.php - About 3 hrs to fix

    Method formatExif has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function formatExif($exif) {
            
            $format = array();
            
            // Aperture
    Severity: Minor
    Found in lib/Images/Exif.php - About 2 hrs to fix

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

          private function getExifIDs($exif) {
              
              $required = [ 
                  "camera_make", 
                  "camera_model",
      Severity: Minor
      Found in lib/Images/Exif.php - About 1 hr to fix

        Method getImageExif has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getImageExif(Image $imageObject, $force = false) {
                
                Debug::LogCLI("Fetching EIXF data for image ID " . $imageObject->id);
                
                if (!$force && isset($imageObject->meta['exif']) && $imageObject->meta['exif_format_version'] >= self::EXIF_FORMAT_VERSION) {
        Severity: Minor
        Found in lib/Images/Exif.php - About 1 hr to fix

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

              private static function normaliseCameraMake($make) {
                  
                  $findTheseMakes = [ 
                      "NIKON CORPORATION",
                      "NIKON",
          Severity: Minor
          Found in lib/Images/Exif.php - About 1 hr to fix

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

                private function createNewExif($type, $exif) {
                    
                    switch ($type) {
                        
                        case "camera_id" :
            Severity: Minor
            Found in lib/Images/Exif.php - About 1 hr to fix

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

                  public function formatExif($exif) {
                      
                      $format = array();
                      
                      // Aperture
              Severity: Minor
              Found in lib/Images/Exif.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 createNewExif has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function createNewExif($type, $exif) {
                      
                      switch ($type) {
                          
                          case "camera_id" :
              Severity: Minor
              Found in lib/Images/Exif.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 getExifIDs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getExifIDs($exif) {
                      
                      $required = [ 
                          "camera_make", 
                          "camera_model",
              Severity: Minor
              Found in lib/Images/Exif.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 formatExif() has an NPath complexity of 320. The configured NPath complexity threshold is 200.
              Open

                  public function formatExif($exif) {
                      
                      $format = array();
                      
                      // Aperture
              Severity: Minor
              Found in lib/Images/Exif.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 formatExif() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
              Open

                  public function formatExif($exif) {
                      
                      $format = array();
                      
                      // Aperture
              Severity: Minor
              Found in lib/Images/Exif.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 getImageExif has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  public function getImageExif(Image $imageObject, $force = false) {
              Severity: Minor
              Found in lib/Images/Exif.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

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

                      $replaceWith = [
                          "Nikon",
                          "Nikon",
                          "Kodak",
                          "",
              Severity: Major
              Found in lib/Images/Exif.php and 1 other location - About 2 hrs to fix
              lib/Images/Exif.php on lines 193..209

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 53.

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

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

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

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

              Refactorings

              Further Reading

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

                      $findTheseMakes = [ 
                          "NIKON CORPORATION",
                          "NIKON",
                          "EASTMAN KODAK COMPANY",
                          "DIGITAL CAMERA",
              Severity: Major
              Found in lib/Images/Exif.php and 1 other location - About 2 hrs to fix
              lib/Images/Exif.php on lines 211..227

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 53.

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

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

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

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

              Refactorings

              Further Reading

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

                      if (isset($exif['aperture'])) {
                          $format[] = array(
                              "icon" => "https://static.railpage.com.au/i/icons/camera119.svg",
                              "label" => "Aperture",
                              "value" => sprintf("<em>ƒ</em>/%s", $exif['aperture'])
              Severity: Major
              Found in lib/Images/Exif.php and 1 other location - About 1 hr to fix
              lib/Images/Exif.php on lines 391..397

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 50.

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

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

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

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

              Refactorings

              Further Reading

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

                      if (isset($exif['focal_length'])) {
                          $format[] = array(
                              "icon" => "https://static.railpage.com.au/i/icons/tool292.svg", 
                              "label" => "Focal length", 
                              "value" => sprintf("%smm", $exif['focal_length'])
              Severity: Major
              Found in lib/Images/Exif.php and 1 other location - About 1 hr to fix
              lib/Images/Exif.php on lines 350..356

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 50.

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

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

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

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

              Refactorings

              Further Reading

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

                      if (isset($exif['lens_model'])) {
                          $format[] = array(
                              "icon" => "https://static.railpage.com.au/i/icons/photo-camera31.svg", 
                              "label" => "Lens", 
                              "value" => $exif['lens_model']
              Severity: Major
              Found in lib/Images/Exif.php and 2 other locations - About 1 hr to fix
              lib/Images/Exif.php on lines 358..364
              lib/Images/Exif.php on lines 383..389

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 40.

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

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

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

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

              Refactorings

              Further Reading

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

                      if (isset($exif['exposure'])) {
                          $format[] = array(
                              "icon" => "https://static.railpage.com.au/i/icons/clock218.svg", 
                              "label" => "Exposure", 
                              "value" => $exif['exposure']
              Severity: Major
              Found in lib/Images/Exif.php and 2 other locations - About 1 hr to fix
              lib/Images/Exif.php on lines 375..381
              lib/Images/Exif.php on lines 383..389

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 40.

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

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

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

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

              Refactorings

              Further Reading

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

                      if (isset($exif['iso_speed'])) {
                          $format[] = array(
                              "icon" => "https://static.railpage.com.au/i/icons/iso7.svg", 
                              "label" => "ISO", 
                              "value" => $exif['iso_speed']
              Severity: Major
              Found in lib/Images/Exif.php and 2 other locations - About 1 hr to fix
              lib/Images/Exif.php on lines 358..364
              lib/Images/Exif.php on lines 375..381

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 40.

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

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

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

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

              Refactorings

              Further Reading

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

                          $imageObject->meta['exif']['camera_model'] = self::normaliseCameraModel($imageObject->meta['exif']['camera_model']); 
              Severity: Major
              Found in lib/Images/Exif.php and 1 other location - About 1 hr to fix
              lib/Images/Exif.php on lines 59..59

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 34.

              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

                          $imageObject->meta['exif']['camera_make'] = self::normaliseCameraMake($imageObject->meta['exif']['camera_make']); 
              Severity: Major
              Found in lib/Images/Exif.php and 1 other location - About 1 hr to fix
              lib/Images/Exif.php on lines 60..60

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

              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

                      $required = [ 
                          "camera_make", 
                          "camera_model",
                          "lens_model", 
                          "lens_serial_number",
              Severity: Major
              Found in lib/Images/Exif.php and 3 other locations - About 1 hr to fix
              lib/Images/Collage.php on lines 182..191
              lib/Locations/Location.php on lines 597..606
              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 6 locations. Consider refactoring.
              Open

                          case "exposure_id" : 
                              $data = [ "exposure" => $exif['exposure'] ];
                              $table = "image_exposure";
                              break;
              Severity: Major
              Found in lib/Images/Exif.php and 5 other locations - About 55 mins to fix
              lib/Images/Exif.php on lines 298..301
              lib/Images/Exif.php on lines 303..306
              lib/Images/Exif.php on lines 313..316
              lib/Images/Exif.php on lines 318..321
              lib/Images/Exif.php on lines 323..326

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 29.

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

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

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

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

              Refactorings

              Further Reading

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

                          case "exposure_program_id" : 
                              $data = [ "program" => $exif['exposure_program'] ];
                              $table = "image_exposure_program";
                              break;
              Severity: Major
              Found in lib/Images/Exif.php and 5 other locations - About 55 mins to fix
              lib/Images/Exif.php on lines 298..301
              lib/Images/Exif.php on lines 303..306
              lib/Images/Exif.php on lines 308..311
              lib/Images/Exif.php on lines 318..321
              lib/Images/Exif.php on lines 323..326

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 29.

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

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

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

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

              Refactorings

              Further Reading

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

                          case "software_id" :
                              $data = [ "name" => $exif['software'] ];
                              $table = "image_software";
                              break;
              Severity: Major
              Found in lib/Images/Exif.php and 5 other locations - About 55 mins to fix
              lib/Images/Exif.php on lines 298..301
              lib/Images/Exif.php on lines 303..306
              lib/Images/Exif.php on lines 308..311
              lib/Images/Exif.php on lines 313..316
              lib/Images/Exif.php on lines 318..321

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 29.

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

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

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

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

              Refactorings

              Further Reading

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

                          case "white_balance_id" : 
                              $data = [ "whitebalance" => $exif['white_balance'] ];
                              $table = "image_whitebalance";
                              break;
              Severity: Major
              Found in lib/Images/Exif.php and 5 other locations - About 55 mins to fix
              lib/Images/Exif.php on lines 298..301
              lib/Images/Exif.php on lines 303..306
              lib/Images/Exif.php on lines 308..311
              lib/Images/Exif.php on lines 313..316
              lib/Images/Exif.php on lines 323..326

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 29.

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

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

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

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

              Refactorings

              Further Reading

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

                          case "lens_sn_id" : 
                              $data = [ "sn" => $exif['lens_serial_number'] ];
                              $table = "image_lens_sn";
                              break;
              Severity: Major
              Found in lib/Images/Exif.php and 5 other locations - About 55 mins to fix
              lib/Images/Exif.php on lines 298..301
              lib/Images/Exif.php on lines 308..311
              lib/Images/Exif.php on lines 313..316
              lib/Images/Exif.php on lines 318..321
              lib/Images/Exif.php on lines 323..326

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 29.

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

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

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

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

              Refactorings

              Further Reading

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

                          case "lens_id" : 
                              $data = [ "model" => $exif['lens_model'] ];
                              $table = "image_lens";
                              break;
              Severity: Major
              Found in lib/Images/Exif.php and 5 other locations - About 55 mins to fix
              lib/Images/Exif.php on lines 303..306
              lib/Images/Exif.php on lines 308..311
              lib/Images/Exif.php on lines 313..316
              lib/Images/Exif.php on lines 318..321
              lib/Images/Exif.php on lines 323..326

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 29.

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

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

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

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

              Refactorings

              Further Reading

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

                              "value" => sprintf("%s %s", $exif['camera_make'], $exif['camera_model']),
              Severity: Minor
              Found in lib/Images/Exif.php and 1 other location - About 45 mins to fix
              lib/Forums/Forums.php on lines 786..786

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

                      $exif['camera_model'] = self::normaliseCameraModel($exif['camera_model']); 
              Severity: Major
              Found in lib/Images/Exif.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 147..147
              lib/Images/ImageFactory.php on lines 229..229
              lib/Images/Utility/Finder.php on lines 706..706
              lib/Images/Utility/Finder.php on lines 735..735
              lib/Locos/Utility/LocosUtility.php on lines 56..56
              lib/News/Topic.php on lines 233..233
              lib/News/Topic.php on lines 290..290
              lib/News/Topic.php on lines 292..292
              lib/Newsletters/Weekly.php on lines 412..412
              lib/Newsletters/Weekly.php on lines 414..414
              lib/Users/Timeline.php on lines 177..177

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 22.

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

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

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

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

              Refactorings

              Further Reading

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

                      $exif['camera_make'] = self::normaliseCameraMake($exif['camera_make']); 
              Severity: Major
              Found in lib/Images/Exif.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 146..146
              lib/Images/Exif.php on lines 147..147
              lib/Images/ImageFactory.php on lines 229..229
              lib/Images/Utility/Finder.php on lines 706..706
              lib/Images/Utility/Finder.php on lines 735..735
              lib/Locos/Utility/LocosUtility.php on lines 56..56
              lib/News/Topic.php on lines 233..233
              lib/News/Topic.php on lines 290..290
              lib/News/Topic.php on lines 292..292
              lib/Newsletters/Weekly.php on lines 412..412
              lib/Newsletters/Weekly.php on lines 414..414
              lib/Users/Timeline.php on lines 177..177

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 22.

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

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

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

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

              Refactorings

              Further Reading

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

                      $exif['software'] = self::normaliseSoftware($exif['software']);
              Severity: Major
              Found in lib/Images/Exif.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/ImageFactory.php on lines 229..229
              lib/Images/Utility/Finder.php on lines 706..706
              lib/Images/Utility/Finder.php on lines 735..735
              lib/Locos/Utility/LocosUtility.php on lines 56..56
              lib/News/Topic.php on lines 233..233
              lib/News/Topic.php on lines 290..290
              lib/News/Topic.php on lines 292..292
              lib/Newsletters/Weekly.php on lines 412..412
              lib/Newsletters/Weekly.php on lines 414..414
              lib/Users/Timeline.php on lines 177..177

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 22.

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

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

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

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

              Refactorings

              Further Reading

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

                              $data = [ "make" => $exif['camera_make'], "model" => $exif['camera_model'] ];
              Severity: Major
              Found in lib/Images/Exif.php and 3 other locations - About 30 mins to fix
              lib/Images/Provider/FiveHundredPx.php on lines 323..326
              lib/Images/Utility/Geoplace.php on lines 111..114
              lib/Locos/Utility/LocomotiveUtility.php on lines 445..448

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 21.

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

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

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

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

              Refactorings

              Further Reading

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

                          if ($val['value'] == "Unknown" || $val['value'] == "Unknown Unknown" || is_null($val['value'])) {
              Severity: Minor
              Found in lib/Images/Exif.php and 1 other location - About 30 mins to fix
              lib/RSS/Consume.php on lines 182..182

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

                      $make = str_replace($findTheseMakes, $replaceWith, $make); 
              Severity: Major
              Found in lib/Images/Exif.php and 7 other locations - About 30 mins to fix
              lib/Formatting/BbcodeUtility.php on lines 109..109
              lib/Formatting/BbcodeUtility.php on lines 124..124
              lib/Formatting/MultimediaUtility.php on lines 191..191
              lib/Links/Links.php on lines 305..305
              lib/News/Base.php on lines 347..347
              lib/News/Utility/ArticleUtility.php on lines 97..97
              lib/AppCore.php on lines 700..700

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 20.

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

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

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

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

              Refactorings

              Further Reading

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

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

              Blank line found at end of control structure
              Open

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

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

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

              Blank line found at end of control structure
              Open

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

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

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

              Blank line found at start of control structure
              Open

                      switch ($type) {
              Severity: Minor
              Found in lib/Images/Exif.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

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

              There are no issues that match your filters.

              Category
              Status