Passed
Push — master ( b1cf97...31fd3d )
by Agaletskiy
42s queued 11s
created

GetICBufferStatusResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 1
nc 1
nop 8

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
2
3
declare(strict_types=1);
4
5
namespace Lamoda\OmsClient\V2\Dto;
6
7
final class GetICBufferStatusResponse
8
{
9
    public const BUFFER_STATUS_PENDING = 'pending';
10
    public const BUFFER_STATUS_ACTIVE = 'active';
11
    public const BUFFER_STATUS_EXHAUSTED = 'exhausted';
12
    public const BUFFER_STATUS_REJECTED = 'rejected';
13
    public const BUFFER_STATUS_CLOSED = 'closed';
14
15
    /**
16
     * @var string
17
     */
18
    private $omsId;
19
    /**
20
     * @var string
21
     */
22
    private $orderId;
23
    /**
24
     * @var string
25
     */
26
    private $gtin;
27
    /**
28
     * @var int
29
     */
30
    private $totalCodes;
31
    /**
32
     * @var int
33
     */
34
    private $unavailableCodes;
35
    /**
36
     * @var int
37
     */
38
    private $leftInBuffer;
39
    /**
40
     * @var PoolInfo[]
41
     */
42
    private $poolInfos;
43
    /**
44
     * @var string
45
     */
46
    private $bufferStatus;
47
    /**
48
     * @var string | null
49
     */
50
    private $rejectionReason;
51
52
    /**
53
     * GetICBufferStatusResponse constructor.
54
     *
55
     * @param string $omsId
56
     * @param string $orderId
57
     * @param string $gtin
58
     * @param int $totalCodes
59
     * @param int $unavailableCodes
60
     * @param int $leftInBuffer
61
     * @param PoolInfo[] $poolInfos
62
     * @param string $bufferStatus
63
     */
64
    public function __construct(
65
        string $omsId,
66
        string $orderId,
67
        string $gtin,
68
        int $totalCodes,
69
        int $unavailableCodes,
70
        int $leftInBuffer,
71
        array $poolInfos,
72
        string $bufferStatus
73
    ) {
74
        $this->omsId = $omsId;
75
        $this->orderId = $orderId;
76
        $this->gtin = $gtin;
77
        $this->totalCodes = $totalCodes;
78
        $this->unavailableCodes = $unavailableCodes;
79
        $this->leftInBuffer = $leftInBuffer;
80
        $this->poolInfos = $poolInfos;
81
        $this->bufferStatus = $bufferStatus;
82
    }
83
84
    public function getOmsId(): string
85
    {
86
        return $this->omsId;
87
    }
88
89
    public function getOrderId(): string
90
    {
91
        return $this->orderId;
92
    }
93
94
    public function getGtin(): string
95
    {
96
        return $this->gtin;
97
    }
98
99
    public function getTotalCodes(): int
100
    {
101
        return $this->totalCodes;
102
    }
103
104
    public function getUnavailableCodes(): int
105
    {
106
        return $this->unavailableCodes;
107
    }
108
109
    public function getLeftInBuffer(): int
110
    {
111
        return $this->leftInBuffer;
112
    }
113
114
    /**
115
     * @return PoolInfo[]
116
     */
117
    public function getPoolInfos(): array
118
    {
119
        return $this->poolInfos;
120
    }
121
122
    public function getBufferStatus(): string
123
    {
124
        return $this->bufferStatus;
125
    }
126
127
    public function getRejectionReason(): ?string
128
    {
129
        return $this->rejectionReason;
130
    }
131
132
    public function setRejectionReason(?string $rejectionReason): void
133
    {
134
        $this->rejectionReason = $rejectionReason;
135
    }
136
}
137