YetiForceCompany/YetiForceCRM

View on GitHub
app/Fields/Iban.php

Summary

Maintainability
A
1 hr
Test Coverage
F
0%

Function getPayerId has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getPayerId(): string
    {
        $bbanLength = $this->countryIban->BBANLength();
        $conditionsForPayerId = $this->fieldParams['conditions'];
        $payerCharactersAmount = $bbanLength - \strlen($this->fieldParams['sortCode']) - \strlen($this->fieldParams['clientId']);
Severity: Minor
Found in app/Fields/Iban.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

The method getPayerId() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
Open

    protected function getPayerId(): string
    {
        $bbanLength = $this->countryIban->BBANLength();
        $conditionsForPayerId = $this->fieldParams['conditions'];
        $payerCharactersAmount = $bbanLength - \strlen($this->fieldParams['sortCode']) - \strlen($this->fieldParams['clientId']);
Severity: Minor
Found in app/Fields/Iban.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

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

Missing class import via use statement (line '58', column '13').
Open

        throw new \App\Exceptions\AppException('ERR_NO_VALUE');
Severity: Minor
Found in app/Fields/Iban.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '33', column '29').
Open

            $this->countryIban = new \PHP_IBAN\IBANCountry($this->fieldParams['country']);
Severity: Minor
Found in app/Fields/Iban.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '32', column '16').
Open

            $iban = new \PHP_IBAN\IBAN();
Severity: Minor
Found in app/Fields/Iban.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Define a constant instead of duplicating this literal "clientId" 4 times.
Open

            $ibanNumberForCalculateCheckSum = $this->fieldParams['country'] . $checkSumValueForCreateIban . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Critical
Found in app/Fields/Iban.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Add a "case default" clause to this "switch" statement.
Open

            switch ($clientPattern[$charPosition]) {
Severity: Critical
Found in app/Fields/Iban.php by sonar-php

The requirement for a final case default clause is defensive programming. The clause should either take appropriate action, or contain a suitable comment as to why no action is taken. Even when the switch covers all current values of an enum, a default case should still be used because there is no guarantee that the enum won't be extended.

Noncompliant Code Example

switch ($param) {  //missing default clause
  case 0:
    do_something();
    break;
  case 1:
    do_something_else();
    break;
}

switch ($param) {
  default: // default clause should be the last one
    error();
    break;
  case 0:
    do_something();
    break;
  case 1:
    do_something_else();
    break;
}

Compliant Solution

switch ($param) {
  case 0:
    do_something();
    break;
  case 1:
    do_something_else();
    break;
  default:
    error();
    break;
}

See

  • MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
  • MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
  • MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
  • MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
  • MISRA C:2012, 16.1 - All switch statements shall be well-formed
  • MISRA C:2012, 16.4 - Every switch statement shall have a default label
  • MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
  • MITRE, CWE-478 - Missing Default Case in Switch Statement
  • CERT, MSC01-C. - Strive for logical completeness
  • CERT, MSC01-CPP. - Strive for logical completeness

Define a constant instead of duplicating this literal "country" 4 times.
Open

            $this->countryIban = new \PHP_IBAN\IBANCountry($this->fieldParams['country']);
Severity: Critical
Found in app/Fields/Iban.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "sortCode" 4 times.
Open

            $ibanNumberForCalculateCheckSum = $this->fieldParams['country'] . $checkSumValueForCreateIban . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Critical
Found in app/Fields/Iban.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Call to method __construct from undeclared class \PHP_IBAN\IBANCountry
Open

            $this->countryIban = new \PHP_IBAN\IBANCountry($this->fieldParams['country']);
Severity: Critical
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->countryIban
Open

            $this->countryIban = new \PHP_IBAN\IBANCountry($this->fieldParams['country']);
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->recordModel
Open

                if ('defaultValue' === $fieldNameForCondition || ($fieldValueForCondition && $fieldValueForCondition === $this->recordModel->get($fieldNameForCondition))) {
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams (Did you mean $fieldParams)
Open

        $this->fieldParams = $fieldParams;
Severity: Minor
Found in app/Fields/Iban.php by phan

Call to method __construct from undeclared class \PHP_IBAN\IBAN
Open

            $iban = new \PHP_IBAN\IBAN();
Severity: Critical
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams (Did you mean $fieldParams)
Open

            $ibanNumberForCalculateCheckSum = $this->fieldParams['country'] . $checkSumValueForCreateIban . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams
Open

        if ('random' === $conditionsForPayerId && isset($this->fieldParams['clientIdPattern'])) {
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams (Did you mean $fieldParams)
Open

            $this->countryIban = new \PHP_IBAN\IBANCountry($this->fieldParams['country']);
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->recordModel (Did you mean $recordModel)
Open

        $this->recordModel = $recordModel;
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->countryIban
Open

            $countryIbanLength = $this->countryIban->IBANLength();
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->recordModel
Open

                    $valueForPayerId = $this->recordModel->get($fieldFromGetValue);
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams (Did you mean $fieldParams)
Open

            return $this->fieldParams['country'] . $checkSumValue . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams
Open

        $payerCharactersAmount = $bbanLength - \strlen($this->fieldParams['sortCode']) - \strlen($this->fieldParams['clientId']);
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->countryIban
Open

        $bbanLength = $this->countryIban->BBANLength();
Severity: Minor
Found in app/Fields/Iban.php by phan

string to array comparison
Open

        if ('random' === $conditionsForPayerId && isset($this->fieldParams['clientIdPattern'])) {
Severity: Info
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams
Open

        if (isset($this->fieldParams['country'], $this->fieldParams['sortCode'], $this->fieldParams['clientId'], $this->fieldParams['conditions'])) {
Severity: Minor
Found in app/Fields/Iban.php by phan

Doc-block of $recordModel in getIbanValue contains phpdoc param type \App\Fields\Vtiger_Record_Model which is incompatible with the param type \Vtiger_Record_Model declared in the signature
Open

     * @param Vtiger_Record_Model $recordModel
Severity: Minor
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams
Open

        $clientPattern = $this->fieldParams['clientIdPattern'];
Severity: Minor
Found in app/Fields/Iban.php by phan

Call to method FindChecksum from undeclared class \PHP_IBAN\IBAN
Open

            $checkSumValue = $iban->FindChecksum($ibanNumberForCalculateCheckSum);
Severity: Critical
Found in app/Fields/Iban.php by phan

Reference to undeclared property \App\Fields\Iban->fieldParams
Open

        $conditionsForPayerId = $this->fieldParams['conditions'];
Severity: Minor
Found in app/Fields/Iban.php by phan

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

                [$fieldNameForCondition, $fieldFromGetValue, $fieldValueForCondition] = array_pad(explode(':', $conditionValues), 3, false);
Severity: Minor
Found in app/Fields/Iban.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 $ibanNumberForCalculateCheckSum. Keep variable name length under 20.
Open

            $ibanNumberForCalculateCheckSum = $this->fieldParams['country'] . $checkSumValueForCreateIban . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Minor
Found in app/Fields/Iban.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 $payerCharactersAmount. Keep variable name length under 20.
Open

        $payerCharactersAmount = $bbanLength - \strlen($this->fieldParams['sortCode']) - \strlen($this->fieldParams['clientId']);
Severity: Minor
Found in app/Fields/Iban.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 $checkSumValueForCreateIban. Keep variable name length under 20.
Open

            $checkSumValueForCreateIban = '00';
Severity: Minor
Found in app/Fields/Iban.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 $fieldValueForCondition. Keep variable name length under 20.
Open

                [$fieldNameForCondition, $fieldFromGetValue, $fieldValueForCondition] = array_pad(explode(':', $conditionValues), 3, false);
Severity: Minor
Found in app/Fields/Iban.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 $payerCharactersAmount. Keep variable name length under 20.
Open

    protected function addLeadingZeros(int $payerCharactersAmount, string $valueForPayerId): string
Severity: Minor
Found in app/Fields/Iban.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

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array               $fieldParams
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->recordModel = $recordModel;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $payerId = $this->getPayerId();
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return $this->fieldParams['country'] . $checkSumValue . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    $valueForPayerId = $this->recordModel->get($fieldFromGetValue);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return str_pad($valueForPayerId, $payerCharactersAmount, '0', STR_PAD_LEFT);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $checkSumValueForCreateIban = '00';
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (isset($this->fieldParams['country'], $this->fieldParams['sortCode'], $this->fieldParams['clientId'], $this->fieldParams['conditions'])) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $iban = new \PHP_IBAN\IBAN();
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Line exceeds 120 characters; contains 183 characters
Open

            $ibanNumberForCalculateCheckSum = $this->fieldParams['country'] . $checkSumValueForCreateIban . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Create payers id value for IBAN.
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\is_array($conditionsForPayerId)) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                case 'N':
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    break;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->fieldParams = $fieldParams;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Line exceeds 120 characters; contains 143 characters
Open

            return $this->fieldParams['country'] . $checkSumValue . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $valueForPayerId
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Create randomly payer id by pattern.
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                case 'A':
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                        return $this->addLeadingZeros($payerCharactersAmount, $valueForPayerId);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return '';
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Add leading zeros to payer id if necessary.
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected function addLeadingZeros(int $payerCharactersAmount, string $valueForPayerId): string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                case 'X':
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->countryIban = new \PHP_IBAN\IBANCountry($this->fieldParams['country']);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected function checkIfFieldHasMandatoryParams(): bool
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $bbanLength = $this->countryIban->BBANLength();
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    break;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ((int) $countryIbanLength !== \strlen($ibanNumberForCalculateCheckSum)) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Checks if field params has mandatory values.
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return bool
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            switch ($clientPattern[$charPosition]) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $payerId;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $numbers = range('0', '9');
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    $payerId .= rand(0, 9);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $countryIbanLength = $this->countryIban->IBANLength();
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $ibanNumberForCalculateCheckSum = $this->fieldParams['country'] . $checkSumValueForCreateIban . $this->fieldParams['sortCode'] . $this->fieldParams['clientId'] . $payerId;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *  @throws \App\Exceptions\AppException
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Line exceeds 120 characters; contains 172 characters
Open

                if ('defaultValue' === $fieldNameForCondition || ($fieldValueForCondition && $fieldValueForCondition === $this->recordModel->get($fieldNameForCondition))) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param int    $payerCharactersAmount
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $payerId = '';
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    $payerId .= $letters[$randomKey];
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $checkSumValue = $iban->FindChecksum($ibanNumberForCalculateCheckSum);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                return '';
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            foreach ($conditionsForPayerId as $conditionValues) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    if ($valueForPayerId && \strlen($valueForPayerId) !== $payerCharactersAmount) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $lettersAndNumbers = array_merge($letters, $numbers);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    $payerId .= $lettersAndNumbers[$randomKey];
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param Vtiger_Record_Model $recordModel
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getIbanValue(array $fieldParams, \Vtiger_Record_Model $recordModel): string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $conditionsForPayerId = $this->fieldParams['conditions'];
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if ('random' === $conditionsForPayerId && isset($this->fieldParams['clientIdPattern'])) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected function createRandomPayerId(): string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $clientPattern = $this->fieldParams['clientIdPattern'];
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    break;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if ($this->checkIfFieldHasMandatoryParams()) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Line exceeds 120 characters; contains 140 characters
Open

                [$fieldNameForCondition, $fieldFromGetValue, $fieldValueForCondition] = array_pad(explode(':', $conditionValues), 3, false);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                if ('defaultValue' === $fieldNameForCondition || ($fieldValueForCondition && $fieldValueForCondition === $this->recordModel->get($fieldNameForCondition))) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $letters = range('A', 'Z');
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function returns IBAN value.
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    $randomKey = array_rand($letters, 1);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Line exceeds 120 characters; contains 149 characters
Open

        if (isset($this->fieldParams['country'], $this->fieldParams['sortCode'], $this->fieldParams['clientId'], $this->fieldParams['conditions'])) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return true;
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $payerCharactersAmount = $bbanLength - \strlen($this->fieldParams['sortCode']) - \strlen($this->fieldParams['clientId']);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Line exceeds 120 characters; contains 129 characters
Open

        $payerCharactersAmount = $bbanLength - \strlen($this->fieldParams['sortCode']) - \strlen($this->fieldParams['clientId']);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                [$fieldNameForCondition, $fieldFromGetValue, $fieldValueForCondition] = array_pad(explode(':', $conditionValues), 3, false);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $patternLength = \strlen($clientPattern);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        for ($charPosition = 0; $charPosition < $patternLength; ++$charPosition) {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        throw new \App\Exceptions\AppException('ERR_NO_VALUE');
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected function getPayerId(): string
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return $this->createRandomPayerId();
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                    $randomKey = array_rand($letters, 1);
Severity: Minor
Found in app/Fields/Iban.php by phpcodesniffer

There are no issues that match your filters.

Category
Status