diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index b442d97..e39b20f 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -70,7 +70,6 @@ public function getConfigTreeBuilder() ->end() ->end() ->end() - ->append($this->createSimpleProviderNode('google')) ->append($this->createSimpleProviderNode('cryptonator')) ->append($this->createSimpleProviderNode('webservicex')) ->append($this->createSimpleProviderNode('central_bank_of_czech_republic')) diff --git a/DependencyInjection/FlorianvSwapExtension.php b/DependencyInjection/FlorianvSwapExtension.php index c48546e..348d9ef 100644 --- a/DependencyInjection/FlorianvSwapExtension.php +++ b/DependencyInjection/FlorianvSwapExtension.php @@ -11,7 +11,7 @@ namespace Florianv\SwapBundle\DependencyInjection; -use Psr\Cache\CacheItemPoolInterface; +use Psr\SimpleCache\CacheInterface; use Swap; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -107,8 +107,8 @@ public function configureCacheService(ContainerBuilder $container, array $config $container->setDefinition($id, $definition); } elseif ($container->hasDefinition($type)) { $definition = $container->getDefinition($type); - if (!is_subclass_of($definition->getClass(), CacheItemPoolInterface::class)) { - throw new InvalidArgumentException("Service '$type' does not implements " . CacheItemPoolInterface::class); + if (!is_subclass_of($definition->getClass(), CacheInterface::class)) { + throw new InvalidArgumentException("Service '$type' does not implements " . CacheInterface::class); } $id = $type; @@ -119,7 +119,7 @@ public function configureCacheService(ContainerBuilder $container, array $config $definition = $container->getDefinition('florianv_swap.builder'); $definition ->replaceArgument(0, ['cache_ttl' => $ttl]) - ->addMethodCall('useCacheItemPool', [new Reference($id)]); + ->addMethodCall('useSimpleCache', [new Reference($id)]); } /** diff --git a/README.md b/README.md index d475b06..334c5e7 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,6 @@ Here is the list of the currently implemented services: | [Central Bank of Russia](https://cbr.ru) | * | RUB | Yes | | [WebserviceX](http://www.webservicex.net) | * | * | No | | [1Forge](https://1forge.com) | * (free but limited or paid) | * (free but limited or paid) | No | -| [Google](https://www.google.com/finance) | * | * | No | | [Cryptonator](https://www.cryptonator.com) | * Crypto (Limited standard currencies) | * Crypto (Limited standard currencies) | No | | [CurrencyDataFeed](https://currencydatafeed.com) | * (free but limited or paid) | * (free but limited or paid) | No | | [Open Exchange Rates](https://openexchangerates.org) | USD (free), * (paid) | * | Yes | diff --git a/Resources/doc/index.md b/Resources/doc/index.md index 0adc0ed..b4c301a 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -49,7 +49,6 @@ florianv_swap: currency_layer: # currencylayer access_key: secret enterprise: true - google: ~ # Google Finance webservicex: ~ # WebserviceX cryptonator: ~ # Cryptonator forge: # Forge diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index 26eab53..9490428 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -113,7 +113,6 @@ public function provideValidProvidersConfigs() [['central_bank_of_republic_turkey' => []]], [['european_central_bank' => null]], [['fixer' => ['access_key' => 'YOUR_KEY']]], - [['google' => null]], [['national_bank_of_romania' => null]], [['webservicex' => null]], [['russian_central_bank' => null]], @@ -161,7 +160,6 @@ public function provideInvalidProvidersConfigs() [['central_bank_of_republic_turkey' => ['any' => 'any']]], [['european_central_bank' => ['any' => 'any']]], [['fixer' => ['any' => 'any']]], - [['google' => ['any']]], [['national_bank_of_romania' => ['any' => 'any']]], [['webservicex' => ['any' => 'any']]], [['russian_central_bank' => ['any' => 'any']]], diff --git a/Tests/DependencyInjection/FlorianvSwapExtensionTest.php b/Tests/DependencyInjection/FlorianvSwapExtensionTest.php index e1ad8b7..9ddbfcb 100644 --- a/Tests/DependencyInjection/FlorianvSwapExtensionTest.php +++ b/Tests/DependencyInjection/FlorianvSwapExtensionTest.php @@ -79,7 +79,7 @@ public function testProviderPriorities() { $this->buildContainer([ 'fixer' => ['access_key' => 'YOUR_KEY'], - 'google' => [ + 'european_central_bank' => [ 'priority' => 3, ], 'forge' => [ @@ -91,9 +91,9 @@ public function testProviderPriorities() $swap = $this->container->getDefinition('florianv_swap.builder'); $calls = $swap->getMethodCalls(); - // Google first + // European Central Bank first $this->assertEquals($calls[0][0], 'add'); - $this->assertEquals($calls[0][1][0], 'google'); + $this->assertEquals($calls[0][1][0], 'european_central_bank'); $this->assertEquals($calls[0][1][1], []); // Forge second @@ -165,7 +165,7 @@ private function assertCache($class, $config) { $swap = $this->container->getDefinition('florianv_swap.builder'); $calls = $swap->getMethodCalls(); - $this->assertEquals($calls[0][0], 'useCacheItemPool'); + $this->assertEquals($calls[0][0], 'useSimpleCache'); /** @var Reference $cacheReference */ $cacheReference = $calls[0][1][0]; $this->assertEquals('florianv_swap.cache', (string)$cacheReference); diff --git a/composer.json b/composer.json index d1807f6..f145515 100644 --- a/composer.json +++ b/composer.json @@ -18,13 +18,14 @@ "require": { "php": "^5.6|^7.0", "symfony/framework-bundle": "~3.0 || ~4.0", - "florianv/swap": "^3.4" + "florianv/swap": "^4.0" }, "require-dev": { "php-http/guzzle6-adapter": "^1.0", - "php-http/message": "^1.0", + "php-http/message": "^1.7", "symfony/cache": "~3.0|~4.0", - "phpunit/phpunit": "~5.0" + "phpunit/phpunit": "~5.0", + "nyholm/psr7": "^1.1" }, "suggest": { "symfony/cache": "For caching"