Passed
Push — main ( 6bf038...55787e )
by Aleksandr
08:10
created

Receiver   A

Complexity

Total Complexity 22

Size/Duplication

Total Lines 304
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 46
c 1
b 0
f 0
dl 0
loc 304
ccs 55
cts 55
cp 1
rs 10
wmc 22

22 Methods

Rating   Name   Duplication   Size   Complexity  
A setZipCode() 0 4 1
A setTo() 0 4 1
A getTo() 0 3 1
A setAddress() 0 4 1
A setPerson() 0 4 1
A getAddress() 0 3 1
A setTimeMax() 0 4 1
A getTimeMin() 0 3 1
A getPvzcode() 0 3 1
A getPhone() 0 3 1
A getDate() 0 3 1
A setDate() 0 4 1
A setTimeMin() 0 4 1
A getPerson() 0 3 1
A getZipCode() 0 3 1
A getTimeMax() 0 3 1
A getTown() 0 3 1
A getCompany() 0 3 1
A setTown() 0 4 1
A setCompany() 0 4 1
A setPvzcode() 0 4 1
A setPhone() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DalliSDK\Models;
6
7
use DalliSDK\Traits\Fillable;
8
use JMS\Serializer\Annotation as JMS;
9
10
/**
11
 * Модель получателя заказа
12
 *
13
 * @see https://api.dalli-service.com/v1/doc/createbasket
14
 * @JMS\XmlRoot("receiver")
15
 */
16
class Receiver
17
{
18
    use Fillable;
19
20
    /**
21
     * Контактное лицо (поддержка Dalli заказала, что это одни и то же с $person)
22
     * @see Receiver::$person
23
     *
24
     * @JMS\Type("string")
25
     * @JMS\SerializedName("company")
26
     */
27
    private ?string $company = null;
28
29
    /**
30
     * Индекс
31
     *
32
     * @JMS\Type("string")
33
     * @JMS\SerializedName("zipcode")
34
     */
35
    private ?string $zipCode = null;
36
37
    /**
38
     * Город (тег обязателен для курьерской доставки, но игнорируется для ПВЗ)
39
     *  Может быть:
40
     *       Строковым названием города в формате "Москва город"
41
     *       13-ти значным кодом адресного классификатора КЛАДР
42
     *       36-ти значным кодом адресной системы ФИАС
43
     *
44
     * @JMS\Type("string")
45
     * @JMS\SerializedName("town")
46
     */
47
    private string $town;
48
49
    /**
50
     * Адрес (обязательный тег, если тип доставки относится к курьерской доставке)
51
     *
52
     * @JMS\Type("string")
53
     * @JMS\SerializedName("address")
54
     */
55
    private string $address;
56
57
    /**
58
     * Полный адрес одной строкой (Желательно, используется ВМЕСТО town+address)
59
     *
60
     * @JMS\Type("string")
61
     * @JMS\SerializedName("to")
62
     */
63
    private ?string $to = null;
64
65
    /**
66
     * Код пункта выдачи заказов (обязательный тег, если тип доставки относится к ПВЗ)
67
     *
68
     * @JMS\Type("string")
69
     * @JMS\SerializedName("pvzcode")
70
     */
71
    private ?string $pvzcode = null;
72
73
    /**
74
     * Контактное лицо (обязательный тег)
75
     *
76
     * @JMS\Type("string")
77
     * @JMS\SerializedName("person")
78
     */
79
    private string $person;
80
81
    /**
82
     * Телефон (обязательный тег). Так же в это поле можно добавить электронную почту получателя.
83
     *
84
     * @JMS\Type("string")
85
     * @JMS\SerializedName("phone")
86
     */
87
    private string $phone;
88
89
    /**
90
     * Дата доставки в формате yyyy-mm-dd. Не играет роли при передаче партнёрам (обязательный тег)
91
     *
92
     * @JMS\Type("DateTime<'Y-m-d'>")
93
     * @JMS\SerializedName("date")
94
     */
95
    private \DateTimeInterface $date;
96
97
    /**
98
     * Желаемое время доставки, в формате hh:mm (обязательный тег)
99
     *
100
     * @JMS\Type("string")
101
     * @JMS\SerializedName("time_min")
102
     */
103
    private string $timeMin;
104
105
    /**
106
     * Желаемое время доставки, в формате hh:mm (обязательный тег)
107
     *
108
     * @JMS\Type("string")
109
     * @JMS\SerializedName("time_max")
110
     */
111
    private string $timeMax;
112
113
    /**
114
     * @return string|null
115
     */
116 4
    public function getCompany(): ?string
117
    {
118 4
        return $this->company;
119
    }
120
121
    /**
122
     * @return string|null
123
     */
124 3
    public function getZipCode(): ?string
125
    {
126 3
        return $this->zipCode;
127
    }
128
129
    /**
130
     * @return string
131
     */
132 3
    public function getTown(): string
133
    {
134 3
        return $this->town;
135
    }
136
137
    /**
138
     * @return string
139
     */
140 3
    public function getAddress(): string
141
    {
142 3
        return $this->address;
143
    }
144
145
    /**
146
     * @return string|null
147
     */
148 4
    public function getPvzcode(): ?string
149
    {
150 4
        return $this->pvzcode;
151
    }
152
153
    /**
154
     * @return string
155
     */
156 3
    public function getPerson(): string
157
    {
158 3
        return $this->person;
159
    }
160
161
    /**
162
     * @return string
163
     */
164 3
    public function getPhone(): string
165
    {
166 3
        return $this->phone;
167
    }
168
169
    /**
170
     * @return \DateTimeInterface
171
     */
172 3
    public function getDate(): \DateTimeInterface
173
    {
174 3
        return $this->date;
175
    }
176
177
    /**
178
     * @return string
179
     */
180 3
    public function getTimeMin(): string
181
    {
182 3
        return $this->timeMin;
183
    }
184
185
    /**
186
     * @return string
187
     */
188 3
    public function getTimeMax(): string
189
    {
190 3
        return $this->timeMax;
191
    }
192
193
    /**
194
     * @param string|null $company
195
     *
196
     * @return Receiver
197
     */
198 1
    public function setCompany(?string $company): Receiver
199
    {
200 1
        $this->company = $company;
201 1
        return $this;
202
    }
203
204
    /**
205
     * @param string|null $zipCode
206
     *
207
     * @return Receiver
208
     */
209 1
    public function setZipCode(?string $zipCode): Receiver
210
    {
211 1
        $this->zipCode = $zipCode;
212 1
        return $this;
213
    }
214
215
    /**
216
     * @param string $town
217
     *
218
     * @return Receiver
219
     */
220 21
    public function setTown(string $town): Receiver
221
    {
222 21
        $this->town = $town;
223 21
        return $this;
224
    }
225
226
    /**
227
     * @param string $address
228
     *
229
     * @return Receiver
230
     */
231 21
    public function setAddress(string $address): Receiver
232
    {
233 21
        $this->address = $address;
234 21
        return $this;
235
    }
236
237
    /**
238
     * @param string|null $pvzcode
239
     *
240
     * @return Receiver
241
     */
242 1
    public function setPvzcode(?string $pvzcode): Receiver
243
    {
244 1
        $this->pvzcode = $pvzcode;
245 1
        return $this;
246
    }
247
248
    /**
249
     * @param string $person
250
     *
251
     * @return Receiver
252
     */
253 21
    public function setPerson(string $person): Receiver
254
    {
255 21
        $this->person = $person;
256 21
        return $this;
257
    }
258
259
    /**
260
     * @param string $phone
261
     *
262
     * @return Receiver
263
     */
264 21
    public function setPhone(string $phone): Receiver
265
    {
266 21
        $this->phone = $phone;
267 21
        return $this;
268
    }
269
270
    /**
271
     * @param \DateTimeInterface $date
272
     *
273
     * @return Receiver
274
     */
275 20
    public function setDate(\DateTimeInterface $date): Receiver
276
    {
277 20
        $this->date = $date;
278 20
        return $this;
279
    }
280
281
    /**
282
     * @param string $timeMin
283
     *
284
     * @return Receiver
285
     */
286 20
    public function setTimeMin(string $timeMin): Receiver
287
    {
288 20
        $this->timeMin = $timeMin;
289 20
        return $this;
290
    }
291
292
    /**
293
     * @param string $timeMax
294
     *
295
     * @return Receiver
296
     */
297 20
    public function setTimeMax(string $timeMax): Receiver
298
    {
299 20
        $this->timeMax = $timeMax;
300 20
        return $this;
301
    }
302
303
    /**
304
     * @return string|null
305
     */
306 1
    public function getTo(): ?string
307
    {
308 1
        return $this->to;
309
    }
310
311
    /**
312
     * @param string|null $to
313
     *
314
     * @return Receiver
315
     */
316 2
    public function setTo(?string $to): Receiver
317
    {
318 2
        $this->to = $to;
319 2
        return $this;
320
    }
321
}
322