1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace VasilDakov\Speedy\Service\Shipment; |
||
6 | |||
7 | use JMS\Serializer\Annotation as Serializer; |
||
8 | use VasilDakov\Speedy\Property; |
||
9 | use VasilDakov\Speedy\Speedy; |
||
10 | use VasilDakov\Speedy\Traits\ToArray; |
||
11 | |||
12 | /** |
||
13 | * Class ShipmentSender. |
||
14 | * |
||
15 | * @author Valentin Valkanov <[email protected]> |
||
16 | * @author Vasil Dakov <[email protected]> |
||
17 | * @copyright |
||
18 | * |
||
19 | * @version |
||
20 | * |
||
21 | * @Serializer\AccessType("public_method") |
||
22 | */ |
||
23 | class ShipmentSender |
||
24 | { |
||
25 | use ToArray; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
26 | |||
27 | /** |
||
28 | * @Serializer\Type("integer") |
||
29 | */ |
||
30 | private ?int $clientId = null; |
||
31 | |||
32 | private ShipmentPhoneNumber $phone1; |
||
33 | |||
34 | /** |
||
35 | * @var ?ShipmentPhoneNumber |
||
36 | */ |
||
37 | private ?ShipmentPhoneNumber $phone2 = null; |
||
38 | |||
39 | /** |
||
40 | * @var ?ShipmentPhoneNumber |
||
41 | */ |
||
42 | private ?ShipmentPhoneNumber $phone3 = null; |
||
43 | |||
44 | /** |
||
45 | * @Serializer\Type("string") |
||
46 | */ |
||
47 | private ?string $clientName = null; |
||
48 | |||
49 | /** |
||
50 | * @Serializer\Type("string") |
||
51 | */ |
||
52 | private ?string $contactName = null; |
||
53 | |||
54 | /** |
||
55 | * @Serializer\Type("string") |
||
56 | */ |
||
57 | private ?string $email = null; |
||
58 | |||
59 | /** |
||
60 | * @Serializer\Type("bool") |
||
61 | */ |
||
62 | private bool $privatePerson = true; |
||
63 | |||
64 | /** |
||
65 | * @var ?ShipmentAddress |
||
66 | */ |
||
67 | private ?ShipmentAddress $address = null; |
||
68 | |||
69 | /** |
||
70 | * @Serializer\Type("integer") |
||
71 | */ |
||
72 | private ?int $dropoffOfficeId = null; |
||
73 | |||
74 | 12 | public function __construct( |
|
75 | ShipmentPhoneNumber $phone1, |
||
76 | string $email, |
||
77 | string $clientName, |
||
78 | int $dropoffOfficeId = null, |
||
79 | ) { |
||
80 | 12 | $this->phone1 = $phone1; |
|
81 | 12 | $this->email = $email; |
|
82 | 12 | $this->clientName = $clientName; |
|
83 | 12 | $this->dropoffOfficeId = $dropoffOfficeId; |
|
84 | } |
||
85 | |||
86 | 1 | public function getPhone1(): ShipmentPhoneNumber |
|
87 | { |
||
88 | 1 | return $this->phone1; |
|
89 | } |
||
90 | |||
91 | 3 | public function setPhone1(ShipmentPhoneNumber $phone1): void |
|
92 | { |
||
93 | 3 | $this->phone1 = $phone1; |
|
94 | } |
||
95 | |||
96 | 1 | public function getPhone2(): ?ShipmentPhoneNumber |
|
97 | { |
||
98 | 1 | return $this->phone2; |
|
99 | } |
||
100 | |||
101 | 1 | public function setPhone2(ShipmentPhoneNumber $phone2): void |
|
102 | { |
||
103 | 1 | $this->phone2 = $phone2; |
|
104 | } |
||
105 | |||
106 | 1 | public function getPhone3(): ?ShipmentPhoneNumber |
|
107 | { |
||
108 | 1 | return $this->phone3; |
|
109 | } |
||
110 | |||
111 | 1 | public function setPhone3(ShipmentPhoneNumber $phone3): void |
|
112 | { |
||
113 | 1 | $this->phone3 = $phone3; |
|
114 | } |
||
115 | |||
116 | 1 | public function getClientName(): ?string |
|
117 | { |
||
118 | 1 | return $this->clientName; |
|
119 | } |
||
120 | |||
121 | 1 | public function setClientName(string $clientName): void |
|
122 | { |
||
123 | 1 | $this->clientName = $clientName; |
|
124 | } |
||
125 | |||
126 | 1 | public function getContactName(): ?string |
|
127 | { |
||
128 | 1 | return $this->contactName; |
|
129 | } |
||
130 | |||
131 | 3 | public function setContactName(string $contactName): void |
|
132 | { |
||
133 | 3 | $this->contactName = $contactName; |
|
134 | } |
||
135 | |||
136 | 1 | public function getEmail(): ?string |
|
137 | { |
||
138 | 1 | return $this->email; |
|
139 | } |
||
140 | |||
141 | 3 | public function setEmail(string $email): void |
|
142 | { |
||
143 | 3 | $this->email = $email; |
|
144 | } |
||
145 | |||
146 | 1 | public function isPrivatePerson(): bool |
|
147 | { |
||
148 | 1 | return $this->privatePerson; |
|
149 | } |
||
150 | |||
151 | 1 | public function setPrivatePerson(bool $privatePerson): void |
|
152 | { |
||
153 | 1 | $this->privatePerson = $privatePerson; |
|
154 | } |
||
155 | |||
156 | 1 | public function getAddress(): ?ShipmentAddress |
|
157 | { |
||
158 | 1 | return $this->address; |
|
159 | } |
||
160 | |||
161 | 1 | public function setAddress(ShipmentAddress $address): void |
|
162 | { |
||
163 | 1 | $this->address = $address; |
|
164 | } |
||
165 | |||
166 | 1 | public function getDropoffOfficeId(): ?int |
|
167 | { |
||
168 | 1 | return $this->dropoffOfficeId; |
|
169 | } |
||
170 | |||
171 | 1 | public function setDropoffOfficeId(int $dropoffOfficeId): void |
|
172 | { |
||
173 | 1 | $this->dropoffOfficeId = $dropoffOfficeId; |
|
174 | } |
||
175 | |||
176 | public function setClientId(?int $clientId): void |
||
177 | { |
||
178 | $this->clientId = $clientId; |
||
179 | } |
||
180 | |||
181 | public function getClientId(): ?int |
||
182 | { |
||
183 | return $this->clientId; |
||
184 | } |
||
185 | |||
186 | 3 | public function toArray(): array |
|
187 | { |
||
188 | 3 | return [ |
|
189 | 3 | Property::PHONE_1->value => $this->phone1->toArray(), |
|
190 | 3 | Property::CONTACT_NAME->value => $this->contactName, |
|
191 | 3 | Property::EMAIL->value => $this->email, |
|
192 | 3 | ]; |
|
193 | } |
||
194 | } |
||
195 |