gabrielbull/php-ups-api

View on GitHub

Showing 176 of 176 total issues

Function createConfirmRequest has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
Open

    private function createConfirmRequest(
        $validation,
        Shipment $shipment,
        ShipmentRequestLabelSpecification $labelSpec = null,
        ShipmentRequestReceiptSpecification $receiptSpec = null
Severity: Minor
Found in src/Shipping.php - About 2 days 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 83 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($response = null)
    {
        $this->Shipper = new Shipper();
        $this->ReferenceNumber = new ReferenceNumber();
        $this->Service = new Service();
Severity: Minor
Found in src/Entity/Manifest.php - About 1 day 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 createConfirmRequest has 248 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function createConfirmRequest(
        $validation,
        Shipment $shipment,
        ShipmentRequestLabelSpecification $labelSpec = null,
        ShipmentRequestReceiptSpecification $receiptSpec = null
Severity: Major
Found in src/Shipping.php - About 1 day to fix

    File Shipping.php has 514 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Ups;
    
    use DOMDocument;
    Severity: Major
    Found in src/Shipping.php - About 1 day to fix

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

          public function __construct($attributes = null)
          {
              if (null !== $attributes) {
                  if (isset($attributes->AddressLine1)) {
                      $this->setAddressLine1($attributes->AddressLine1);
      Severity: Minor
      Found in src/Entity/Address.php - About 7 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

      Shipment has 53 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Shipment
      {
          /**
           * @var PaymentInformation
           */
      Severity: Major
      Found in src/Entity/Shipment.php - About 7 hrs to fix

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

            public function __construct(\stdClass $response = null)
            {
                $this->AddressExtendedInformation = [];
        
                if (null !== $response) {
        Severity: Minor
        Found in src/Entity/UpdatedAddress.php - About 7 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

        HazMat has 51 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class HazMat implements NodeInterface
        {
        
            /**
             * @var string
        Severity: Major
        Found in src/Entity/HazMat.php - About 7 hrs to fix

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

          <?php
          
          namespace Ups\Entity;
          
          use DOMDocument;
          Severity: Major
          Found in src/Entity/Discount.php and 1 other location - About 7 hrs to fix
          src/Entity/FreightCharges.php on lines 1..68

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

          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/FreightCharges.php and 1 other location - About 7 hrs to fix
          src/Entity/Discount.php on lines 1..68

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

          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

          Address has 48 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Address implements NodeInterface
          {
              /** @deprecated */
              public $AddressLine1;
              /** @deprecated */
          Severity: Minor
          Found in src/Entity/Address.php - About 6 hrs to fix

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

                public function __construct($response = null)
                {
                    $this->ShipmentReferenceNumber = new ShipmentReferenceNumber();
                    $this->PackageReferenceNumber = new PackageReferenceNumber();
                    $this->Service = new Service();
            Severity: Minor
            Found in src/Entity/Generic.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 __construct has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($response = null)
                {
                    $this->Service = new Service();
                    $this->BillingWeight = new BillingWeight();
                    $this->TransportationCharges = new Charges();
            Severity: Minor
            Found in src/Entity/RatedShipment.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 __construct has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($response = null)
                {
                    $this->ShipmentReferenceNumber = new ShipmentReferenceNumber();
                    $this->PackageReferenceNumber = new PackageReferenceNumber();
                    $this->ActivityLocation = new ActivityLocation();
            Severity: Minor
            Found in src/Entity/Delivery.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

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

                public function __construct(\stdClass $response = null)
                {
                    $this->PackageReferenceNumber = [];
                    $this->ShipmentReferenceNumber = [];
                    $this->Resolution = new Resolution();
            Severity: Minor
            Found in src/Entity/Exception.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

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

                public function __construct($response = null)
                {
                    $this->PackageReferenceNumber = new PackageReferenceNumber();
                    $this->ShipmentReferenceNumber = new ShipmentReferenceNumber();
                    $this->ActivityLocation = new ActivityLocation();
            Severity: Minor
            Found in src/Entity/Origin.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

            File Address.php has 395 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

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

              <?php
              
              namespace Ups\Entity\Tradeability;
              
              use DOMDocument;
              Severity: Major
              Found in src/Entity/Tradeability/Quantity.php and 1 other location - About 5 hrs to fix
              src/Entity/Tradeability/Weight.php on lines 1..86

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

              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\Tradeability;
              
              use DOMDocument;
              Severity: Major
              Found in src/Entity/Tradeability/Weight.php and 1 other location - About 5 hrs to fix
              src/Entity/Tradeability/Quantity.php on lines 1..86

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

              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

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

                  public function __construct($response = null)
                  {
                      $this->Shipper = new Shipper();
                      $this->ReferenceNumber = new ReferenceNumber();
                      $this->Service = new Service();
              Severity: Major
              Found in src/Entity/Manifest.php - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language