Completed
Pull Request — master (#14)
by Agaletskiy
01:54
created

FacadeCisItemResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
cc 1
nc 1
nop 9

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\IsmpClient\V3\Dto;
6
7
use Symfony\Component\Serializer\Annotation\SerializedName;
8
9
final class FacadeCisItemResponse
10
{
11
    public const STATUS_EMITTED = 'EMITTED';
12
    public const STATUS_APPLIED = 'APPLIED';
13
    public const STATUS_INTRODUCED = 'INTRODUCED';
14
    public const STATUS_RETIRED = 'RETIRED';
15
    public const STATUS_ISSUED = 'ISSUED';
16
17
    /**
18
     * @var string
19
     */
20
    private $cis;
21
    /**
22
     * @var string
23
     */
24
    private $gtin;
25
    /**
26
     * @var string
27
     * @SerializedName("producerName")
28
     */
29
    private $producerName;
30
    /**
31
     * @var string
32
     */
33
    private $status;
34
    /**
35
     * @var int
36
     * @SerializedName("emissionDate")
37
     */
38
    private $emissionDate;
39
    /**
40
     * @var string
41
     * @SerializedName("packageType")
42
     */
43
    private $packageType;
44
    /**
45
     * @var string
46
     * @SerializedName("ownerName")
47
     */
48
    private $ownerName;
49
    /**
50
     * @var string
51
     * @SerializedName("ownerInn")
52
     */
53
    private $ownerInn;
54
    /**
55
     * @var string|null
56
     * @SerializedName("productName")
57
     */
58
    private $productName;
59
    /**
60
     * @var string|null
61
     */
62
    private $brand;
63
    /**
64
     * @var int
65
     * @SerializedName("countChildren")
66
     */
67
    private $countChildren;
68
69
    public function __construct(
70
        string $cis,
71
        string $gtin,
72
        string $producerName,
73
        string $status,
74
        int $emissionDate,
75
        string $packageType,
76
        string $ownerName,
77
        string $ownerInn,
78
        int $countChildren
79
    ) {
80
        $this->cis = $cis;
81
        $this->gtin = $gtin;
82
        $this->producerName = $producerName;
83
        $this->status = $status;
84
        $this->emissionDate = $emissionDate;
85
        $this->packageType = $packageType;
86
        $this->ownerName = $ownerName;
87
        $this->ownerInn = $ownerInn;
88
        $this->countChildren = $countChildren;
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function getCis(): string
95
    {
96
        return $this->cis;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getGtin(): string
103
    {
104
        return $this->gtin;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getProducerName(): string
111
    {
112
        return $this->producerName;
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function getStatus(): string
119
    {
120
        return $this->status;
121
    }
122
123
    /**
124
     * @return int
125
     */
126
    public function getEmissionDate(): int
127
    {
128
        return $this->emissionDate;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getPackageType(): string
135
    {
136
        return $this->packageType;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getOwnerName(): string
143
    {
144
        return $this->ownerName;
145
    }
146
147
    /**
148
     * @return string
149
     */
150
    public function getOwnerInn(): string
151
    {
152
        return $this->ownerInn;
153
    }
154
155
    /**
156
     * @return int
157
     */
158
    public function getCountChildren(): int
159
    {
160
        return $this->countChildren;
161
    }
162
163
    /**
164
     * @return string|null
165
     */
166
    public function getProductName(): ?string
167
    {
168
        return $this->productName;
169
    }
170
171
    public function setProductName(string $productName): void
172
    {
173
        $this->productName = $productName;
174
    }
175
176
    /**
177
     * @return string|null
178
     */
179
    public function getBrand(): ?string
180
    {
181
        return $this->brand;
182
    }
183
184
    public function setBrand(string $brand): void
185
    {
186
        $this->brand = $brand;
187
    }
188
}
189