Passed
Pull Request — master (#13)
by
unknown
02:07
created

CustomerVerificationRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 13
c 1
b 0
f 1
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Skrill\Request;
6
7
use Skrill\ValueObject\Email;
8
use Skrill\ValueObject\Customer;
9
use Skrill\ValueObject\DateOfBirth;
10
use Skrill\ValueObject\Address;
11
use Skrill\ValueObject\CustomerId;
12
use Skrill\Request\Traits\GetPayloadTrait;
13
use Skrill\ValueObject\MerchantID;
14
15
/**
16
 * Class CustomerVerificationRequest.
17
 */
18
final class CustomerVerificationRequest
19
{
20
    use GetPayloadTrait;
21
22
    /**
23
     * CustomerVerificationRequest constructor.
24
     * @param Email $email
25
     * @param Customer $customer
26
     * @param DateOfBirth $dateOfBirth
27
     * @param Address $address
28
     * @param MerchantID $merchantId
29
     * @param CustomerId|null $customerId
30
     */
31
    public function __construct(Email $email, Customer $customer, DateOfBirth $dateOfBirth, Address $address,
32
        MerchantID $merchantId, CustomerId $customerId = null)
33
    {
34
        $this->payload = [
35
            'email' => (string)$email,
36
            'firstName' => $customer->getFirstName(),
37
            'lastName' => $customer->getLastName(),
38
            'dateOfBirth' => (string)$dateOfBirth,
39
            'postCode' => $address->getPostCode(),
40
            'country' => $address->getCountry(),
41
            'houseNumber' => $address->getHouseNumber(),
42
            'merchantId' => $merchantId->getValue(),
43
        ];
44
        if ($customerId !== null) {
45
            $this->payload['customerId'] = $customerId;
46
        }
47
    }
48
}
49