brandon14/ebay-sdk-php

View on GitHub
src/Sell/Finances/V1/ObjectSerializer.php

Summary

Maintainability
F
2 wks
Test Coverage

Function deserialize has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public static function deserialize($data, $class, $httpHeaders = null)
    {
        if ($data === null) {
            return null;
        }
Severity: Minor
Found in src/Sell/Finances/V1/ObjectSerializer.php - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function sanitizeForSerialization has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public static function sanitizeForSerialization($data, $type = null, $format = null)
    {
        if (\is_scalar($data) || $data === null) {
            return $data;
        }
Severity: Minor
Found in src/Sell/Finances/V1/ObjectSerializer.php - About 5 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method deserialize has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function deserialize($data, $class, $httpHeaders = null)
    {
        if ($data === null) {
            return null;
        }
Severity: Major
Found in src/Sell/Finances/V1/ObjectSerializer.php - About 3 hrs to fix

    File ObjectSerializer.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * This file is part of the trollandtoad/ebay-sdk-php package.
     *
    Severity: Minor
    Found in src/Sell/Finances/V1/ObjectSerializer.php - About 2 hrs to fix

      Method sanitizeForSerialization has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function sanitizeForSerialization($data, $type = null, $format = null)
          {
              if (\is_scalar($data) || $data === null) {
                  return $data;
              }
      Severity: Minor
      Found in src/Sell/Finances/V1/ObjectSerializer.php - About 1 hr to fix

        Function toQueryValue has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function toQueryValue(
                $value,
                string $paramName,
                string $openApiType = 'string',
                string $style = 'form',
        Severity: Minor
        Found in src/Sell/Finances/V1/ObjectSerializer.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

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

            public static function toQueryValue(
                $value,
                string $paramName,
                string $openApiType = 'string',
                string $style = 'form',
        Severity: Minor
        Found in src/Sell/Finances/V1/ObjectSerializer.php - About 1 hr to fix

          Method toQueryValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  $value,
                  string $paramName,
                  string $openApiType = 'string',
                  string $style = 'form',
                  bool $explode = true
          Severity: Minor
          Found in src/Sell/Finances/V1/ObjectSerializer.php - About 35 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $query;
            Severity: Major
            Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $data;
              Severity: Major
              Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $data;
                Severity: Major
                Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return implode(',', $collection);
                  Severity: Major
                  Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return new \DateTime(self::sanitizeTimestamp($data));
                    Severity: Major
                    Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return null;
                      Severity: Major
                      Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return (string) $data;
                        Severity: Major
                        Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                              return new \DateTime($data);
                          Severity: Major
                          Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return new \SplFileObject($filename, 'r');
                            Severity: Major
                            Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return $data;
                              Severity: Major
                              Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return $instance;
                                Severity: Major
                                Found in src/Sell/Finances/V1/ObjectSerializer.php - About 30 mins to fix

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

                                  <?php
                                  
                                  /**
                                   * This file is part of the trollandtoad/ebay-sdk-php package.
                                   *
                                  Severity: Major
                                  Found in src/Sell/Finances/V1/ObjectSerializer.php and 30 other locations - About 1 wk to fix
                                  src/Buy/Browse/V1/ObjectSerializer.php on lines 1..533
                                  src/Buy/Deal/V1/ObjectSerializer.php on lines 1..533
                                  src/Buy/Feed/V1/ObjectSerializer.php on lines 1..533
                                  src/Buy/FeedBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Buy/MarketingBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Buy/MarketplaceInsightsBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Buy/OfferBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Buy/Order/V2/ObjectSerializer.php on lines 1..533
                                  src/Commerce/CatalogBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Commerce/Charity/V1/ObjectSerializer.php on lines 1..533
                                  src/Commerce/MediaBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Commerce/Notification/V1/ObjectSerializer.php on lines 1..533
                                  src/Commerce/Taxonomy/V1/ObjectSerializer.php on lines 1..533
                                  src/Commerce/TranslationBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Developer/AnalyticsBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Developer/ClientRegistration/V1/ObjectSerializer.php on lines 1..533
                                  src/Developer/KeyManagement/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Account/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Account/V2/ObjectSerializer.php on lines 1..533
                                  src/Sell/Analytics/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Compliance/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Feed/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Fulfillment/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Inventory/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/ListingBeta/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Logistics/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Marketing/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Metadata/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Negotiation/V1/ObjectSerializer.php on lines 1..533
                                  src/Sell/Recommendation/V1/ObjectSerializer.php on lines 1..533

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

                                  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

                                  There are no issues that match your filters.

                                  Category
                                  Status