gabrielbull/php-ups-api

View on GitHub

Showing 176 of 176 total issues

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

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

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

      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

      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

              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/AccessPointSearch.php and 1 other location - About 3 hrs to fix
              src/Entity/VendorInfo.php on lines 49..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 142.

              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/VendorInfo.php and 1 other location - About 3 hrs to fix
              src/Entity/AccessPointSearch.php on lines 37..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 142.

              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 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
                      Severity
                      Category
                      Status
                      Source
                      Language