1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ZpgRtf\Objects; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Providing an accurate address and location for the property is incredibly important because a large number of |
7
|
|
|
* existing and future features on our websites depend on it. For example: which council is responsible for the |
8
|
|
|
* maintaining and taxing the local area; or average travel times between the property and other locations of interest |
9
|
|
|
* to the user. |
10
|
|
|
*/ |
11
|
|
|
class LocationObject implements \JsonSerializable |
12
|
|
|
{ |
13
|
|
|
/** @var null|string */ |
14
|
|
|
private $propertyNameOrNumber; |
15
|
|
|
|
16
|
|
|
/** @var null|string */ |
17
|
|
|
private $streetName; |
18
|
|
|
|
19
|
|
|
/** @var null|string */ |
20
|
|
|
private $locality; |
21
|
|
|
|
22
|
|
|
/** @var null|string */ |
23
|
|
|
private $townOrCity; |
24
|
|
|
|
25
|
|
|
/** @var null|string */ |
26
|
|
|
private $county; |
27
|
|
|
|
28
|
|
|
/** @var null|string */ |
29
|
|
|
private $postalCode; |
30
|
|
|
|
31
|
|
|
/** @var null|string */ |
32
|
|
|
private $countryCode; |
33
|
|
|
|
34
|
|
|
/** @var null|CoordinatesObject */ |
35
|
|
|
private $coordinates; |
36
|
|
|
|
37
|
|
|
/** @var null|PafAddressObject */ |
38
|
|
|
private $pafAddress; |
39
|
|
|
|
40
|
|
|
/** @var null|string */ |
41
|
|
|
private $pafUdprn; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return null|string |
45
|
|
|
*/ |
46
|
4 |
|
public function getPropertyNameOrNumber() |
47
|
|
|
{ |
48
|
4 |
|
return $this->propertyNameOrNumber; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param string $propertyNameOrNumber |
53
|
|
|
* |
54
|
|
|
* @return LocationObject |
55
|
|
|
*/ |
56
|
3 |
|
public function setPropertyNameOrNumber(string $propertyNameOrNumber): self |
57
|
|
|
{ |
58
|
3 |
|
$this->propertyNameOrNumber = $propertyNameOrNumber; |
59
|
|
|
|
60
|
3 |
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return null|string |
65
|
|
|
*/ |
66
|
4 |
|
public function getStreetName() |
67
|
|
|
{ |
68
|
4 |
|
return $this->streetName; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param string $streetName |
73
|
|
|
* |
74
|
|
|
* @return LocationObject |
75
|
|
|
*/ |
76
|
3 |
|
public function setStreetName(string $streetName): self |
77
|
|
|
{ |
78
|
3 |
|
$this->streetName = $streetName; |
79
|
|
|
|
80
|
3 |
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return null|string |
85
|
|
|
*/ |
86
|
4 |
|
public function getLocality() |
87
|
|
|
{ |
88
|
4 |
|
return $this->locality; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param string $locality |
93
|
|
|
* |
94
|
|
|
* @return LocationObject |
95
|
|
|
*/ |
96
|
3 |
|
public function setLocality(string $locality): self |
97
|
|
|
{ |
98
|
3 |
|
$this->locality = $locality; |
99
|
|
|
|
100
|
3 |
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return null|string |
105
|
|
|
*/ |
106
|
4 |
|
public function getTownOrCity() |
107
|
|
|
{ |
108
|
4 |
|
return $this->townOrCity; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @param string $townOrCity |
113
|
|
|
* |
114
|
|
|
* @return LocationObject |
115
|
|
|
*/ |
116
|
3 |
|
public function setTownOrCity(string $townOrCity): self |
117
|
|
|
{ |
118
|
3 |
|
$this->townOrCity = $townOrCity; |
119
|
|
|
|
120
|
3 |
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return null|string |
125
|
|
|
*/ |
126
|
4 |
|
public function getCounty() |
127
|
|
|
{ |
128
|
4 |
|
return $this->county; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param string $county |
133
|
|
|
* |
134
|
|
|
* @return LocationObject |
135
|
|
|
*/ |
136
|
3 |
|
public function setCounty(string $county): self |
137
|
|
|
{ |
138
|
3 |
|
$this->county = $county; |
139
|
|
|
|
140
|
3 |
|
return $this; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @return null|string |
145
|
|
|
*/ |
146
|
4 |
|
public function getPostalCode() |
147
|
|
|
{ |
148
|
4 |
|
return $this->postalCode; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @param string $postalCode |
153
|
|
|
* |
154
|
|
|
* @return LocationObject |
155
|
|
|
*/ |
156
|
3 |
|
public function setPostalCode(string $postalCode): self |
157
|
|
|
{ |
158
|
3 |
|
$this->postalCode = $postalCode; |
159
|
|
|
|
160
|
3 |
|
return $this; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @return null|string |
165
|
|
|
*/ |
166
|
4 |
|
public function getCountryCode() |
167
|
|
|
{ |
168
|
4 |
|
return $this->countryCode; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @param string $countryCode |
173
|
|
|
* |
174
|
|
|
* @return LocationObject |
175
|
|
|
*/ |
176
|
3 |
|
public function setCountryCode(string $countryCode): self |
177
|
|
|
{ |
178
|
3 |
|
$this->countryCode = $countryCode; |
179
|
|
|
|
180
|
3 |
|
return $this; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @return null|CoordinatesObject |
185
|
|
|
*/ |
186
|
4 |
|
public function getCoordinates() |
187
|
|
|
{ |
188
|
4 |
|
return $this->coordinates; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* @param CoordinatesObject $coordinates |
193
|
|
|
* |
194
|
|
|
* @return LocationObject |
195
|
|
|
*/ |
196
|
3 |
|
public function setCoordinates(CoordinatesObject $coordinates): self |
197
|
|
|
{ |
198
|
3 |
|
$this->coordinates = $coordinates; |
199
|
|
|
|
200
|
3 |
|
return $this; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return null|PafAddressObject |
205
|
|
|
*/ |
206
|
4 |
|
public function getPafAddress() |
207
|
|
|
{ |
208
|
4 |
|
return $this->pafAddress; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @param PafAddressObject $pafAddress |
213
|
|
|
* |
214
|
|
|
* @return LocationObject |
215
|
|
|
*/ |
216
|
2 |
|
public function setPafAddress(PafAddressObject $pafAddress): self |
217
|
|
|
{ |
218
|
2 |
|
$this->pafAddress = $pafAddress; |
219
|
|
|
|
220
|
2 |
|
return $this; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @return null|string |
225
|
|
|
*/ |
226
|
4 |
|
public function getPafUdprn() |
227
|
|
|
{ |
228
|
4 |
|
return $this->pafUdprn; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* @param string $pafUdprn |
233
|
|
|
* |
234
|
|
|
* @return LocationObject |
235
|
|
|
*/ |
236
|
2 |
|
public function setPafUdprn(string $pafUdprn): self |
237
|
|
|
{ |
238
|
2 |
|
$this->pafUdprn = $pafUdprn; |
239
|
|
|
|
240
|
2 |
|
return $this; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** {@inheritDoc} */ |
244
|
3 |
|
public function jsonSerialize(): array |
245
|
|
|
{ |
246
|
3 |
|
return array_filter([ |
247
|
3 |
|
'property_number_or_name' => $this->getPropertyNameOrNumber(), |
248
|
3 |
|
'street_name' => $this->getStreetName(), |
249
|
3 |
|
'locality' => $this->getLocality(), |
250
|
3 |
|
'town_or_city' => $this->getTownOrCity(), |
251
|
3 |
|
'county' => $this->getCounty(), |
252
|
3 |
|
'postal_code' => $this->getPostalCode(), |
253
|
3 |
|
'country_code' => $this->getCountryCode(), |
254
|
3 |
|
'coordinates' => $this->getCoordinates(), |
255
|
3 |
|
'paf_address' => $this->getPafAddress(), |
256
|
3 |
|
'paf_udprn' => $this->getPafUdprn(), |
257
|
|
|
]); |
258
|
|
|
} |
259
|
|
|
} |
260
|
|
|
|