CurrencyDataProvider.php
2 years ago
DateTimeFormatProvider.php
1 year ago
LanguageDataProvider.php
2 years ago
RegionDataProvider.php
1 year ago
CurrencyDataProvider.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Matomo - free/libre analytics platform |
| 5 | * |
| 6 | * @link https://matomo.org |
| 7 | * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 8 | */ |
| 9 | namespace Piwik\Intl\Data\Provider; |
| 10 | |
| 11 | use Piwik\Config; |
| 12 | /** |
| 13 | * Provides currency data. |
| 14 | */ |
| 15 | class CurrencyDataProvider |
| 16 | { |
| 17 | private $currencyList; |
| 18 | /** |
| 19 | * Returns the list of all known currency symbols. |
| 20 | * |
| 21 | * @return array An array mapping currency codes to their respective currency symbols |
| 22 | * and a description, eg, `array('USD' => array('$', 'US dollar'))`. |
| 23 | * @api |
| 24 | */ |
| 25 | public function getCurrencyList() |
| 26 | { |
| 27 | if ($this->currencyList === null) { |
| 28 | $this->currencyList = (require __DIR__ . '/../Resources/currencies.php'); |
| 29 | $custom = Config::getInstance()->General['currencies']; |
| 30 | foreach ($custom as $code => $name) { |
| 31 | $this->currencyList[$code] = array($code, $name); |
| 32 | } |
| 33 | } |
| 34 | return $this->currencyList; |
| 35 | } |
| 36 | } |
| 37 |