SetonoSyliusLagersystemExtension::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 10
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusLagersystemPlugin\DependencyInjection;
6
7
use function Safe\sprintf;
8
use Symfony\Component\Config\FileLocator;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
10
use Symfony\Component\DependencyInjection\Extension\Extension;
11
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
12
13
final class SetonoSyliusLagersystemExtension extends Extension
14
{
15
    public function load(array $config, ContainerBuilder $container): void
16
    {
17
        $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

17
        $config = $this->processConfiguration(/** @scrutinizer ignore-type */ $this->getConfiguration([], $container), $config);
Loading history...
18
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
19
20
        foreach ($config['view_classes'] as $view => $class) {
21
            $container->setParameter(sprintf('setono_sylius_lagersystem.view.%s.class', $view), $class);
22
        }
23
24
        $loader->load('services.xml');
25
    }
26
}
27