1 | <?php namespace Arcanedev\GeoIP; |
||
17 | class GeoIP implements GeoIPContract |
||
18 | { |
||
19 | /* ------------------------------------------------------------------------------------------------ |
||
20 | | Properties |
||
21 | | ------------------------------------------------------------------------------------------------ |
||
22 | */ |
||
23 | /** @var \Arcanedev\GeoIP\Contracts\GeoIPDriver */ |
||
24 | private $driver; |
||
25 | |||
26 | /** @var \Arcanedev\GeoIP\Contracts\GeoIPCache */ |
||
27 | private $cache; |
||
28 | |||
29 | /** @var array */ |
||
30 | protected $config = []; |
||
31 | |||
32 | /** @var \Arcanedev\GeoIP\Location */ |
||
33 | protected $location; |
||
34 | |||
35 | /** @var array */ |
||
36 | protected $defaultLocation = []; |
||
37 | |||
38 | /** @var string */ |
||
39 | protected $remoteIp; |
||
40 | |||
41 | /** @var array */ |
||
42 | protected $currencies; |
||
43 | |||
44 | /* ------------------------------------------------------------------------------------------------ |
||
45 | | Constructor |
||
46 | | ------------------------------------------------------------------------------------------------ |
||
47 | */ |
||
48 | /** |
||
49 | * Create a new GeoIP instance. |
||
50 | * |
||
51 | * @param \Arcanedev\GeoIP\Contracts\GeoIPDriver $driver |
||
52 | * @param \Arcanedev\GeoIP\Contracts\GeoIPCache $cache |
||
53 | * @param array $config |
||
54 | */ |
||
55 | 36 | public function __construct(GeoIPDriver $driver, GeoIPCache $cache, array $config) |
|
64 | |||
65 | /* ------------------------------------------------------------------------------------------------ |
||
66 | | Getters & Setters |
||
67 | | ------------------------------------------------------------------------------------------------ |
||
68 | */ |
||
69 | /** |
||
70 | * Get the GeoIP driver instance. |
||
71 | * |
||
72 | * @return \Arcanedev\GeoIP\Contracts\GeoIPDriver |
||
73 | */ |
||
74 | 18 | public function driver() |
|
78 | |||
79 | /** |
||
80 | * Get cache instance. |
||
81 | * |
||
82 | * @return \Arcanedev\GeoIP\Contracts\GeoIPCache |
||
83 | */ |
||
84 | 18 | public function cache() |
|
88 | |||
89 | /** |
||
90 | * Get configuration value. |
||
91 | * |
||
92 | * @param string $key |
||
93 | * @param mixed $default |
||
94 | * |
||
95 | * @return mixed |
||
96 | */ |
||
97 | 36 | private function config($key, $default = null) |
|
101 | |||
102 | /** |
||
103 | * Set the default location. |
||
104 | * |
||
105 | * @param array $location |
||
106 | * |
||
107 | * @return self |
||
108 | */ |
||
109 | 36 | public function setDefaultLocation(array $location) |
|
115 | |||
116 | /** |
||
117 | * Get the currency code from ISO. |
||
118 | * |
||
119 | * @param string $iso |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | 12 | public function getCurrency($iso) |
|
131 | |||
132 | /* ------------------------------------------------------------------------------------------------ |
||
133 | | Main Functions |
||
134 | | ------------------------------------------------------------------------------------------------ |
||
135 | */ |
||
136 | /** |
||
137 | * Get the location from the provided IP. |
||
138 | * |
||
139 | * @param string $ipAddress |
||
140 | * |
||
141 | * @return \Arcanedev\GeoIP\Location |
||
142 | */ |
||
143 | 12 | public function location($ipAddress = null) |
|
153 | |||
154 | /** |
||
155 | * Find location from IP. |
||
156 | * |
||
157 | * @param string $ip |
||
158 | * |
||
159 | * @return \Arcanedev\GeoIP\Location |
||
160 | * |
||
161 | * @throws \Exception |
||
162 | */ |
||
163 | 12 | private function find($ip = null) |
|
192 | |||
193 | /** |
||
194 | * Determine if the location should be cached. |
||
195 | * |
||
196 | * @param string|null $ipAddress |
||
197 | * @param \Arcanedev\GeoIP\Location $location |
||
198 | * |
||
199 | * @return bool |
||
200 | */ |
||
201 | 12 | private function shouldCache($ipAddress = null, Location $location) |
|
217 | } |
||
218 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..