SergioMadness/payment-laravel

View on GitHub

Showing 94 of 94 total issues

Avoid using static access to class '\Illuminate\Foundation\AliasLoader' in method 'boot'.
Open

        $loader = AliasLoader::getInstance();
Severity: Minor
Found in src/PaymentProvider.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 getPaymentForm has 10 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function getPaymentForm($orderId,
                                   $paymentId,
                                   float $amount,
                                   string $currency = self::CURRENCY_RUR,
                                   string $paymentType = self::PAYMENT_TYPE_CARD,
Severity: Minor
Found in src/contracts/PayService.php by phpmd

Avoid assigning values to variables in if clauses and the like (line '499', column '14').
Open

    public function driverInstance(string $driver): ?PayService
    {
        if (($driverClass = $this->getDriver($driver)) !== null) {
            return app($driverClass, [
                'config' => config('payment.' . $driverClass),
Severity: Minor
Found in src/Payment.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

The method getPaymentLink has 10 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function getPaymentLink($orderId,
                                   $paymentId,
                                   float $amount,
                                   string $currency = self::CURRENCY_RUR,
                                   string $paymentType = self::PAYMENT_TYPE_CARD,
Severity: Minor
Found in src/contracts/PayService.php by phpmd

Avoid unused parameters such as '$protocol'.
Open

    public function setTransport(PayProtocol $protocol): PayService
Severity: Minor
Found in src/Payment.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

The method getPaymentLink has 10 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function getPaymentLink($orderId,
                                   $paymentId,
                                   float $amount,
                                   string $currency = self::CURRENCY_RUR,
                                   string $paymentType = self::PAYMENT_TYPE_CARD,
Severity: Minor
Found in src/Payment.php by phpmd

Line exceeds 120 characters; contains 139 characters
Open

     * Параметр необходим, только если у вас несколько систем налогообложения.

Line exceeds 120 characters; contains 199 characters
Open

    public function initPayment(string $token, string $orderId, string $paymentId, float $amount, string $description, string $currency = PayService::CURRENCY_RUR_ISO, array $extraParams = []): bool;

Line exceeds 120 characters; contains 133 characters
Open

    public function __construct(string $name = null, int $qty = null, float $price = null, int $tax = null, string $currency = 'RUR')

Expected 1 newline at end of file; 0 found
Open

}

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/contracts/Form.php by phpcodesniffer

Opening parenthesis of a multi-line function call must be the last content on the line
Open

        return $this->getCurrentDriver()->getPaymentForm($orderId,
Severity: Minor
Found in src/Payment.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/Payment.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/contracts/PayService.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/PaymentProvider.php by phpcodesniffer

Closing parenthesis of a multi-line function call must be on a line by itself
Open

            $receipt);
Severity: Minor
Found in src/Payment.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}

Expected 1 newline at end of file; 0 found
Open

}

Expected 1 newline at end of file; 0 found
Open

}
Severity
Category
Status
Source
Language