@@ -23,44 +23,7 @@ class DriverManager extends Manager implements DriverFactory
2323 */
2424 public function getDefaultDriver ()
2525 {
26- return $ this ->getConfig ('default ' );
27- }
28-
29- /**
30- * Get the driver class.
31- *
32- * @param string $key
33- *
34- * @return string
35- */
36- private function getDriverClass ($ key )
37- {
38- return $ this ->getConfig ("supported. $ key.driver " );
39- }
40-
41- /**
42- * Get the driver options.
43- *
44- * @param string $key
45- *
46- * @return array
47- */
48- private function getDriverOptions ($ key )
49- {
50- return $ this ->getConfig ("supported. $ key.options " , []);
51- }
52-
53- /**
54- * Get the config.
55- *
56- * @param string $key
57- * @param mixed|null $default
58- *
59- * @return mixed
60- */
61- public function getConfig ($ key , $ default = null )
62- {
63- return $ this ->config ()->get ("geoip. $ key " , $ default );
26+ return $ this ->config ()->get ("geoip.default " );
6427 }
6528
6629 /**
@@ -81,7 +44,7 @@ private function config()
8144 /**
8245 * Build the 'ip-api' driver.
8346 *
84- * @return Drivers\IpApiDriver
47+ * @return \Arcanedev\GeoIP\ Drivers\AbstractDriver
8548 */
8649 protected function createIpApiDriver ()
8750 {
@@ -91,7 +54,7 @@ protected function createIpApiDriver()
9154 /**
9255 * Build the 'freegeoip' driver.
9356 *
94- * @return Drivers\FreeGeoIpDriver
57+ * @return \Arcanedev\GeoIP\ Drivers\AbstractDriver
9558 */
9659 protected function createFreegeoipDriver ()
9760 {
@@ -101,7 +64,7 @@ protected function createFreegeoipDriver()
10164 /**
10265 * Get the 'maxmind-database' driver.
10366 *
104- * @return mixed
67+ * @return \Arcanedev\GeoIP\Drivers\AbstractDriver
10568 */
10669 protected function createMaxmindDatabaseDriver ()
10770 {
@@ -111,7 +74,7 @@ protected function createMaxmindDatabaseDriver()
11174 /**
11275 * Get the 'maxmind-api' driver.
11376 *
114- * @return Drivers\MaxmindApiDriver
77+ * @return \Arcanedev\GeoIP\ Drivers\AbstractDriver
11578 */
11679 protected function createMaxmindApiDriver ()
11780 {
@@ -126,14 +89,16 @@ protected function createMaxmindApiDriver()
12689 /**
12790 * Build the driver.
12891 *
129- * @param string $key
92+ * @param string $name
13093 *
131- * @return mixed
94+ * @return \Arcanedev\GeoIP\Drivers\AbstractDriver
13295 */
133- private function buildDriver ($ key )
96+ private function buildDriver ($ name )
13497 {
135- $ class = $ this ->getDriverClass ( $ key );
98+ $ class = $ this ->config ()-> get ( " geoip.drivers. $ name .driver " );
13699
137- return new $ class ($ this ->getDriverOptions ($ key ));
100+ return new $ class (
101+ $ this ->config ()->get ("geoip.drivers. $ name.options " , [])
102+ );
138103 }
139104}
0 commit comments