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

IntervalsRequest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 20
c 1
b 0
f 0
dl 0
loc 112
ccs 19
cts 19
cp 1
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getService() 0 3 1
A getFias() 0 3 1
A getZone() 0 3 1
A getFilial() 0 3 1
A getTown() 0 3 1
A getDate() 0 3 1
A __construct() 0 14 1
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