|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Signifly\ParcelShop\Resources; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\Collection; |
|
6
|
|
|
|
|
7
|
|
|
class ParcelShop extends Resource |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Get the city name. |
|
11
|
|
|
* |
|
12
|
|
|
* @return string |
|
13
|
|
|
*/ |
|
14
|
|
|
public function city(): string |
|
15
|
|
|
{ |
|
16
|
|
|
return $this->getData('CityName'); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Get the company name. |
|
21
|
|
|
* |
|
22
|
|
|
* @return string |
|
23
|
|
|
*/ |
|
24
|
|
|
public function company(): string |
|
25
|
|
|
{ |
|
26
|
|
|
return $this->getData('CompanyName'); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Get the country code (ISO-3166-A format). |
|
31
|
|
|
* |
|
32
|
|
|
* @return string |
|
33
|
|
|
*/ |
|
34
|
|
|
public function countryCode(): string |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->getData('CountryCodeISO3166A2'); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Get the distance in meters. |
|
41
|
|
|
* |
|
42
|
|
|
* @return int |
|
43
|
|
|
*/ |
|
44
|
|
|
public function distance(): int |
|
45
|
|
|
{ |
|
46
|
|
|
return round($this->getData('DistanceMetersAsTheCrowFlies'), 0); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Get the distance in kilometers. |
|
51
|
|
|
* |
|
52
|
|
|
* @return float |
|
53
|
|
|
*/ |
|
54
|
|
|
public function distanceInKm(): float |
|
55
|
|
|
{ |
|
56
|
|
|
return round($this->distance() / 1000, 3); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Get the latitude. |
|
61
|
|
|
* |
|
62
|
|
|
* @return float |
|
63
|
|
|
*/ |
|
64
|
|
|
public function latitude(): float |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->getData('Latitude'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Get the longitude. |
|
71
|
|
|
* |
|
72
|
|
|
* @return float |
|
73
|
|
|
*/ |
|
74
|
|
|
public function longitude(): float |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->getData('Longitude'); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Get the unique parcel shop number. |
|
81
|
|
|
* |
|
82
|
|
|
* @return string |
|
83
|
|
|
*/ |
|
84
|
|
|
public function number(): string |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->getData('Number'); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Get the opening hours. |
|
91
|
|
|
* |
|
92
|
|
|
* @return \Illuminate\Support\Collection |
|
93
|
|
|
*/ |
|
94
|
|
|
public function openingHours(): Collection |
|
95
|
|
|
{ |
|
96
|
|
|
return collect($this->getData('OpeningHours.Weekday')) |
|
97
|
|
|
->map(function ($data) { |
|
98
|
|
|
return new OpeningHour((array) $data); |
|
99
|
|
|
}); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Get the street name. |
|
104
|
|
|
* |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
|
|
public function streetName(): string |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->getData('Streetname'); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Get the street name 2. |
|
114
|
|
|
* |
|
115
|
|
|
* @return string |
|
116
|
|
|
*/ |
|
117
|
|
|
public function streetName2(): string |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->getData('Streetname2'); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* Get the zip code. |
|
124
|
|
|
* |
|
125
|
|
|
* @return string |
|
126
|
|
|
*/ |
|
127
|
|
|
public function zipCode(): string |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->getData('ZipCode'); |
|
130
|
|
|
} |
|
131
|
|
|
} |
|
132
|
|
|
|