1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ZfSnapGeoip\Entity; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Record entity |
7
|
|
|
* |
8
|
|
|
* @author Witold Wasiczko <[email protected]> |
9
|
|
|
*/ |
10
|
|
|
class Record implements RecordInterface |
11
|
|
|
{ |
12
|
|
|
private $areaCode; |
13
|
|
|
private $city; |
14
|
|
|
private $continentCode; |
15
|
|
|
private $countryCode; |
16
|
|
|
private $countryCode3; |
17
|
|
|
private $countryName; |
18
|
|
|
private $dmaCode; |
19
|
|
|
private $latitude; |
20
|
|
|
private $longitude; |
21
|
|
|
private $metroCode; |
22
|
|
|
private $postalCode; |
23
|
|
|
private $region; |
24
|
|
|
private $regionName; |
25
|
|
|
|
26
|
|
|
public function getAreaCode() |
27
|
|
|
{ |
28
|
|
|
return $this->areaCode; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function setAreaCode($areaCode) |
32
|
|
|
{ |
33
|
|
|
$this->areaCode = $areaCode; |
34
|
|
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function getCity() |
38
|
|
|
{ |
39
|
|
|
return $this->city; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function setCity($city) |
43
|
|
|
{ |
44
|
|
|
$this->city = $city; |
45
|
|
|
return $this; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getContinentCode() |
49
|
|
|
{ |
50
|
|
|
return $this->continentCode; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function setContinentCode($continentCode) |
54
|
|
|
{ |
55
|
|
|
$this->continentCode = $continentCode; |
56
|
|
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getCountryCode() |
60
|
|
|
{ |
61
|
|
|
return $this->countryCode; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setCountryCode($countryCode) |
65
|
|
|
{ |
66
|
|
|
$this->countryCode = $countryCode; |
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getCountryCode3() |
71
|
|
|
{ |
72
|
|
|
return $this->countryCode3; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function setCountryCode3($countryCode3) |
76
|
|
|
{ |
77
|
|
|
$this->countryCode3 = $countryCode3; |
78
|
|
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function getCountryName() |
82
|
|
|
{ |
83
|
|
|
return $this->countryName; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function setCountryName($countryName) |
87
|
|
|
{ |
88
|
|
|
$this->countryName = $countryName; |
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function getDmaCode() |
93
|
|
|
{ |
94
|
|
|
return $this->dmaCode; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function setDmaCode($dmaCode) |
98
|
|
|
{ |
99
|
|
|
$this->dmaCode = $dmaCode; |
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function getLatitude() |
104
|
|
|
{ |
105
|
|
|
return $this->latitude; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function setLatitude($latitude) |
109
|
|
|
{ |
110
|
|
|
$this->latitude = $latitude; |
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getLongitude() |
115
|
|
|
{ |
116
|
|
|
return $this->longitude; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function setLongitude($longitude) |
120
|
|
|
{ |
121
|
|
|
$this->longitude = $longitude; |
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function getMetroCode() |
126
|
|
|
{ |
127
|
|
|
return $this->metroCode; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function setMetroCode($metroCode) |
131
|
|
|
{ |
132
|
|
|
$this->metroCode = $metroCode; |
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function getPostalCode() |
137
|
|
|
{ |
138
|
|
|
return $this->postalCode; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function setPostalCode($postalCode) |
142
|
|
|
{ |
143
|
|
|
$this->postalCode = $postalCode; |
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function getRegion() |
148
|
|
|
{ |
149
|
|
|
return $this->region; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function setRegion($region) |
153
|
|
|
{ |
154
|
|
|
$this->region = $region; |
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
public function getRegionName() |
159
|
|
|
{ |
160
|
|
|
return $this->regionName; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
public function setRegionName($regionName) |
164
|
|
|
{ |
165
|
|
|
$this->regionName = $regionName; |
166
|
|
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function getTimezone() |
170
|
|
|
{ |
171
|
|
|
$country = $this->getCountryCode(); |
172
|
|
|
$region = $this->getRegion(); |
173
|
|
|
|
174
|
|
|
return \get_time_zone($country, $region); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public function __toString() |
178
|
|
|
{ |
179
|
|
|
$city = $this->getCity(); |
180
|
|
|
|
181
|
|
|
if (!$city) { |
182
|
|
|
$city = ''; |
183
|
|
|
} |
184
|
|
|
return $city; |
185
|
|
|
} |
186
|
|
|
} |
187
|
|
|
|