1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BPCI\SumUp\Customer; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class Address |
7
|
|
|
* @package BPCI\SumUp\Customer |
8
|
|
|
*/ |
9
|
|
|
class Address implements AddressInterface |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* First address line |
13
|
|
|
* |
14
|
|
|
* @var string $line1 |
15
|
|
|
*/ |
16
|
|
|
protected $line1; |
17
|
|
|
/** |
18
|
|
|
* Second address line |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $line2; |
23
|
|
|
/** |
24
|
|
|
* Address Country |
25
|
|
|
* |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
protected $country; |
29
|
|
|
/** |
30
|
|
|
* Address postal code |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $postalCode; |
35
|
|
|
/** |
36
|
|
|
* Address City |
37
|
|
|
* |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
protected $city; |
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $countryEnName; |
45
|
|
|
/** |
46
|
|
|
* @var string |
47
|
|
|
*/ |
48
|
|
|
protected $countryNativeName; |
49
|
|
|
/** |
50
|
|
|
* @var integer |
51
|
|
|
*/ |
52
|
|
|
protected $regionId; |
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
protected $regionName; |
57
|
|
|
/** |
58
|
|
|
* @var string |
59
|
|
|
*/ |
60
|
|
|
protected $postCode; |
61
|
|
|
/** |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $landline; |
65
|
|
|
/** |
66
|
|
|
* @var string |
67
|
|
|
*/ |
68
|
|
|
protected $addressLine1; |
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
protected $addressLine2; |
73
|
|
|
/** |
74
|
|
|
* Address State |
75
|
|
|
* |
76
|
|
|
* @var string |
77
|
|
|
*/ |
78
|
|
|
protected $state; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Address constructor. |
82
|
|
|
* @param array|null $data |
83
|
|
|
*/ |
84
|
6 |
|
public function __construct(?array $data = []) |
85
|
|
|
{ |
86
|
6 |
|
$this->setAddressLine1($data['address_line1']??null); |
87
|
6 |
|
$this->setAddressLine2($data['address_line2']??null); |
88
|
6 |
|
$this->setCity($data['city']??null); |
89
|
6 |
|
$this->setCountry($data['country']??null); |
90
|
6 |
|
$this->setCountryEnName($data['country_en_name']??null); |
91
|
6 |
|
$this->setCountryNativeName($data['country_native_name']??null); |
92
|
6 |
|
$this->setRegionId($data['region_id']??null); |
93
|
6 |
|
$this->setRegionName($data['region_name']??null); |
94
|
6 |
|
$this->setPostCode($data['post_code']??null); |
95
|
6 |
|
$this->setLandline($data['landline']??null); |
96
|
6 |
|
$this->setLine1($data['line1']??null); |
97
|
6 |
|
$this->setLine2($data['line2']??null); |
98
|
6 |
|
$this->setPostalCode($data['postal_code']??null); |
99
|
6 |
|
$this->setState($data['state']??null); |
100
|
6 |
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Get $line1 |
104
|
|
|
* |
105
|
|
|
* @return string |
106
|
|
|
*/ |
107
|
1 |
|
public function getLine1(): ?string |
108
|
|
|
{ |
109
|
1 |
|
return $this->line1; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set $line1 |
114
|
|
|
* |
115
|
|
|
* @param string $line1 $line1 |
116
|
|
|
* |
117
|
|
|
* @return AddressInterface |
118
|
|
|
*/ |
119
|
6 |
|
public function setLine1(?string $line1): AddressInterface |
120
|
|
|
{ |
121
|
6 |
|
$this->line1 = $line1; |
122
|
|
|
|
123
|
6 |
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Get second address line |
128
|
|
|
* |
129
|
|
|
* @return string |
130
|
|
|
*/ |
131
|
1 |
|
public function getLine2(): ?string |
132
|
|
|
{ |
133
|
1 |
|
return $this->line2; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Set second address line |
138
|
|
|
* |
139
|
|
|
* @param string $line2 Second address line |
140
|
|
|
* |
141
|
|
|
* @return AddressInterface |
142
|
|
|
*/ |
143
|
6 |
|
public function setLine2(?string $line2): AddressInterface |
144
|
|
|
{ |
145
|
6 |
|
$this->line2 = $line2; |
146
|
|
|
|
147
|
6 |
|
return $this; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* Get address Country |
152
|
|
|
* |
153
|
|
|
* @return string |
154
|
|
|
*/ |
155
|
1 |
|
public function getCountry(): ?string |
156
|
|
|
{ |
157
|
1 |
|
return $this->country; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Set address Country |
162
|
|
|
* |
163
|
|
|
* @param string $country Address Country |
164
|
|
|
* |
165
|
|
|
* @return AddressInterface |
166
|
|
|
*/ |
167
|
6 |
|
public function setCountry(?string $country): AddressInterface |
168
|
|
|
{ |
169
|
6 |
|
$this->country = $country; |
170
|
|
|
|
171
|
6 |
|
return $this; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Get address postal code |
176
|
|
|
* |
177
|
|
|
* @return string |
178
|
|
|
*/ |
179
|
1 |
|
public function getPostalCode(): ?string |
180
|
|
|
{ |
181
|
1 |
|
return $this->postalCode; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Set address postal code |
186
|
|
|
* |
187
|
|
|
* @param string $postalCode Address postal code |
188
|
|
|
* |
189
|
|
|
* @return AddressInterface |
190
|
|
|
*/ |
191
|
6 |
|
public function setPostalCode(?string $postalCode): AddressInterface |
192
|
|
|
{ |
193
|
6 |
|
$this->postalCode = $postalCode; |
194
|
|
|
|
195
|
6 |
|
return $this; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Get address City |
200
|
|
|
* |
201
|
|
|
* @return string |
202
|
|
|
*/ |
203
|
1 |
|
public function getCity(): ?string |
204
|
|
|
{ |
205
|
1 |
|
return $this->city; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Set address City |
210
|
|
|
* |
211
|
|
|
* @param string $city Address City |
212
|
|
|
* |
213
|
|
|
* @return AddressInterface |
214
|
|
|
*/ |
215
|
6 |
|
public function setCity(?string $city): AddressInterface |
216
|
|
|
{ |
217
|
6 |
|
$this->city = $city; |
218
|
|
|
|
219
|
6 |
|
return $this; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @return mixed |
224
|
|
|
*/ |
225
|
|
|
public function getCountryEnName():? string |
226
|
|
|
{ |
227
|
|
|
return $this->countryEnName; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @param mixed $countryEnName |
232
|
|
|
* @return AddressInterface |
233
|
|
|
*/ |
234
|
6 |
|
public function setCountryEnName($countryEnName): AddressInterface |
235
|
|
|
{ |
236
|
6 |
|
$this->countryEnName = $countryEnName; |
237
|
|
|
|
238
|
6 |
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* @return mixed |
243
|
|
|
*/ |
244
|
|
|
public function getCountryNativeName():? string |
245
|
|
|
{ |
246
|
|
|
return $this->countryNativeName; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @param mixed $countryNativeName |
251
|
|
|
* @return AddressInterface |
252
|
|
|
*/ |
253
|
6 |
|
public function setCountryNativeName(?string $countryNativeName): AddressInterface |
254
|
|
|
{ |
255
|
6 |
|
$this->countryNativeName = $countryNativeName; |
256
|
|
|
|
257
|
6 |
|
return $this; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* @return int|null |
262
|
|
|
*/ |
263
|
|
|
public function getRegionId():? int |
264
|
|
|
{ |
265
|
|
|
return $this->regionId; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* @param int|null $regionId |
270
|
|
|
* @return AddressInterface |
271
|
|
|
*/ |
272
|
6 |
|
public function setRegionId(?int $regionId): AddressInterface |
273
|
|
|
{ |
274
|
6 |
|
$this->regionId = $regionId; |
275
|
|
|
|
276
|
6 |
|
return $this; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* @return string|null |
281
|
|
|
*/ |
282
|
|
|
public function getRegionName():? string |
283
|
|
|
{ |
284
|
|
|
return $this->regionName; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* @param string|null $regionName |
289
|
|
|
* @return AddressInterface |
290
|
|
|
*/ |
291
|
6 |
|
public function setRegionName(?string $regionName): AddressInterface |
292
|
|
|
{ |
293
|
6 |
|
$this->regionName = $regionName; |
294
|
|
|
|
295
|
6 |
|
return $this; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* @return string|null |
300
|
|
|
*/ |
301
|
|
|
public function getPostCode():? string |
302
|
|
|
{ |
303
|
|
|
return $this->postCode; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* @param string|null $postCode |
308
|
|
|
* @return AddressInterface |
309
|
|
|
*/ |
310
|
6 |
|
public function setPostCode(?string $postCode): AddressInterface |
311
|
|
|
{ |
312
|
6 |
|
$this->postCode = $postCode; |
313
|
|
|
|
314
|
6 |
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @return string|null |
319
|
|
|
*/ |
320
|
|
|
public function getLandline():? string |
321
|
|
|
{ |
322
|
|
|
return $this->landline; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* @param string|null $landline |
327
|
|
|
* @return AddressInterface |
328
|
|
|
*/ |
329
|
6 |
|
public function setLandline(?string $landline): AddressInterface |
330
|
|
|
{ |
331
|
6 |
|
$this->landline = $landline; |
332
|
|
|
|
333
|
6 |
|
return $this; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* @return string|null |
338
|
|
|
*/ |
339
|
|
|
public function getAddressLine1():? string |
340
|
|
|
{ |
341
|
|
|
return $this->addressLine1; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* @param string|null $addressLine1 |
346
|
|
|
* @return AddressInterface |
347
|
|
|
*/ |
348
|
6 |
|
public function setAddressLine1(?string $addressLine1): AddressInterface |
349
|
|
|
{ |
350
|
6 |
|
$this->addressLine1 = $addressLine1; |
351
|
|
|
|
352
|
6 |
|
return $this; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* @return string|null |
357
|
|
|
*/ |
358
|
|
|
public function getAddressLine2():? string |
359
|
|
|
{ |
360
|
|
|
return $this->addressLine2; |
361
|
|
|
} |
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @param string|null $addressLine2 |
365
|
|
|
* @return AddressInterface |
366
|
|
|
*/ |
367
|
6 |
|
public function setAddressLine2(?string $addressLine2): AddressInterface |
368
|
|
|
{ |
369
|
6 |
|
$this->addressLine2 = $addressLine2; |
370
|
|
|
|
371
|
6 |
|
return $this; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* Get address State |
376
|
|
|
* |
377
|
|
|
* @return string|null |
378
|
|
|
*/ |
379
|
1 |
|
public function getState(): ?string |
380
|
|
|
{ |
381
|
1 |
|
return $this->state; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
/** |
385
|
|
|
* Set address State |
386
|
|
|
* |
387
|
|
|
* @param string|null $state Address State |
388
|
|
|
* |
389
|
|
|
* @return AddressInterface |
390
|
|
|
*/ |
391
|
6 |
|
public function setState(?string $state): AddressInterface |
392
|
|
|
{ |
393
|
6 |
|
$this->state = $state; |
394
|
|
|
|
395
|
6 |
|
return $this; |
396
|
|
|
} |
397
|
|
|
} |
398
|
|
|
|