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