1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Omniva; |
4
|
|
|
|
5
|
|
|
use Omniva\PickupPoint; |
6
|
|
|
|
7
|
|
|
class Address |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* name & surname |
11
|
|
|
*/ |
12
|
|
|
private $name; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* phone number |
16
|
|
|
*/ |
17
|
|
|
private $phone; |
18
|
|
|
|
19
|
|
|
private $email; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* country code (ISO code 2 letters) |
23
|
|
|
*/ |
24
|
|
|
private $country; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* terminal identifier |
28
|
|
|
*/ |
29
|
|
|
private $terminal; |
30
|
|
|
|
31
|
|
|
private $city; |
32
|
|
|
|
33
|
|
|
private $street; |
34
|
|
|
|
35
|
|
|
private $postcode; |
36
|
|
|
|
37
|
|
|
private $pickupPoint; |
38
|
|
|
|
39
|
|
|
public function setName(string $name): self |
40
|
|
|
{ |
41
|
|
|
$this->name = $name; |
42
|
|
|
return $this; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function getName(): string |
46
|
|
|
{ |
47
|
|
|
return $this->name; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function setPhone(?string $phone): self |
51
|
|
|
{ |
52
|
|
|
$this->phone = $phone; |
53
|
|
|
return $this; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function getPhone(): ?string |
57
|
|
|
{ |
58
|
|
|
return $this->phone; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function setEmail(string $email): self |
62
|
|
|
{ |
63
|
|
|
$this->email = $email; |
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getEmail(): string |
68
|
|
|
{ |
69
|
|
|
return $this->email; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function hasEmail(): bool |
73
|
|
|
{ |
74
|
|
|
return is_string($this->email); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function setCountryCode(string $code): self |
78
|
|
|
{ |
79
|
|
|
$this->country = $code; |
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getCountryCode(): string |
84
|
|
|
{ |
85
|
|
|
return $this->country; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function setTerminal(string $terminal): self |
89
|
|
|
{ |
90
|
|
|
trigger_error('This method will removed 1.0. Use setPickupPoint() instead.', E_USER_DEPRECATED); |
91
|
|
|
$this->terminal = $terminal; |
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function hasTerminal(): bool |
96
|
|
|
{ |
97
|
|
|
trigger_error('This method will removed 1.0. Use hasPickupPoint() instead.', E_USER_DEPRECATED); |
98
|
|
|
return is_string($this->terminal); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function getTerminal(): ?string |
102
|
|
|
{ |
103
|
|
|
trigger_error('This method will removed 1.0. Use getPickupPoint() instead.', E_USER_DEPRECATED); |
104
|
|
|
return $this->terminal; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function setCity(string $city): self |
108
|
|
|
{ |
109
|
|
|
$this->city = $city; |
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function getCity(): string |
114
|
|
|
{ |
115
|
|
|
return $this->city; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function setStreet(string $street): self |
119
|
|
|
{ |
120
|
|
|
$this->street = $street; |
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function getStreet(): string |
125
|
|
|
{ |
126
|
|
|
return $this->street; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function setPostCode(string $code): self |
130
|
|
|
{ |
131
|
|
|
$this->postcode = $code; |
132
|
|
|
return $this; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function getPostCode(): string |
136
|
|
|
{ |
137
|
|
|
return $this->postcode; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function setPickupPoint(PickupPoint $point) |
141
|
|
|
{ |
142
|
|
|
$this->pickupPoint = $point; |
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function getPickupPoint(): ?PickupPoint |
147
|
|
|
{ |
148
|
|
|
return $this->pickupPoint; |
149
|
|
|
} |
150
|
|
|
} |
151
|
|
|
|