Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/GeoIP.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,30 @@ private function find($ip = null)

return $this->getService()->hydrate($this->default_location);
}

/**
* Load the currencies in the instance.
*
* @return void
*/
protected function loadCurrencies()
{
if ($this->currencies === null && $this->config('include_currency', false)) {
$this->currencies = include(__DIR__ . '/Support/Currencies.php');
}
}

/**
* Get all currencies.
*
* @return array
*/
public function getCurrencies()
{
$this->loadCurrencies();

return $this->currencies;
}

/**
* Get the currency code from ISO.
Expand All @@ -178,9 +202,7 @@ private function find($ip = null)
*/
public function getCurrency($iso)
{
if ($this->currencies === null && $this->config('include_currency', false)) {
$this->currencies = include(__DIR__ . '/Support/Currencies.php');
}
$this->loadCurrencies();

return Arr::get($this->currencies, $iso);
}
Expand Down