Lullabot/mpx-php

View on GitHub

Showing 9 of 28 total issues

FeedConfig has 84 functions (exceeds 20 allowed). Consider refactoring.
Open

class FeedConfig extends ObjectBase implements PublicIdWithGuidInterface
{
    /**
     * The parameters that are passed to a custom feed adapter for processing at runtime.
     *
Severity: Major
Found in src/DataService/Feeds/FeedConfig.php - About 1 day to fix

    File FeedConfig.php has 412 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Lullabot\Mpx\DataService\Feeds;
    
    use GuzzleHttp\Psr7\Uri;
    Severity: Minor
    Found in src/DataService/Feeds/FeedConfig.php - About 5 hrs to fix

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

      <?php
      
      namespace Lullabot\Mpx\Service\AccessManagement;
      
      use GuzzleHttp\Psr7\Uri;
      src/Service/AccessManagement/ResolveAllUrlsResponseExtractor.php on lines 1..31

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

      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

      <?php
      
      namespace Lullabot\Mpx\Service\AccessManagement;
      
      use GuzzleHttp\Psr7\Uri;
      src/Service/AccessManagement/ResolveDomainResponseExtractor.php on lines 1..31

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

      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 deeply nested control flow statements.
      Open

                                  if ('{' === $token
                                      || \T_CURLY_OPEN === $token->id
                                      || \T_DOLLAR_OPEN_CURLY_BRACES === $token->id) {
                                      if (!$firstBraceFound) {
                                          $firstBraceFound = true;
      Severity: Major
      Found in src/DataService/CachingContextFactory.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if ('}' === $token) {
                                        --$braceLevel;
                                    }
        Severity: Major
        Found in src/DataService/CachingContextFactory.php - About 45 mins to fix

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

          <?php
          
          namespace Lullabot\Mpx\Exception;
          
          use GuzzleHttp\Exception\ServerException as GuzzleServerException;
          Severity: Minor
          Found in src/Exception/ServerException.php and 1 other location - About 35 mins to fix
          src/Exception/ClientException.php on lines 1..29

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

          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

          <?php
          
          namespace Lullabot\Mpx\Exception;
          
          use GuzzleHttp\Exception\ClientException as GuzzleClientException;
          Severity: Minor
          Found in src/Exception/ClientException.php and 1 other location - About 35 mins to fix
          src/Exception/ServerException.php on lines 1..26

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

          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 decodeCustomFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Confirmed

              protected function decodeCustomFields(&$decoded)
              {
                  // @todo This is O(namespaces * entries) and can be optimized.
                  foreach ($decoded['$xmlns'] as $prefix => $namespace) {
                      if (!isset($decoded['entries'])) {
          Severity: Minor
          Found in src/Encoder/CJsonEncoder.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

          Severity
          Category
          Status
          Source
          Language