1 | <?php namespace Arcanedev\GeoIP\Drivers; |
||
13 | abstract class AbstractDriver implements GeoIPDriver |
||
14 | { |
||
15 | /* ------------------------------------------------------------------------------------------------ |
||
16 | | Properties |
||
17 | | ------------------------------------------------------------------------------------------------ |
||
18 | */ |
||
19 | /** |
||
20 | * Driver options. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $options = []; |
||
25 | |||
26 | /* ------------------------------------------------------------------------------------------------ |
||
27 | | Constructor |
||
28 | | ------------------------------------------------------------------------------------------------ |
||
29 | */ |
||
30 | /** |
||
31 | * AbstractDriver constructor. |
||
32 | * |
||
33 | * @param array $options |
||
34 | */ |
||
35 | 90 | public function __construct(array $options = []) |
|
40 | |||
41 | /* ------------------------------------------------------------------------------------------------ |
||
42 | | Main Functions |
||
43 | | ------------------------------------------------------------------------------------------------ |
||
44 | */ |
||
45 | /** |
||
46 | * Init the driver. |
||
47 | */ |
||
48 | abstract protected function init(); |
||
49 | |||
50 | /** |
||
51 | * Update the driver. |
||
52 | * |
||
53 | * @return bool |
||
54 | * |
||
55 | * @throws \Exception |
||
56 | */ |
||
57 | public function update() |
||
63 | |||
64 | /* ------------------------------------------------------------------------------------------------ |
||
65 | | Other Functions |
||
66 | | ------------------------------------------------------------------------------------------------ |
||
67 | */ |
||
68 | /** |
||
69 | * Get option value. |
||
70 | * |
||
71 | * @param string $key |
||
72 | * @param mixed $default |
||
73 | * |
||
74 | * @return mixed |
||
75 | */ |
||
76 | 36 | protected function getOption($key, $default = null) |
|
80 | |||
81 | /** |
||
82 | * Hydrate the location entity. |
||
83 | * |
||
84 | * @param array $attributes |
||
85 | * |
||
86 | * @return \Arcanedev\GeoIP\Location |
||
87 | */ |
||
88 | 24 | protected function hydrate(array $attributes = []) |
|
92 | } |
||
93 |