diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 93b93ad..7fe7ff7 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -35,10 +35,6 @@ public function getConfigTreeBuilder() ->end() ->scalarNode('buzz_client') ->defaultValue('file_get_contents') - ->validate() - ->ifNotInArray(array('file_get_contents', 'curl')) - ->thenInvalid('Buzz client %s is not supported') - ->end() ->end() ->end() ; diff --git a/DependencyInjection/RuudkMollieExtension.php b/DependencyInjection/RuudkMollieExtension.php index 2ff3283..93321bf 100644 --- a/DependencyInjection/RuudkMollieExtension.php +++ b/DependencyInjection/RuudkMollieExtension.php @@ -15,6 +15,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader; +use Symfony\Component\DependencyInjection\Definition; class RuudkMollieExtension extends Extension { @@ -39,7 +40,11 @@ public function load(array $configs, ContainerBuilder $container) } if (isset($config['buzz_client'])) { - $container->setParameter('ruudk_mollie.buzz_client.class', $config['buzz_client'] == 'curl' ? 'Buzz\Client\Curl' : 'Buzz\Client\FileGetContents'); + if (in_array($config['buzz_client'], array('curl', 'file_get_contents'))) { + $container->setDefinition('ruudk_mollie.buzz_client', new Definition($config['buzz_client'] == 'curl' ? 'Buzz\Client\Curl' : 'Buzz\Client\FileGetContents')); + } else { + $container->setAlias('ruudk_mollie.buzz_client', $config['buzz_client']); + } } } } diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 3c12dbd..b10a3a7 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -8,7 +8,6 @@ - Buzz\Client\FileGetContents AMNL\Mollie\IDeal\IDealGateway AMNL\Mollie\IVR\MicropaymentGateway AMNL\Mollie\MiniTix\MiniTixGateway @@ -36,8 +35,6 @@ - -