Showing 94 of 94 total issues
Avoid using static access to class '\Illuminate\Foundation\AliasLoader' in method 'boot'. Open
Open
$loader = AliasLoader::getInstance();
- Read upRead up
- Exclude checks
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
Open
public function getPaymentForm($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
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 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
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
Line exceeds 120 characters; contains 139 characters Open
Open
* Параметр необходим, только если у вас несколько систем налогообложения.
- Exclude checks
Line exceeds 120 characters; contains 199 characters Open
Open
public function initPayment(string $token, string $orderId, string $paymentId, float $amount, string $description, string $currency = PayService::CURRENCY_RUR_ISO, array $extraParams = []): bool;
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
Open
public function __construct(string $name = null, int $qty = null, float $price = null, int $tax = null, string $currency = 'RUR')
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- 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
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- 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
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks
Expected 1 newline at end of file; 0 found Open
Open
}
- Exclude checks