gabrielbull/php-ups-api

View on GitHub

Showing 141 of 176 total issues

Function __construct has a Cognitive Complexity of 25 (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

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 toNode has a Cognitive Complexity of 23 (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

        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

          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

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

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

            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

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

                public function __construct(\stdClass $response = null)
                {
                    $this->AddressExtendedInformation = [];
            
                    if (null !== $response) {
            Severity: Major
            Found in src/Entity/UpdatedAddress.php - About 2 hrs to fix

              Method request has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function request($access, $request, $endpointurl, $operation = null, $wsdl = null)
                  {
                      // Check for operation
                      if (is_null($operation)) {
                          throw new \Exception('Operation is required');
              Severity: Major
              Found in src/SoapRequest.php - About 2 hrs to fix

                Method createRequest has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function createRequest(RateRequest $rateRequest)
                    {
                        $shipment = $rateRequest->getShipment();
                
                        $document = $xml = new DOMDocument();
                Severity: Major
                Found in src/Rate.php - About 2 hrs to fix

                  ShipTo has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

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

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

                    class Shipment implements NodeInterface
                    {
                        const TRANSPORT_MODE_AIR = 1;
                        const TRANSPORT_MODE_GROUND = 2;
                        const TRANSPORT_MODE_RAIL = 3;
                    Severity: Minor
                    Found in src/Entity/Tradeability/Shipment.php - About 2 hrs to fix

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

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

                      File Shipment.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace Ups\Entity;
                      
                      class Shipment
                      Severity: Minor
                      Found in src/Entity/Shipment.php - About 2 hrs to fix

                        Shipper has 22 functions (exceeds 20 allowed). Consider refactoring.
                        Open

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

                          Method toNode has 58 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/ShipmentServiceOptions.php - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language