Completed
Push — master ( c0745e...c38a0f )
by Joel
04:07
created

RedirectionIOExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 15 2
1
<?php
2
3
namespace RedirectionIO\Client\ProxySymfony\DependencyInjection;
4
5
use RedirectionIO\Client\Sdk\Client;
6
use Symfony\Component\Config\FileLocator;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Config\FileLocator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...on\Loader\XmlFileLoader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
10
11
class RedirectionIOExtension extends Extension
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function load(array $configs, ContainerBuilder $container)
17
    {
18
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
19
        $loader->load('services.xml');
20
21
        $configuration = new Configuration();
22
        $config = $this->processConfiguration($configuration, $configs);
23
24
        foreach ($config['connections'] as $name => $connection) {
25
            $connections[$name] = $container->resolveEnvPlaceholders($connection);
26
        }
27
28
        $container
29
            ->getDefinition(Client::class)
30
            ->replaceArgument(0, $connections)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $connections seems to be defined by a foreach iteration on line 24. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
31
        ;
32
    }
33
}
34