Passed
Pull Request — master (#28)
by Manuel
02:51
created

RequestHeader   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 73
rs 10
c 0
b 0
f 0
wmc 9

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
A setClientInfo() 0 5 1
A getRequestId() 0 3 1
A getCustomerId() 0 3 1
A getRetryIndicator() 0 3 1
A getClientInfo() 0 3 1
A getSpecVersion() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Ticketpark\SaferpayJson\Request\Container;
4
5
use JMS\Serializer\Annotation\SerializedName;
6
7
final class RequestHeader
8
{
9
    /**
10
     * @var string
11
     * @SerializedName("SpecVersion")
12
     */
13
    private $specVersion = '1.17';
14
15
    /**
16
     * @var string
17
     * @SerializedName("CustomerId")
18
     */
19
    private $customerId;
20
21
    /**
22
     * @var string|null
23
     * @SerializedName("RequestId")
24
     */
25
    private $requestId;
26
27
    /**
28
     * @var int
29
     * @SerializedName("RetryIndicator")
30
     */
31
    private $retryIndicator = 0;
32
33
    /**
34
     * @var ClientInfo|null
35
     * @SerializedName("ClientInfo")
36
     */
37
    private $clientInfo;
38
39
    public function __construct(string $customerId, string $requestId = null, int $retryIndicator = 0)
40
    {
41
        $this->customerId = $customerId;
42
        $this->requestId = $requestId;
43
        $this->retryIndicator = $retryIndicator;
44
45
        if (null === $requestId && 0 === $retryIndicator) {
46
            $this->requestId = uniqid();
47
        }
48
    }
49
50
    public function getSpecVersion(): string
51
    {
52
        return $this->specVersion;
53
    }
54
55
    public function getCustomerId(): string
56
    {
57
        return $this->customerId;
58
    }
59
60
    public function getRequestId(): ?string
61
    {
62
        return $this->requestId;
63
    }
64
65
    public function getRetryIndicator(): int
66
    {
67
        return $this->retryIndicator;
68
    }
69
70
    public function getClientInfo(): ?ClientInfo
71
    {
72
        return $this->clientInfo;
73
    }
74
75
    public function setClientInfo(?ClientInfo $clientInfo): self
76
    {
77
        $this->clientInfo = $clientInfo;
78
79
        return $this;
80
    }
81
}
82