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