Passed
Push — main ( 5489db...717dd1 )
by Vasil
15:04
created

CreateShipmentResponse::setDeliveryDeadline()   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
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VasilDakov\Speedy\Service\Shipment;
6
7
use DateTime;
8
use JMS\Serializer\Annotation as Serializer;
9
use VasilDakov\Speedy\Error;
10
11
/**
12
 * Class CreateShipmentResponse
13
 *
14
 * @Serializer\AccessType("public_method")
15
 * @author Vasil Dakov <[email protected]>
16
 * @copyright 2009-2022 Neutrino.bg
17
 * @version 1.0
18
 */
19
class CreateShipmentResponse
20
{
21
    /**
22
     * @var string
23
     * @Serializer\Type("string")
24
     * @Serializer\Accessor(getter="getId", setter="setId")
25
     */
26
    private string $id;
27
28
    /**
29
     * @var array|null
30
     * @Serializer\Type("array")
31
     */
32
    private ?array $parcels = null;
33
34
    /**
35
     * @var ShipmentPrice|null
36
     * @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentPrice")
37
     * @Serializer\Accessor(getter="getPrice", setter="setPrice")
38
     */
39
    private ?ShipmentPrice $price = null;
40
41
    /**
42
     * @var DateTime|null
43
     * @Serializer\Type("DateTime<'Y-m-d'>")
44
     */
45
    private ?DateTime $pickupDate = null;
46
47
    /**
48
     * @var DateTime
49
     * @Serializer\Type("DateTime")
50
     */
51
    private DateTime $deliveryDeadline;
52
53
    /**
54
     * @var Error|null
55
     * @Serializer\Type("VasilDakov\Speedy\Error")
56
     */
57
    private ?Error $error = null;
58
59
    /**
60
     * @param string|null $id
61
     */
62 4
    public function setId(?string $id): void
63
    {
64 4
        $this->id = $id;
65
    }
66
67
    /**
68
     * @return string|null
69
     */
70
    public function getId(): ?string
71
    {
72
        return $this->id;
73
    }
74
75
    /**
76
     * @return array
77
     */
78 1
    public function getParcels(): array
79
    {
80 1
        return $this->parcels;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->parcels could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
81
    }
82
83
    /**
84
     * @param array $parcels
85
     */
86 1
    public function setParcels(array $parcels = []): void
87
    {
88 1
        $this->parcels = $parcels;
89
    }
90
91
    /**
92
     * @return ShipmentPrice|null
93
     */
94 2
    public function getPrice(): ?ShipmentPrice
95
    {
96 2
        return $this->price;
97
    }
98
99
    /**
100
     * @param ?ShipmentPrice $price
101
     */
102 4
    public function setPrice(?ShipmentPrice $price): void
103
    {
104 4
        $this->price = $price;
105
    }
106
107
    /**
108
     * @return DateTime
109
     */
110 1
    public function getPickupDate(): DateTime
111
    {
112 1
        return $this->pickupDate;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->pickupDate could return the type null which is incompatible with the type-hinted return DateTime. Consider adding an additional type-check to rule them out.
Loading history...
113
    }
114
115
    /**
116
     * @param DateTime $pickupDate
117
     */
118 4
    public function setPickupDate(DateTime $pickupDate): void
119
    {
120 4
        $this->pickupDate = $pickupDate;
121
    }
122
123
    /**
124
     * @return DateTime
125
     */
126 1
    public function getDeliveryDeadline(): DateTime
127
    {
128 1
        return $this->deliveryDeadline;
129
    }
130
131
    /**
132
     * @param DateTime $deliveryDeadline
133
     */
134 4
    public function setDeliveryDeadline(DateTime $deliveryDeadline): void
135
    {
136 4
        $this->deliveryDeadline = $deliveryDeadline;
137
    }
138
139
    /**
140
     * @return mixed
141
     */
142 1
    public function getError()
143
    {
144 1
        return $this->error;
145
    }
146
147
    /**
148
     * @param mixed $error
149
     */
150 1
    public function setError($error = null): void
151
    {
152 1
        $this->error = $error;
153
    }
154
}
155