Skip to content

Commit

Permalink
Merge pull request #50 from florianv/codes
Browse files Browse the repository at this point in the history
Removed currency codes enumeration
  • Loading branch information
florianv committed Aug 22, 2016
2 parents 144a663 + 9e648f6 commit e4451f4
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 396 deletions.
14 changes: 0 additions & 14 deletions doc/doc.md
Expand Up @@ -89,17 +89,3 @@ $swap = new \Swap\Swap($yahooProvider, $cachePool, 3600);
```

All rates will now be cached in Apcu during 3600 seconds.

### Currency Codes

Swap provides an enumeration of currency codes so you can use autocompletion to avoid typos.

```php
use \Swap\Util\CurrencyCodes;

// Retrieving the EUR/USD rate
$rate = $swap->quote(new \Swap\Model\CurrencyPair(
CurrencyCodes::ISO_EUR,
CurrencyCodes::ISO_USD
));
```
3 changes: 1 addition & 2 deletions src/Provider/CentralBankOfCzechRepublicProvider.php
Expand Up @@ -14,7 +14,6 @@
use Swap\Exception\UnsupportedCurrencyPairException;
use Swap\Model\CurrencyPair;
use Swap\Model\Rate;
use Swap\Util\CurrencyCodes;

/**
* Central Bank of Czech Republic (CNB) provider.
Expand All @@ -33,7 +32,7 @@ public function fetchRate(CurrencyPair $currencyPair)
{
$content = $this->fetchContent(self::URL);

if (CurrencyCodes::ISO_CZK !== $currencyPair->getQuoteCurrency()) {
if ('CZK' !== $currencyPair->getQuoteCurrency()) {
throw new UnsupportedCurrencyPairException($currencyPair);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Provider/CentralBankOfRepublicTurkeyProvider.php
Expand Up @@ -14,7 +14,6 @@
use Swap\Exception\UnsupportedCurrencyPairException;
use Swap\Model\CurrencyPair;
use Swap\Model\Rate;
use Swap\Util\CurrencyCodes;
use Swap\Util\StringUtil;

/**
Expand All @@ -37,7 +36,7 @@ public function fetchRate(CurrencyPair $currencyPair)

$xmlElement = StringUtil::xmlToElement($content);

if (CurrencyCodes::ISO_TRY !== $currencyPair->getQuoteCurrency()) {
if ('TRY' !== $currencyPair->getQuoteCurrency()) {
throw new UnsupportedCurrencyPairException($currencyPair);
}

Expand Down
53 changes: 0 additions & 53 deletions src/Resources/bin/dump-codes.php

This file was deleted.

0 comments on commit e4451f4

Please sign in to comment.