Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 2 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.
There are several approaches to avoid long parameter lists:
1 | <?php declare(strict_types = 1); |
||
24 | 1 | public function __construct( |
|
25 | string $payId, |
||
26 | DateTimeImmutable $responseDateTime, |
||
27 | ResultCode $resultCode, |
||
28 | string $resultMessage, |
||
29 | ?PaymentStatus $paymentStatus, |
||
30 | ?string $authCode = null, |
||
31 | ?string $merchantData = null, |
||
32 | ?string $customerCode = null, |
||
33 | array $extensions = [] |
||
34 | ) |
||
35 | { |
||
36 | 1 | parent::__construct($payId, $responseDateTime, $resultCode, $resultMessage, $paymentStatus, $authCode, $merchantData, $extensions); |
|
37 | |||
38 | 1 | $this->customerCode = $customerCode; |
|
39 | 1 | } |
|
47 |