gpupo/adyen-sdk

View on GitHub

Showing 16 of 16 total issues

The parameter $decimal_separator is not named in camelCase.
Open

    protected function amountFormat($decimal_separator, $key = 'amount')
    {
        return number_format($this->get($key), 2, $decimal_separator, '');
    }
Severity: Minor
Found in src/Payment/Request/Order/Order.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

Function beforeConstruct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function beforeConstruct($data = null)
    {
        if (array_key_exists('additionalData', $data) && is_array($data['additionalData'])) {
            foreach ($this->getBoletoFields() as $item) {
                $key = 'boletobancario.'.$item;
Severity: Minor
Found in src/Payment/Response/Decorator/BoletoDecorator.php - About 35 mins 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

Duplicated array key shopperName, first declared at line 34.
Open

            $data = array_merge($data, [
                'shopperName'          => $this->getOrder()->getShopper()->getFullName(),
                'socialSecurityNumber' => $socialSecurityNumber,
                'billingAddress'       => $this->getOrder()->getBillingAddress()->toArray(),
                'shopperName'          => $this->getOrder()->getShopper()->getArrayName(),

DuplicatedArrayKey

Defining another value for the same key in an array literal overrides the previous key/value, which makes it effectively an unused code. If it's known from the beginning that the key will have different value, there is usually no point in defining first one.

Example

function createArray() {
    return [
        'non-associative 0element', // not applied
        0 => 'associative 0-element', // applied
        false => 'associative 0-element', // applied
        'foo' => 'bar', // not applied
        "foo" => 'baz', // applied
    ];
}

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

Missing class import via use statement (line '39', column '23').
Open

            throw new \InvalidArgumentException('Request ausente!');

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 '125', column '23').
Open

            throw new \InvalidArgumentException('Response type ['.$request->getType().'] not supported!');
Severity: Minor
Found in src/Payment/Request/Manager.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 '42', column '27').
Open

                throw new \InvalidArgumentException('['.$key.'] ausente!');
Severity: Minor
Found in src/Client/Client.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 '55', column '23').
Open

            throw new \InvalidArgumentException('Request type ['.$this->getType().']not exist!');
Severity: Minor
Found in src/Payment/Request/Request.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 '67', column '23').
Open

            throw new \InvalidArgumentException('Request type ['.$className.'] not supported!');
Severity: Minor
Found in src/Payment/Request/Request.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

Avoid unused parameters such as '$existent'.
Open

    public function update(EntityInterface $entity, EntityInterface $existent)
Severity: Minor
Found in src/Payment/Request/Manager.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$options'.
Open

    public function toJson($route = null, $options = 0, $depth = 512)
Severity: Minor
Found in src/Payment/Request/Request.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$depth'.
Open

    public function toJson($route = null, $options = 0, $depth = 512)
Severity: Minor
Found in src/Payment/Request/Request.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$route'.
Open

    public function toJson($route = null, $options = 0, $depth = 512)
Severity: Minor
Found in src/Payment/Request/Request.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$entity'.
Open

    public function update(EntityInterface $entity, EntityInterface $existent)
Severity: Minor
Found in src/Payment/Request/Manager.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid using static access to class '\Gpupo\AdyenSdk\Factory' in method 'factorySdk'.
Open

        $instance = Factory::getInstance();
Severity: Minor
Found in src/Console/Application.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method processExecute uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $decorator = $this->getFullyQualifiedDecoratorName('ProblematicDecorator');
        }
Severity: Minor
Found in src/Payment/Request/Manager.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The variable $decimal_separator is not named in camelCase.
Open

    protected function amountFormat($decimal_separator, $key = 'amount')
    {
        return number_format($this->get($key), 2, $decimal_separator, '');
    }
Severity: Minor
Found in src/Payment/Request/Order/Order.php by phpmd

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

Severity
Category
Status
Source
Language