Passed
Push — main ( 40e5fc...15bc37 )
by Aleksandr
03:15
created

IntervalsRequest::getService()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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
     * Тип доставки, интервалы которого, вы хотите получить. (по умолчанию - внутригородская доставка)
30
     *
31
     * @JMS\Type("int")
32
     * @JMS\SerializedName("service")
33
     */
34
    private ?int $service;
35
36
    /**
37
     * Дата доставки заказа в формате yyyy-mm-dd. Используется при смене интервалов,
38
     * чтобы отображать актуальные интервалы для выбранной даты доставки.
39
     * (по умолчанию - сегодня для экспресс, завтра для остальных)
40
     *
41
     * @JMS\Type("DateTime<'Y-m-d'>")
42
     * @JMS\SerializedName("date")
43
     */
44
    private ?\DateTimeInterface $date;
45
46 1
    public function __construct(?int $zone = null, ?int $service = null, ?\DateTimeInterface $date = null)
47
    {
48 1
        $this->service = $service;
49 1
        $this->zone = $zone;
50 1
        $this->date = $date;
51
    }
52
53
    /**
54
     * @return int|null
55
     */
56 1
    public function getZone(): ?int
57
    {
58 1
        return $this->zone;
59
    }
60
61
    /**
62
     * @return int|null
63
     */
64 1
    public function getService(): ?int
65
    {
66 1
        return $this->service;
67
    }
68
69
    /**
70
     * @return \DateTimeInterface|null
71
     */
72
    public function getDate(): ?\DateTimeInterface
73
    {
74
        return $this->date;
75
    }
76
}
77