1 | <?php namespace Arcanedev\GeoIP; |
||
12 | class DriverManager extends Manager implements DriverFactory |
||
13 | { |
||
14 | /* ------------------------------------------------------------------------------------------------ |
||
15 | | Getters & Setters |
||
16 | | ------------------------------------------------------------------------------------------------ |
||
17 | */ |
||
18 | /** |
||
19 | * Get the default driver name. |
||
20 | * |
||
21 | * @return string |
||
22 | */ |
||
23 | 21 | public function getDefaultDriver() |
|
27 | |||
28 | /** |
||
29 | * Get the driver class. |
||
30 | * |
||
31 | * @param string $key |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | 45 | private function getDriverClass($key) |
|
39 | |||
40 | /** |
||
41 | * Get the driver options. |
||
42 | * |
||
43 | * @param string $key |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | 45 | private function getDriverOptions($key) |
|
51 | |||
52 | /** |
||
53 | * Get the config. |
||
54 | * |
||
55 | * @param string $key |
||
56 | * @param mixed|null $default |
||
57 | * |
||
58 | * @return mixed |
||
59 | */ |
||
60 | 45 | public function getConfig($key, $default = null) |
|
64 | |||
65 | /** |
||
66 | * Get the config instance. |
||
67 | * |
||
68 | * @return \Illuminate\Contracts\Config\Repository |
||
69 | */ |
||
70 | 45 | private function config() |
|
74 | |||
75 | /* ------------------------------------------------------------------------------------------------ |
||
76 | | Main Functions |
||
77 | | ------------------------------------------------------------------------------------------------ |
||
78 | */ |
||
79 | /** |
||
80 | * Build the 'ip-api' driver. |
||
81 | * |
||
82 | * @return Drivers\IpApiDriver |
||
83 | */ |
||
84 | 9 | protected function createIpApiDriver() |
|
88 | |||
89 | /** |
||
90 | * Build the 'freegeoip' driver. |
||
91 | * |
||
92 | * @return Drivers\FreeGeoIpDriver |
||
93 | */ |
||
94 | 30 | protected function createFreegeoipDriver() |
|
98 | |||
99 | /** |
||
100 | * Get the 'maxmind-database' driver. |
||
101 | * |
||
102 | * @return mixed |
||
103 | */ |
||
104 | 12 | protected function createMaxmindDatabaseDriver() |
|
108 | |||
109 | /** |
||
110 | * Get the 'maxmind-api' driver. |
||
111 | * |
||
112 | * @return Drivers\MaxmindApiDriver |
||
113 | */ |
||
114 | 3 | protected function createMaxmindApiDriver() |
|
118 | |||
119 | /* ------------------------------------------------------------------------------------------------ |
||
120 | | Other Functions |
||
121 | | ------------------------------------------------------------------------------------------------ |
||
122 | */ |
||
123 | /** |
||
124 | * Build the driver. |
||
125 | * |
||
126 | * @param string $key |
||
127 | * |
||
128 | * @return mixed |
||
129 | */ |
||
130 | 45 | private function buildDriver($key) |
|
136 | } |
||
137 |