Skip to content

Commit 88c9c61

Browse files
authored
Merge pull request #29 from mortola/feature/update-swap
Upgrade to Swap 4.0
2 parents 23316f1 + 287bd89 commit 88c9c61

File tree

7 files changed

+12
-16
lines changed

7 files changed

+12
-16
lines changed

DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public function getConfigTreeBuilder()
7070
->end()
7171
->end()
7272
->end()
73-
->append($this->createSimpleProviderNode('google'))
7473
->append($this->createSimpleProviderNode('cryptonator'))
7574
->append($this->createSimpleProviderNode('webservicex'))
7675
->append($this->createSimpleProviderNode('central_bank_of_czech_republic'))

DependencyInjection/FlorianvSwapExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Florianv\SwapBundle\DependencyInjection;
1313

14-
use Psr\Cache\CacheItemPoolInterface;
14+
use Psr\SimpleCache\CacheInterface;
1515
use Swap;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Definition;
@@ -107,8 +107,8 @@ public function configureCacheService(ContainerBuilder $container, array $config
107107
$container->setDefinition($id, $definition);
108108
} elseif ($container->hasDefinition($type)) {
109109
$definition = $container->getDefinition($type);
110-
if (!is_subclass_of($definition->getClass(), CacheItemPoolInterface::class)) {
111-
throw new InvalidArgumentException("Service '$type' does not implements " . CacheItemPoolInterface::class);
110+
if (!is_subclass_of($definition->getClass(), CacheInterface::class)) {
111+
throw new InvalidArgumentException("Service '$type' does not implements " . CacheInterface::class);
112112
}
113113

114114
$id = $type;
@@ -119,7 +119,7 @@ public function configureCacheService(ContainerBuilder $container, array $config
119119
$definition = $container->getDefinition('florianv_swap.builder');
120120
$definition
121121
->replaceArgument(0, ['cache_ttl' => $ttl])
122-
->addMethodCall('useCacheItemPool', [new Reference($id)]);
122+
->addMethodCall('useSimpleCache', [new Reference($id)]);
123123
}
124124

125125
/**

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ Here is the list of the currently implemented services:
4545
| [Central Bank of Russia](https://cbr.ru) | * | RUB | Yes |
4646
| [WebserviceX](http://www.webservicex.net) | * | * | No |
4747
| [1Forge](https://1forge.com) | * (free but limited or paid) | * (free but limited or paid) | No |
48-
| [Google](https://www.google.com/finance) | * | * | No |
4948
| [Cryptonator](https://www.cryptonator.com) | * Crypto (Limited standard currencies) | * Crypto (Limited standard currencies) | No |
5049
| [CurrencyDataFeed](https://currencydatafeed.com) | * (free but limited or paid) | * (free but limited or paid) | No |
5150
| [Open Exchange Rates](https://openexchangerates.org) | USD (free), * (paid) | * | Yes |

Resources/doc/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ florianv_swap:
4949
currency_layer: # currencylayer
5050
access_key: secret
5151
enterprise: true
52-
google: ~ # Google Finance
5352
webservicex: ~ # WebserviceX
5453
cryptonator: ~ # Cryptonator
5554
forge: # Forge

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public function provideValidProvidersConfigs()
113113
[['central_bank_of_republic_turkey' => []]],
114114
[['european_central_bank' => null]],
115115
[['fixer' => ['access_key' => 'YOUR_KEY']]],
116-
[['google' => null]],
117116
[['national_bank_of_romania' => null]],
118117
[['webservicex' => null]],
119118
[['russian_central_bank' => null]],
@@ -161,7 +160,6 @@ public function provideInvalidProvidersConfigs()
161160
[['central_bank_of_republic_turkey' => ['any' => 'any']]],
162161
[['european_central_bank' => ['any' => 'any']]],
163162
[['fixer' => ['any' => 'any']]],
164-
[['google' => ['any']]],
165163
[['national_bank_of_romania' => ['any' => 'any']]],
166164
[['webservicex' => ['any' => 'any']]],
167165
[['russian_central_bank' => ['any' => 'any']]],

Tests/DependencyInjection/FlorianvSwapExtensionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testProviderPriorities()
7979
{
8080
$this->buildContainer([
8181
'fixer' => ['access_key' => 'YOUR_KEY'],
82-
'google' => [
82+
'european_central_bank' => [
8383
'priority' => 3,
8484
],
8585
'forge' => [
@@ -91,9 +91,9 @@ public function testProviderPriorities()
9191
$swap = $this->container->getDefinition('florianv_swap.builder');
9292
$calls = $swap->getMethodCalls();
9393

94-
// Google first
94+
// European Central Bank first
9595
$this->assertEquals($calls[0][0], 'add');
96-
$this->assertEquals($calls[0][1][0], 'google');
96+
$this->assertEquals($calls[0][1][0], 'european_central_bank');
9797
$this->assertEquals($calls[0][1][1], []);
9898

9999
// Forge second
@@ -165,7 +165,7 @@ private function assertCache($class, $config)
165165
{
166166
$swap = $this->container->getDefinition('florianv_swap.builder');
167167
$calls = $swap->getMethodCalls();
168-
$this->assertEquals($calls[0][0], 'useCacheItemPool');
168+
$this->assertEquals($calls[0][0], 'useSimpleCache');
169169
/** @var Reference $cacheReference */
170170
$cacheReference = $calls[0][1][0];
171171
$this->assertEquals('florianv_swap.cache', (string)$cacheReference);

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
"require": {
1919
"php": "^5.6|^7.0",
2020
"symfony/framework-bundle": "~3.0 || ~4.0",
21-
"florianv/swap": "^3.4"
21+
"florianv/swap": "^4.0"
2222
},
2323
"require-dev": {
2424
"php-http/guzzle6-adapter": "^1.0",
25-
"php-http/message": "^1.0",
25+
"php-http/message": "^1.7",
2626
"symfony/cache": "~3.0|~4.0",
27-
"phpunit/phpunit": "~5.0"
27+
"phpunit/phpunit": "~5.0",
28+
"nyholm/psr7": "^1.1"
2829
},
2930
"suggest": {
3031
"symfony/cache": "For caching"

0 commit comments

Comments
 (0)