Passed
Push — main ( ed4b4c...986270 )
by Aleksandr
09:15
created

IntervalsRequest::getFilial()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DalliSDK\Requests;
6
7
use DalliSDK\Responses\IntervalsResponse;
8
use JMS\Serializer\Annotation as JMS;
9
10
/**
11
 * Запрос интервалов доставки
12
 *
13
 * @see https://api.dalli-service.com/v1/doc/intervals
14
 * @JMS\XmlRoot("intervals")
15
 */
16
class IntervalsRequest extends AbstractRequest implements RequestInterface
17
{
18
    public const RESPONSE_CLASS = IntervalsResponse::class;
19
20
    /**
21
     * Зона, интервалы которой, вы хотите получить
22
     *
23
     * @JMS\Type("int")
24
     * @JMS\SerializedName("zone")
25
     */
26
    private ?int $zone;
27
28
    /**
29
     * Название города, интервалы которого, вы хотите получить. Работает только для региональной доставки (service 22)
30
     *
31
     * @JMS\Type("string")
32
     * @JMS\SerializedName("town")
33
     */
34
    private ?string $town;
35
36
    /**
37
     * ФИАС города, в котором доступен интервал. Работает только для региональной доставки (service 22)
38
     *
39
     * @JMS\Type("string")
40
     */
41
    private ?string $fias = null;
42
43
    /**
44
     * Тип доставки, интервалы которого, вы хотите получить. (по умолчанию - внутригородская доставка)
45
     *
46
     * @JMS\Type("int")
47
     * @JMS\SerializedName("service")
48
     */
49
    private ?int $service;
50
51
    /**
52
     * Код филиала Dalli. Можно использовать вместо города и ФИАС
53
     *
54
     * @JMS\Type("int")
55
     * @JMS\SerializedName("filial")
56
     */
57
    private ?int $filial = null;
58
59
    /**
60
     * Дата доставки заказа в формате yyyy-mm-dd. Используется при смене интервалов,
61
     * чтобы отображать актуальные интервалы для выбранной даты доставки.
62
     * (по умолчанию - сегодня для экспресс, завтра для остальных)
63
     *
64
     * @JMS\Type("DateTime<'Y-m-d'>")
65
     * @JMS\SerializedName("date")
66
     */
67
    private ?\DateTimeInterface $date;
68
69 3
    public function __construct(
70
        ?int $zone = null,
71
        ?int $service = null,
72
        ?string $town = null,
73
        ?string $fias = null,
74
        ?\DateTimeInterface $date = null,
75
        ?int $filial = null
76
    ) {
77 3
        $this->service = $service;
78 3
        $this->zone = $zone;
79 3
        $this->town = $town;
80 3
        $this->fias = $fias;
81 3
        $this->date = $date;
82 3
        $this->filial = $filial;
83
    }
84
85
    /**
86
     * @return int|null
87
     */
88 3
    public function getZone(): ?int
89
    {
90 3
        return $this->zone;
91
    }
92
93
    /**
94
     * @return string|null
95
     */
96 3
    public function getTown(): ?string
97
    {
98 3
        return $this->town;
99
    }
100
101
    /**
102
     * @return string|null
103
     */
104 3
    public function getFias(): ?string
105
    {
106 3
        return $this->fias;
107
    }
108
109
    /**
110
     * @return int|null
111
     */
112 3
    public function getService(): ?int
113
    {
114 3
        return $this->service;
115
    }
116
117
    /**
118
     * @return \DateTimeInterface|null
119
     */
120 3
    public function getDate(): ?\DateTimeInterface
121
    {
122 3
        return $this->date;
123
    }
124
125 2
    public function getFilial(): ?int
126
    {
127 2
        return $this->filial;
128
    }
129
}
130