railpage/railpagecore

View on GitHub
lib/Images/Provider/Flickr.php

Summary

Maintainability
F
4 days
Test Coverage

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

class Flickr extends AppCore implements ProviderInterface {
    
    /**
     * Provider name
     * @since Version 3.9
Severity: Minor
Found in lib/Images/Provider/Flickr.php by phpmd

File Flickr.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Flickr image provider for Images
 * @since Version 3.9
Severity: Minor
Found in lib/Images/Provider/Flickr.php - About 3 hrs to fix

    Method processExif has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function processExif($row) {
            
            $key = $row['label'];
            
            $column_lookup = [
    Severity: Minor
    Found in lib/Images/Provider/Flickr.php - About 1 hr to fix

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

          public function getImage($id, $force = 0) {
              
              $mckey = sprintf("railpage:image.provider=%s;image=%d", self::PROVIDER_NAME, $id);
              
              $force = (bool) $force;
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php - About 35 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function __construct($params = null) {
              
              parent::__construct(); 
              
              if (!is_array($params)) {
      Severity: Minor
      Found in lib/Images/Provider/Flickr.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 processExif() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
      Open

          private static function processExif($row) {
              
              $key = $row['label'];
              
              $column_lookup = [
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      CyclomaticComplexity

      Since: 0.1

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

      Example

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

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

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

          public function getImage($id, $force = 0) {
              
              $mckey = sprintf("railpage:image.provider=%s;image=%d", self::PROVIDER_NAME, $id);
              
              $force = (bool) $force;
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

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

          public function getImage($id, $force = 0) {
              
              $mckey = sprintf("railpage:image.provider=%s;image=%d", self::PROVIDER_NAME, $id);
              
              $force = (bool) $force;
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

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

                  } else {
                      $this->$var = $params[$val];
                  }
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      ElseExpression

      Since: 1.4.0

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

      Example

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

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

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

          public function getImage($id, $force = 0) {
              
              $mckey = sprintf("railpage:image.provider=%s;image=%d", self::PROVIDER_NAME, $id);
              
              $force = (bool) $force;
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      IfStatementAssignment

      Since: 2.7.0

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

      Example

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

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

      Avoid unused parameters such as '$page'.
      Open

          public function getImages($page, $itemsPerPage) {
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

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

      Avoid unused parameters such as '$itemsPerPage'.
      Open

          public function getImages($page, $itemsPerPage) {
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      UnusedFormalParameter

      Since: 0.2

      Avoid passing parameters to methods or constructors and then not using those parameters.

      Example

      class Foo
      {
          private function bar($howdy)
          {
              // $howdy is not used
          }
      }

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

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

          public function setImage(Image $imageObject) {
              
              /** 
               * Flush Memcache
               */
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 1 day to fix
      lib/Railcams/Provider/Flickr.php on lines 163..189

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

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

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

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

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

      Refactorings

      Further Reading

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

                  "author" => array(
                      "id" => $return['photo']['owner']['nsid'],
                      "username" => $return['photo']['owner']['username'],
                      "realname" => $return['photo']['owner']['realname'],
                      "url" => new Url(sprintf("https://www.flickr.com/photos/%s", $return['photo']['owner']['nsid']))
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 3 hrs to fix
      lib/Railcams/Provider/Flickr.php on lines 130..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 91.

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

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

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

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

      Refactorings

      Further Reading

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

              if (isset($rs['nextphoto']) && is_array($rs['nextphoto'])) {
                  $return['next'] = array(
                      "id" => $rs['nextphoto']['id'],
                      "title" => isset($rs['nextphoto']['title']) ? $rs['nextphoto']['title'] : "Untitled"
                  );
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 3 other locations - About 3 hrs to fix
      lib/Images/Provider/Flickr.php on lines 369..374
      lib/Railcams/Provider/Flickr.php on lines 227..232
      lib/Railcams/Provider/Flickr.php on lines 234..239

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

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

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

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

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

      Refactorings

      Further Reading

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

              if (isset($rs['prevphoto']) && is_array($rs['prevphoto'])) {
                  $return['previous'] = array(
                      "id" => $rs['prevphoto']['id'],
                      "title" => isset($rs['prevphoto']['title']) ? $rs['prevphoto']['title'] : "Untitled"
                  );
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 3 other locations - About 3 hrs to fix
      lib/Images/Provider/Flickr.php on lines 376..381
      lib/Railcams/Provider/Flickr.php on lines 227..232
      lib/Railcams/Provider/Flickr.php on lines 234..239

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

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

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

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

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

      Refactorings

      Further Reading

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

              if ($response->getStatusCode() != 200) {
                  throw new Exception(sprintf("An unexpected HTTP response code of %s was returned from %s", $response->getStatusCode(), self::PROVIDER_NAME));
              }
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 1 hr to fix
      lib/Images/Provider/FiveHundredPx.php on lines 292..294

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 41.

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

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

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

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

      Refactorings

      Further Reading

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

              if (is_null(filter_var($method, FILTER_SANITIZE_STRING))) {
                  throw new InvalidArgumentException("Flickr API call failed: no API method requested"); 
              }
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 1 hr to fix
      lib/Images/Provider/SmugMug.php on lines 112..114

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 35.

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

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

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

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

      Refactorings

      Further Reading

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

              if (!$this->User instanceof User) {
                  throw new InvalidArgumentException("Cannot lookup permissions for " . __CLASS__ . ": no valid user has been set"); 
              }
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 2 other locations - About 1 hr to fix
      lib/Chronicle/Entry.php on lines 200..202
      lib/Users/Timeline.php on lines 44..46

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 32.

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

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

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

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

      Refactorings

      Further Reading

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

          public function setOptions($options) {
              
              foreach ($options as $key => $val) {
                  
                  $this->$key = $val;
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 1 hr to fix
      lib/Images/Provider/FiveHundredPx.php on lines 189..197

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 30.

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

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

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

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

      Refactorings

      Further Reading

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

              $opts = array(
                  "oauth_token" => "oauth_token",
                  "oauth_secret" => "oauth_secret",
                  "oauth_consumer_key" => "api_key",
                  "oauth_consumer_secret" => "api_secret"
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 2 other locations - About 55 mins to fix
      lib/Images/Competition.php on lines 182..187
      lib/Images/Provider/FiveHundredPx.php on lines 148..153

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 28.

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

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

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

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

      Refactorings

      Further Reading

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

                      return [ $column_lookup[$key] => round(str_replace(" mm", "", $row['raw'])) ];
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 45 mins to fix
      lib/Formatting/MultimediaUtility.php on lines 407..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 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

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

                      "taken" => new DateTime($return['photo']['dates']['taken']),
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 40 mins to fix
      lib/Railcams/Provider/Flickr.php on lines 126..126

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

              $return = array(
                  "previous" => false,
                  "next" => false
              );
      Severity: Major
      Found in lib/Images/Provider/Flickr.php and 2 other locations - About 40 mins to fix
      lib/Prerender/Prerender.php on lines 124..127
      lib/Railcams/Provider/Flickr.php on lines 222..225

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 24.

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

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

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

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

      Refactorings

      Further Reading

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

              $result = $this->execute("flickr.photos.delete", array("photo_id" => $imageObject->photo_id));
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 40 mins to fix
      lib/Images/Provider/Flickr.php on lines 362..362

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 24.

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

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

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

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

      Refactorings

      Further Reading

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

              $rs = $this->execute("flickr.photos.getContext", array("photo_id" => $imageObject->id));
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 40 mins to fix
      lib/Images/Provider/Flickr.php on lines 400..400

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

              $mckey = sprintf("railpage:image.provider=%s;image=%d", self::PROVIDER_NAME, $id);
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 2 other locations - About 40 mins to fix
      lib/Images/Provider/Flickr.php on lines 436..436
      lib/Railcams/Provider/Flickr.php on lines 107..107

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 23.

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

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

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

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

      Refactorings

      Further Reading

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

              $url = sprintf("%s?%s", self::API_ENDPOINT, $params);
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 2 other locations - About 40 mins to fix
      lib/Images/Provider/Flickr.php on lines 214..214
      lib/Railcams/Provider/Flickr.php on lines 107..107

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 23.

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

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

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

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

      Refactorings

      Further Reading

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

                      "updated" => isset($return['photo']['dates']['lastupdate']) ? new DateTime(sprintf("@%s", $return['photo']['dates']['lastupdate'])) : new DateTime($return['photo']['dates']['taken'])
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 30 mins to fix
      lib/Images/Provider/Flickr.php on lines 273..273

      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

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

                      "uploaded" => isset($return['photo']['dateuploaded']) ? new DateTime(sprintf("@%s", $return['photo']['dateuploaded'])) : new DateTime($return['photo']['dates']['taken']),
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 30 mins to fix
      lib/Images/Provider/Flickr.php on lines 274..274

      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 ($return = $this->execute("flickr.photos.getInfo", array("photo_id" => $id))) {
                  $return['photo']['sizes'] = $this->execute("flickr.photos.getSizes", array("photo_id" => $id));
                  $return['id'] = $id;
              }
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 30 mins to fix
      lib/Images/Provider/SmugMug.php on lines 221..230

      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

                  $params = array(
                      "api_key" => $Config->Flickr->APIKey,
                      "api_secret" => $Config->Flickr->APISecret
                  );
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php and 1 other location - About 30 mins to fix
      lib/Events/Event.php on lines 528..531

      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

      Avoid excessively long variable names like $oauth_consumer_secret. Keep variable name length under 20.
      Open

          private $oauth_consumer_secret;
      Severity: Minor
      Found in lib/Images/Provider/Flickr.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      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 start of control structure
      Open

              switch ($key) {

      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

              foreach ($options as $key => $val) {

      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

          }

      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

          }

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

          }

      There are no issues that match your filters.

      Category
      Status