RequestHeader   A
last analyzed

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