1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace VasilDakov\Speedy\Service\Shipment; |
6
|
|
|
|
7
|
|
|
use VasilDakov\Speedy\Speedy; |
8
|
|
|
use VasilDakov\Speedy\Traits\ToArray; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class ShipmentRecipient |
12
|
|
|
* |
13
|
|
|
* @author Valentin Valkanov <[email protected]> |
14
|
|
|
* @author Vasil Dakov <[email protected]> |
15
|
|
|
* @copyright |
16
|
|
|
* @version |
17
|
|
|
*/ |
18
|
|
|
class ShipmentRecipient |
19
|
|
|
{ |
20
|
|
|
use ToArray; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var ShipmentPhoneNumber |
24
|
|
|
*/ |
25
|
|
|
private ShipmentPhoneNumber $phone1; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var ShipmentPhoneNumber |
29
|
|
|
*/ |
30
|
|
|
private ?ShipmentPhoneNumber $phone2 = null; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var ShipmentPhoneNumber |
34
|
|
|
*/ |
35
|
|
|
private ?ShipmentPhoneNumber $phone3 = null; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
private string $clientName; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var ?string |
44
|
|
|
*/ |
45
|
|
|
private ?string $objectName = null; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var ?string |
49
|
|
|
*/ |
50
|
|
|
private ?string $contactName = null; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
private string $email; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var bool |
59
|
|
|
*/ |
60
|
|
|
private bool $privatePerson = true; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var ShipmentAddress|null |
64
|
|
|
*/ |
65
|
|
|
private ?ShipmentAddress $address; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @var ?int |
69
|
|
|
*/ |
70
|
|
|
private ?int $pickupOfficeId = null; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param ShipmentPhoneNumber $phone1 |
74
|
|
|
* @param string $clientName |
75
|
|
|
* @param string $email |
76
|
|
|
* @param ShipmentAddress|null $address |
77
|
|
|
*/ |
78
|
12 |
|
public function __construct( |
79
|
|
|
ShipmentPhoneNumber $phone1, |
80
|
|
|
string $clientName, |
81
|
|
|
string $email, |
82
|
|
|
?ShipmentAddress $address = null |
83
|
|
|
) { |
84
|
12 |
|
$this->setClientName($clientName); |
85
|
12 |
|
$this->setEmail($email); |
86
|
12 |
|
$this->setPhone1($phone1); |
87
|
12 |
|
$this->address = $address; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return ShipmentPhoneNumber |
92
|
|
|
*/ |
93
|
1 |
|
public function getPhone1(): ShipmentPhoneNumber |
94
|
|
|
{ |
95
|
1 |
|
return $this->phone1; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param ShipmentPhoneNumber $phone1 |
100
|
|
|
*/ |
101
|
12 |
|
public function setPhone1(ShipmentPhoneNumber $phone1): void |
102
|
|
|
{ |
103
|
12 |
|
$this->phone1 = $phone1; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return ShipmentPhoneNumber |
108
|
|
|
*/ |
109
|
1 |
|
public function getPhone2(): ShipmentPhoneNumber |
110
|
|
|
{ |
111
|
1 |
|
return $this->phone2; |
|
|
|
|
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param ShipmentPhoneNumber $phone2 |
116
|
|
|
*/ |
117
|
1 |
|
public function setPhone2(ShipmentPhoneNumber $phone2): void |
118
|
|
|
{ |
119
|
1 |
|
$this->phone2 = $phone2; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return ShipmentPhoneNumber |
124
|
|
|
*/ |
125
|
1 |
|
public function getPhone3(): ShipmentPhoneNumber |
126
|
|
|
{ |
127
|
1 |
|
return $this->phone3; |
|
|
|
|
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param ShipmentPhoneNumber $phone3 |
132
|
|
|
*/ |
133
|
1 |
|
public function setPhone3(ShipmentPhoneNumber $phone3): void |
134
|
|
|
{ |
135
|
1 |
|
$this->phone3 = $phone3; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return string |
140
|
|
|
*/ |
141
|
1 |
|
public function getClientName(): string |
142
|
|
|
{ |
143
|
1 |
|
return $this->clientName; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param string $clientName |
148
|
|
|
*/ |
149
|
12 |
|
public function setClientName(string $clientName): void |
150
|
|
|
{ |
151
|
12 |
|
$this->clientName = $clientName; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return string |
156
|
|
|
*/ |
157
|
1 |
|
public function getObjectName(): string |
158
|
|
|
{ |
159
|
1 |
|
return $this->objectName; |
|
|
|
|
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @param string $objectName |
164
|
|
|
*/ |
165
|
1 |
|
public function setObjectName(string $objectName): void |
166
|
|
|
{ |
167
|
1 |
|
$this->objectName = $objectName; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @return string |
172
|
|
|
*/ |
173
|
1 |
|
public function getContactName(): string |
174
|
|
|
{ |
175
|
1 |
|
return $this->contactName; |
|
|
|
|
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @param string $contactName |
180
|
|
|
*/ |
181
|
1 |
|
public function setContactName(string $contactName): void |
182
|
|
|
{ |
183
|
1 |
|
$this->contactName = $contactName; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @return string |
188
|
|
|
*/ |
189
|
1 |
|
public function getEmail(): string |
190
|
|
|
{ |
191
|
1 |
|
return $this->email; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @param string $email |
196
|
|
|
*/ |
197
|
12 |
|
public function setEmail(string $email): void |
198
|
|
|
{ |
199
|
12 |
|
$this->email = $email; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @return bool |
204
|
|
|
*/ |
205
|
1 |
|
public function getPrivatePerson(): bool |
206
|
|
|
{ |
207
|
1 |
|
return $this->privatePerson; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @param bool $privatePerson |
212
|
|
|
*/ |
213
|
1 |
|
public function setPrivatePerson(bool $privatePerson): void |
214
|
|
|
{ |
215
|
1 |
|
$this->privatePerson = $privatePerson; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @return ShipmentAddress|null |
220
|
|
|
*/ |
221
|
2 |
|
public function getAddress(): ?ShipmentAddress |
222
|
|
|
{ |
223
|
2 |
|
return $this->address; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @param ShipmentAddress|null $address |
228
|
|
|
*/ |
229
|
1 |
|
public function setAddress(?ShipmentAddress $address = null): void |
230
|
|
|
{ |
231
|
1 |
|
$this->address = $address; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @return int |
236
|
|
|
*/ |
237
|
1 |
|
public function getPickupOfficeId(): int |
238
|
|
|
{ |
239
|
1 |
|
return $this->pickupOfficeId; |
|
|
|
|
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* @param int $pickupOfficeId |
244
|
|
|
*/ |
245
|
1 |
|
public function setPickupOfficeId(int $pickupOfficeId): void |
246
|
|
|
{ |
247
|
1 |
|
$this->pickupOfficeId = $pickupOfficeId; |
248
|
|
|
} |
249
|
|
|
} |
250
|
|
|
|