1 | <?php |
||
21 | class Geoip implements EventManagerAwareInterface |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @var \GeoIP |
||
26 | */ |
||
27 | private $geoip; |
||
28 | |||
29 | /** |
||
30 | * @var ServiceManager |
||
31 | */ |
||
32 | private $serviceManager; |
||
33 | |||
34 | /** |
||
35 | * @var EventManagerInterface |
||
36 | */ |
||
37 | private $eventManager; |
||
38 | |||
39 | /** |
||
40 | * @var GeoipCoreRecord[] |
||
41 | */ |
||
42 | private $records; |
||
43 | |||
44 | /** |
||
45 | * @var string|bool |
||
46 | */ |
||
47 | private $defaultIp; |
||
48 | |||
49 | /** |
||
50 | * @var DatabaseConfig |
||
51 | */ |
||
52 | private $config; |
||
53 | |||
54 | /** |
||
55 | * @var array |
||
56 | */ |
||
57 | private $regions; |
||
58 | |||
59 | /** |
||
60 | * Geoip constructor. |
||
61 | * @param ServiceManager $serviceManager |
||
62 | */ |
||
63 | public function __construct(ServiceManager $serviceManager) |
||
67 | |||
68 | /** |
||
69 | * Destructor |
||
70 | */ |
||
71 | public function __destruct() |
||
75 | |||
76 | /** |
||
77 | * @return \GeoIP |
||
78 | */ |
||
79 | public function getGeoip() |
||
91 | |||
92 | /** |
||
93 | * @param string $ipAddress |
||
94 | * @return GeoipCoreRecord |
||
95 | */ |
||
96 | public function getGeoipRecord($ipAddress) |
||
106 | |||
107 | /** |
||
108 | * @param string $ipAddress |
||
109 | * @return string |
||
110 | */ |
||
111 | private function getIp($ipAddress) |
||
126 | |||
127 | /** |
||
128 | * @param string $ipAdress |
||
129 | * @return RecordInterface |
||
130 | */ |
||
131 | public function getRecord($ipAdress = null) |
||
160 | |||
161 | /** |
||
162 | * @param string $ipAddress |
||
163 | * @return RecordInterface |
||
164 | */ |
||
165 | public function lookup($ipAddress = null) |
||
169 | |||
170 | /** |
||
171 | * @return self |
||
172 | */ |
||
173 | private function closeGeoip() |
||
181 | |||
182 | /** |
||
183 | * @return array |
||
184 | */ |
||
185 | private function getRegions() |
||
203 | |||
204 | /** |
||
205 | * @return DatabaseConfig |
||
206 | */ |
||
207 | private function getConfig() |
||
216 | |||
217 | /** |
||
218 | * @return string|null |
||
219 | */ |
||
220 | private function getDefaultIp() |
||
235 | |||
236 | /** |
||
237 | * @param array $data |
||
238 | * @return string |
||
239 | */ |
||
240 | private function getRegionName(array $data = []) |
||
255 | |||
256 | /** |
||
257 | * @return EventManagerInterface |
||
258 | */ |
||
259 | public function getEventManager() |
||
266 | |||
267 | /** |
||
268 | * @param EventManagerInterface $eventManager |
||
269 | * @return self |
||
270 | */ |
||
271 | public function setEventManager(EventManagerInterface $eventManager) |
||
281 | } |
||
282 |