orca-services/nova-api-php

View on GitHub

Showing 86 of 86 total issues

Avoid excessively long variable names like $errorProtocolReasonPhrase. Keep variable name length under 20.
Open

        $errorProtocolReasonPhrase = $xml->getNodeValue('error-protocol-reason-phrase', $errorInfoNode);
Severity: Minor
Found in src/Parser/NovaApiSoapErrorParser.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $novaCreateServicesMethod. Keep variable name length under 20.
Open

    private $novaCreateServicesMethod;
Severity: Minor
Found in src/Client/NovaApiClient.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $novaPurchaseServicesMethod. Keep variable name length under 20.
Open

        NovaPurchaseServicesMethod $novaPurchaseServicesMethod,
Severity: Minor
Found in src/Client/NovaApiClient.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $partnerSearchParameter. Keep variable name length under 20.
Open

        $partnerSearchParameter = $dom->createElement('novagp:partnerSuchParameter');

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $novaSearchPartnerMethod. Keep variable name length under 20.
Open

        NovaSearchPartnerMethod $novaSearchPartnerMethod,
Severity: Minor
Found in src/Client/NovaApiClient.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $novaCreateOffersMethod. Keep variable name length under 20.
Open

        NovaCreateOffersMethod $novaCreateOffersMethod,
Severity: Minor
Found in src/Client/NovaApiClient.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $httpClientMaxLifetime. Keep variable name length under 20.
Open

    private $httpClientMaxLifetime = 300;
Severity: Minor
Found in src/Soap/NovaApiSoapAction.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $checkSwissPassValidityMethod. Keep variable name length under 20.
Open

        CheckSwissPassValidityMethod $checkSwissPassValidityMethod,
Severity: Minor
Found in src/Client/NovaApiClient.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Method createRequestBody has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function createRequestBody(NovaSearchServicesParameter $parameter): string
    {
        $dom = new DOMDocument('1.0', 'utf-8');
        $dom->formatOutput = true;

Severity: Minor
Found in src/Method/NovaSearchServicesMethod.php - About 1 hr to fix

    Method createRequestBody has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function createRequestBody(NovaSearchPartnerParameter $parameter): string
        {
            $dom = new DOMDocument('1.0', 'utf-8');
            $dom->formatOutput = true;
    
    
    Severity: Minor
    Found in src/Method/NovaSearchPartnerMethod.php - About 1 hr to fix

      The class NovaPartner has 19 fields. Consider redesigning NovaPartner to keep the number of fields under 15.
      Open

      final class NovaPartner
      {
          /**
           * @var string Value
           */
      Severity: Minor
      Found in src/Result/NovaPartner.php by phpmd

      TooManyFields

      Since: 0.1

      Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

      Example

      class Person {
         protected $one;
         private $two;
         private $three;
         [... many more fields ...]
      }

      Source https://phpmd.org/rules/codesize.html#toomanyfields

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

          private function createPartner(DOMElement $partnerNode, XmlDocument $xml): NovaPartner
          {
              $partner = new NovaPartner();
      
              $partner->tkId = $xml->getAttributeValue('@tkid', $partnerNode);
      Severity: Minor
      Found in src/Method/NovaSearchPartnerMethod.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 login has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function login(string $clientId, string $clientSecret): string
          {
              $options = [
                  'body' => http_build_query(
                      [
      Severity: Minor
      Found in src/Method/NovaLoginMethod.php - About 1 hr to fix

        Method appendMethodNamespaces has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function appendMethodNamespaces(DOMElement $method)
            {
                $method->setAttribute('xmlns:ns22', 'http://nova.voev.ch/services/internal/leistungnotification');
                $method->setAttribute('xmlns:ns21', $this->novaSoapAction->getServiceNamespace('vertrieb'));
                $method->setAttribute('xmlns:nova-leistungnotiz', $this->novaSoapAction->getServiceNamespace('leistungnotiz'));
        Severity: Minor
        Found in src/Method/NovaSavCreateOffersMethod.php - About 1 hr to fix

          Method createRequestBody has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function createRequestBody(NovaPurchaseServicesParameter $parameter): string
              {
                  $dom = new DOMDocument('1.0', 'utf-8');
                  $dom->formatOutput = true;
          
          
          Severity: Minor
          Found in src/Method/NovaPurchaseServicesMethod.php - About 1 hr to fix

            Method appendMethodNamespaces has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function appendMethodNamespaces(DOMElement $method)
                {
                    $method->setAttribute('xmlns:ns20', 'http://nova.voev.ch/services/internal/leistungnotification');
                    $method->setAttribute('xmlns:ns19', $this->getServiceNamespace('inkasso'));
                    $method->setAttribute('xmlns:ns18', $this->getServiceNamespace('vertrieb'));
            Severity: Minor
            Found in src/Soap/NovaApiSoapAction.php - About 1 hr to fix

              Function createRequestBody has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function createRequestBody(NovaSearchServicesParameter $parameter): string
                  {
                      $dom = new DOMDocument('1.0', 'utf-8');
                      $dom->formatOutput = true;
              
              
              Severity: Minor
              Found in src/Method/NovaSearchServicesMethod.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 __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      NovaSearchPartnerMethod $novaSearchPartnerMethod,
                      CheckSwissPassValidityMethod $checkSwissPassValidityMethod,
                      NovaCreateOffersMethod $novaCreateOffersMethod,
                      NovaCreateServicesMethod $novaCreateServicesMethod,
                      NovaPurchaseServicesMethod $novaPurchaseServicesMethod,
              Severity: Major
              Found in src/Client/NovaApiClient.php - About 1 hr to fix

                Avoid variables with short names like $id. Configured minimum length is 3.
                Open

                    public $id;
                Severity: Minor
                Found in src/Result/NovaMessage.php by phpmd

                ShortVariable

                Since: 0.2

                Detects when a field, local, or parameter has a very short name.

                Example

                class Something {
                    private $q = 15; // VIOLATION - Field
                    public static function main( array $as ) { // VIOLATION - Formal
                        $r = 20 + $this->q; // VIOLATION - Local
                        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                            $r += $this->q;
                        }
                    }
                }

                Source https://phpmd.org/rules/naming.html#shortvariable

                The class NovaSearchPartnerMethod has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
                Open

                final class NovaSearchPartnerMethod implements NovaMethod
                {
                    /**
                     * @var NovaApiSoapAction
                     */

                CouplingBetweenObjects

                Since: 1.1.0

                A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                Example

                class Foo {
                    /**
                     * @var \foo\bar\X
                     */
                    private $x = null;
                
                    /**
                     * @var \foo\bar\Y
                     */
                    private $y = null;
                
                    /**
                     * @var \foo\bar\Z
                     */
                    private $z = null;
                
                    public function setFoo(\Foo $foo) {}
                    public function setBar(\Bar $bar) {}
                    public function setBaz(\Baz $baz) {}
                
                    /**
                     * @return \SplObjectStorage
                     * @throws \OutOfRangeException
                     * @throws \InvalidArgumentException
                     * @throws \ErrorException
                     */
                    public function process(\Iterator $it) {}
                
                    // ...
                }

                Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                Severity
                Category
                Status
                Source
                Language