SetonoSyliusLogEntryExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusLogEntryPlugin\DependencyInjection;
6
7
use Exception;
8
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
9
use Symfony\Component\Config\FileLocator;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
12
13
final class SetonoSyliusLogEntryExtension extends AbstractResourceExtension
14
{
15
    /**
16
     * @throws Exception
17
     */
18
    public function load(array $config, ContainerBuilder $container): void
19
    {
20
        $config = $this->processConfiguration($this->getConfiguration([], $container), $config);
0 ignored issues
show
Bug introduced by
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

20
        $config = $this->processConfiguration(/** @scrutinizer ignore-type */ $this->getConfiguration([], $container), $config);
Loading history...
21
22
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
23
        $loader->load('services.xml');
24
25
        // Notice that we give an empty resources array here, but this ensures that the parameters are set in the AbstractResourceExtension
26
        // which in turn will run the compiler pass Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterMappingsPass
27
        $this->registerResources('setono_sylius_returns', $config['driver'], [], $container);
28
    }
29
}
30