Completed
Push — master ( 955097...f4414e )
by Jan
08:34
created

InitPaymentResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 15
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 9
crap 1

How to fix   Many Parameters   

Many Parameters

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);
2
3
namespace SlevomatCsobGateway\Call;
4
5
use DateTimeImmutable;
6
7
class InitPaymentResponse extends PaymentResponse
8
{
9
10
	/** @var string|null */
11
	private $customerCode;
12
13
	/**
14
	 * @param string $payId
15
	 * @param \DateTimeImmutable $responseDateTime
16
	 * @param \SlevomatCsobGateway\Call\ResultCode $resultCode
17
	 * @param string $resultMessage
18
	 * @param \SlevomatCsobGateway\Call\PaymentStatus|null $paymentStatus
19
	 * @param string|null $authCode
20
	 * @param string|null $merchantData
21
	 * @param string|null $customerCode
22
	 * @param mixed[] $extensions
23
	 */
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
	}
40
41
	public function getCustomerCode(): ?string
42
	{
43
		return $this->customerCode;
44
	}
45
46
}
47