gabrielbull/php-ups-api

View on GitHub

Showing 174 of 174 total issues

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

<?php

namespace Ups\Entity;

use DOMDocument;
Severity: Major
Found in src/Entity/AccessPointCOD.php and 1 other location - About 4 hrs to fix
src/Entity/GeoCode.php on lines 1..58

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

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 Ups\Entity;

use DOMDocument;
Severity: Major
Found in src/Entity/GeoCode.php and 1 other location - About 4 hrs to fix
src/Entity/AccessPointCOD.php on lines 1..76

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

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 __construct has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($attributes = null)
    {
        $this->setPackagingType(new PackagingType(
            isset($attributes->PackagingType) ? $attributes->PackagingType : null)
        );
Severity: Minor
Found in src/Entity/Package.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

InternationalForms has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

class InternationalForms implements NodeInterface
{
    /**
     * @var array
     */
Severity: Minor
Found in src/Entity/InternationalForms.php - About 4 hrs to fix

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

        public function __construct($response = null)
        {
            $this->CallTagARS = new CallTagARS();
    
            if (null !== $response) {
    Severity: Minor
    Found in src/Entity/ShipmentServiceOptions.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public function toNode(DOMDocument $document = null)
        {
            if (null === $document) {
                $document = new DOMDocument();
            }
    Severity: Minor
    Found in src/Entity/HazMat.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    ShipmentServiceOptions has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ShipmentServiceOptions implements NodeInterface
    {
        /**
         * @var
         */
    Severity: Minor
    Found in src/Entity/ShipmentServiceOptions.php - About 3 hrs to fix

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

          public function toNode(DOMDocument $document = null)
          {
              if (null === $document) {
                  $document = new DOMDocument();
              }
      Severity: Major
      Found in src/Entity/AlternateDeliveryAddress.php and 1 other location - About 3 hrs to fix
      src/Entity/ShipFrom.php on lines 16..38

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

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

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

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

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

      Refactorings

      Further Reading

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

          public function toNode(DOMDocument $document = null)
          {
              if (null === $document) {
                  $document = new DOMDocument();
              }
      Severity: Major
      Found in src/Entity/ShipFrom.php and 1 other location - About 3 hrs to fix
      src/Entity/AlternateDeliveryAddress.php on lines 24..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 129.

      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

      File HazMat.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Ups\Entity;
      
      use DOMDocument;
      Severity: Minor
      Found in src/Entity/HazMat.php - About 3 hrs to fix

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

            public function __construct(\stdClass $response = null)
            {
                $this->TransitFrom = new Address();
                $this->TransitTo = new Address();
                $this->ShipmentWeight = new ShipmentWeight();
        Severity: Minor
        Found in src/Entity/TimeInTransitResponse.php - About 3 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        File InternationalForms.php has 306 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Ups\Entity;
        
        use DateTime;
        Severity: Minor
        Found in src/Entity/InternationalForms.php - About 3 hrs to fix

          Package has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Package implements NodeInterface
          {
              const PKG_OVERSIZE1 = '1';
              const PKG_OVERSIZE2 = '2';
              const PKG_LARGE = '4';
          Severity: Minor
          Found in src/Entity/Package.php - About 3 hrs to fix

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

                public function __construct(\stdClass $attributes = null)
                {
                    $this->address = new Address();
            
                    if (null !== $attributes) {
            Severity: Minor
            Found in src/Entity/ShipTo.php - About 3 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method toNode has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function toNode(DOMDocument $document = null)
                {
                    if (null === $document) {
                        $document = new DOMDocument();
                    }
            Severity: Major
            Found in src/Entity/HazMat.php - About 3 hrs to fix

              Function toNode has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function toNode(DOMDocument $document = null)
                  {
                      if (null === $document) {
                          $document = new DOMDocument();
                      }
              Severity: Minor
              Found in src/Entity/ShipmentServiceOptions.php - About 3 hrs to fix

              Cognitive Complexity

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

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

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

              Further reading

              Method __construct has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct($attributes = null)
                  {
                      if (null !== $attributes) {
                          if (isset($attributes->AddressLine1)) {
                              $this->setAddressLine1($attributes->AddressLine1);
              Severity: Major
              Found in src/Entity/Address.php - About 3 hrs to fix

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

                <?php
                
                namespace Ups\Entity;
                
                class PackageReferenceNumber
                Severity: Major
                Found in src/Entity/PackageReferenceNumber.php and 1 other location - About 2 hrs to fix
                src/Entity/ShipmentReferenceNumber.php on lines 1..32

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

                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 Ups\Entity;
                
                class ShipmentReferenceNumber
                Severity: Major
                Found in src/Entity/ShipmentReferenceNumber.php and 1 other location - About 2 hrs to fix
                src/Entity/PackageReferenceNumber.php on lines 1..32

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

                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 createRequest has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function createRequest()
                    {
                        $xml = new DOMDocument();
                        $xml->formatOutput = true;
                
                
                Severity: Minor
                Found in src/AddressValidation.php - About 2 hrs to fix

                Cognitive Complexity

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

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

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

                Further reading

                Severity
                Category
                Status
                Source
                Language