1 | <?php |
||
11 | class Repository |
||
12 | { |
||
13 | /** |
||
14 | * Timezones. |
||
15 | * |
||
16 | * @var |
||
17 | */ |
||
18 | public $timezones; |
||
19 | |||
20 | /** |
||
21 | * Countries json. |
||
22 | * |
||
23 | * @var |
||
24 | */ |
||
25 | public $countriesJson; |
||
26 | |||
27 | /** |
||
28 | * Countries. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | public $countries = []; |
||
33 | |||
34 | /** |
||
35 | * Hydrator. |
||
36 | * |
||
37 | * @var Hydrator |
||
38 | */ |
||
39 | public $hydrator; |
||
40 | |||
41 | /** |
||
42 | * Helper. |
||
43 | * |
||
44 | * @var Helper |
||
45 | */ |
||
46 | private $helper; |
||
47 | |||
48 | /** |
||
49 | * Cache. |
||
50 | * |
||
51 | * @var Cache |
||
52 | */ |
||
53 | private $cache; |
||
54 | |||
55 | /** |
||
56 | * @var object |
||
57 | */ |
||
58 | private $config; |
||
59 | |||
60 | /** |
||
61 | * Repository constructor. |
||
62 | * |
||
63 | * @param CacheContract $cache |
||
64 | * @param Hydrator $hydrator |
||
65 | * @param Helper $helper |
||
66 | * @param object $config |
||
67 | */ |
||
68 | 34 | public function __construct(CacheContract $cache, Hydrator $hydrator, Helper $helper, $config) |
|
78 | |||
79 | /** |
||
80 | * Call magic method. |
||
81 | * |
||
82 | * @param $name |
||
83 | * @param array $arguments |
||
84 | * @return mixed |
||
85 | */ |
||
86 | 27 | public function __call($name, array $arguments = []) |
|
90 | |||
91 | /** |
||
92 | * Call a method currencies collection. |
||
93 | * |
||
94 | * @param $name |
||
95 | * @param $arguments |
||
96 | * @return bool|mixed |
||
97 | */ |
||
98 | 32 | public function call($name, $arguments) |
|
112 | |||
113 | /** |
||
114 | * @return Helper |
||
115 | */ |
||
116 | 9 | public function getHelper() |
|
120 | |||
121 | /** |
||
122 | * Hydrator getter. |
||
123 | * |
||
124 | * @return Hydrator |
||
125 | */ |
||
126 | 3 | public function getHydrator() |
|
130 | |||
131 | /** |
||
132 | * Boot the repository. |
||
133 | * @return static |
||
134 | */ |
||
135 | 34 | public function boot() |
|
141 | |||
142 | /** |
||
143 | * Load countries. |
||
144 | * |
||
145 | * @return \PragmaRX\Coollection\Package\Coollection |
||
146 | */ |
||
147 | 34 | public function loadCountries() |
|
159 | |||
160 | /** |
||
161 | * Load countries json file. |
||
162 | * @return \PragmaRX\Coollection\Package\Coollection |
||
163 | * @throws \Exception |
||
164 | */ |
||
165 | 34 | public function loadCountriesJson() |
|
177 | |||
178 | /** |
||
179 | * Load currency json file. |
||
180 | * |
||
181 | * @param $code |
||
182 | * @return string |
||
183 | */ |
||
184 | 6 | public function loadCurrenciesForCountry($code) |
|
192 | |||
193 | /** |
||
194 | * Get all countries. |
||
195 | * |
||
196 | * @return \PragmaRX\Coollection\Package\Coollection |
||
197 | */ |
||
198 | 32 | public function all() |
|
202 | |||
203 | /** |
||
204 | * Get all currencies. |
||
205 | * |
||
206 | * @return \PragmaRX\Coollection\Package\Coollection |
||
207 | */ |
||
208 | 1 | public function currencies() |
|
220 | |||
221 | /** |
||
222 | * Make flags array for a coutry. |
||
223 | * |
||
224 | * @param $country |
||
225 | * @return array |
||
226 | */ |
||
227 | 31 | public function makeAllFlags($country) |
|
247 | |||
248 | /** |
||
249 | * Read the flag SVG file. |
||
250 | * |
||
251 | * @param $country |
||
252 | * @return string |
||
253 | */ |
||
254 | 31 | public function getFlagSvg($country) |
|
260 | |||
261 | /** |
||
262 | * Get the SVG file path. |
||
263 | * |
||
264 | * @param $country |
||
265 | * @return string |
||
266 | */ |
||
267 | 31 | public function getFlagSvgPath($country) |
|
271 | |||
272 | /** |
||
273 | * Get country geometry. |
||
274 | * |
||
275 | * @param $country |
||
276 | * @return string |
||
277 | */ |
||
278 | 1 | public function getGeometry($country) |
|
284 | |||
285 | /** |
||
286 | * Get country topology. |
||
287 | * |
||
288 | * @param $country |
||
289 | * @return string |
||
290 | */ |
||
291 | 1 | public function getTopology($country) |
|
297 | |||
298 | /** |
||
299 | * Hydrate a country element. |
||
300 | * |
||
301 | * @param $collection |
||
302 | * @param null $elements |
||
303 | * @return \PragmaRX\Coollection\Package\Coollection |
||
304 | */ |
||
305 | 29 | public function hydrate($collection, $elements = null) |
|
309 | |||
310 | /** |
||
311 | * Find a country timezone. |
||
312 | * |
||
313 | * @param $countryCode |
||
314 | * @return null |
||
315 | */ |
||
316 | 5 | public function findTimezones($countryCode) |
|
322 | |||
323 | /** |
||
324 | * Find a country timezone. |
||
325 | * |
||
326 | * @param $zoneId |
||
327 | * @return \PragmaRX\Coollection\Package\Coollection |
||
328 | */ |
||
329 | 2 | public function findTimezoneTime($zoneId) |
|
335 | } |
||
336 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.