Issues (2)

DependencyInjection/PTSSyliusPayseraExtension.php (1 issue)

Labels
Severity
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
It seems like $this->getConfiguration(array(), $container) can also be of type null; however, parameter $configuration of Symfony\Component\Depend...:processConfiguration() does only seem to accept Symfony\Component\Config...\ConfigurationInterface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
        $this->processConfiguration(/** @scrutinizer ignore-type */ $this->getConfiguration([], $container), $config);
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