File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ class GeoIP
7575 /**
7676 * Create a new GeoIP instance.
7777 *
78- * @param array $config
78+ * @param array $config
7979 */
8080 public function __construct (array $ config )
8181 {
@@ -87,11 +87,6 @@ public function __construct(array $config)
8787 $ this ->config ('default_location ' , [])
8888 );
8989
90- // Include currencies
91- if ($ this ->config ('include_currency ' , false )) {
92- $ this ->currencies = include (__DIR__ . '/Support/Currencies.php ' );
93- }
94-
9590 // Set IP
9691 $ this ->remote_ip = $ this ->default_location ['ip ' ] = $ this ->getClientIP ();
9792 }
@@ -101,7 +96,7 @@ public function __construct(array $config)
10196 *
10297 * @param string $ip
10398 *
104- * @return array
99+ * @return \Torann\GeoIP\Location
105100 */
106101 public function getLocation ($ ip = null )
107102 {
@@ -121,7 +116,7 @@ public function getLocation($ip = null)
121116 *
122117 * @param string $ip
123118 *
124- * @return array
119+ * @return \Torann\GeoIP\Location
125120 * @throws \Exception
126121 */
127122 private function find ($ ip = null )
@@ -173,6 +168,10 @@ private function find($ip = null)
173168 */
174169 public function getCurrency ($ iso )
175170 {
171+ if ($ this ->currencies === null && $ this ->config ('include_currency ' , false )) {
172+ $ this ->currencies = include (__DIR__ . '/Support/Currencies.php ' );
173+ }
174+
176175 return Arr::get ($ this ->currencies , $ iso );
177176 }
178177
You can’t perform that action at this time.
0 commit comments