src/Payment.php
Payment
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Payment implements PaymentFacade
{
/**
* Available drivers
*
Method getPaymentLink
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function getPaymentLink($orderId,
$paymentId,
float $amount,
string $currency = self::CURRENCY_RUR,
string $paymentType = self::PAYMENT_TYPE_CARD,
Method getPaymentForm
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function getPaymentForm($orderId,
$paymentId,
float $amount,
string $currency = self::CURRENCY_RUR,
string $paymentType = self::PAYMENT_TYPE_CARD,
The method getPaymentForm has 10 parameters. Consider reducing the number of parameters to less than 10. Open
Open
public function getPaymentForm($orderId,
$paymentId,
float $amount,
string $currency = self::CURRENCY_RUR,
string $paymentType = self::PAYMENT_TYPE_CARD,
- Exclude checks
The method getPaymentLink has 10 parameters. Consider reducing the number of parameters to less than 10. Open
Open
public function getPaymentLink($orderId,
$paymentId,
float $amount,
string $currency = self::CURRENCY_RUR,
string $paymentType = self::PAYMENT_TYPE_CARD,
- Exclude checks
Avoid assigning values to variables in if clauses and the like (line '499', column '14'). Open
Open
public function driverInstance(string $driver): ?PayService
{
if (($driverClass = $this->getDriver($driver)) !== null) {
return app($driverClass, [
'config' => config('payment.' . $driverClass),
- Read upRead up
- Exclude checks
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
Avoid unused parameters such as '$protocol'. Open
Open
public function setTransport(PayProtocol $protocol): PayService
- Read upRead up
- Exclude checks
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
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $paymentType = self::PAYMENT_TYPE_CARD,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $successReturnUrl = '',
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
Receipt $receipt = null): string
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
array $extraParams = [],
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $description = '',
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $paymentType = self::PAYMENT_TYPE_CARD,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $successReturnUrl = '',
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $description = '',
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
array $extraParams = [],
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
float $amount,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $failReturnUrl = '',
- Exclude checks
The first parameter of a multi-line function declaration must be on the line after the opening bracket Open
Open
public function getPaymentForm($orderId,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $currency = self::CURRENCY_RUR,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
float $amount,
- Exclude checks
The closing parenthesis of a multi-line function declaration must be on a new line Open
Open
Receipt $receipt = null): string
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $failReturnUrl = '',
- Exclude checks
The closing parenthesis of a multi-line function declaration must be on a new line Open
Open
Receipt $receipt = null): Form
- Exclude checks
The first parameter of a multi-line function declaration must be on the line after the opening bracket Open
Open
public function getPaymentLink($orderId,
- Exclude checks
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
Open
{
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
string $currency = self::CURRENCY_RUR,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
$paymentId,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
$paymentId,
- Exclude checks
Multi-line function declaration not indented correctly; expected 8 spaces but found 35 Open
Open
Receipt $receipt = null): Form
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
Open
return $this->getCurrentDriver()->getPaymentForm($orderId,
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
Open
$receipt);
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
Open
$receipt);
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
Open
$receipt);
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
Open
return $this->getCurrentDriver()->getPaymentLink($orderId,
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
Open
$receipt);
- Exclude checks