PlumTreeSystems /
SyliusPayseraPlugin
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace PTS\SyliusPayseraPlugin\DependencyInjection; |
||
| 6 | |||
| 7 | use PTS\Paysera\Api; |
||
| 8 | use PTS\Paysera\MockedApi; |
||
| 9 | use PTS\Paysera\MockedPayseraGatewayFactory; |
||
| 10 | use PTS\Paysera\PayseraGatewayFactory; |
||
| 11 | use Symfony\Component\Config\FileLocator; |
||
| 12 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
| 13 | use Symfony\Component\DependencyInjection\Extension\Extension; |
||
| 14 | use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
||
| 15 | |||
| 16 | final class PTSSyliusPayseraExtension extends Extension |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * {@inheritdoc} |
||
| 20 | */ |
||
| 21 | public function load(array $config, ContainerBuilder $container): void |
||
| 22 | { |
||
| 23 | $this->processConfiguration($this->getConfiguration([], $container), $config); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 24 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
||
| 25 | |||
| 26 | $env = $container->getParameter("kernel.environment"); |
||
| 27 | |||
| 28 | $container->setParameter('gateway_factory_class', |
||
| 29 | $env === 'test' ? |
||
| 30 | MockedPayseraGatewayFactory::class : PayseraGatewayFactory::class |
||
| 31 | ); |
||
| 32 | $container->setParameter('gateway_api_class_mocked', |
||
| 33 | $env === 'test' ? |
||
| 34 | true : false |
||
| 35 | ); |
||
| 36 | |||
| 37 | $loader->load('services.xml'); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |