IndigoCookieConsentExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 10
cts 10
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Indigo\Bundle\CookieConsentBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\Extension\Extension;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
9
10
/**
11
 * @author Márk Sági-Kazár <[email protected]>
12
 */
13
class IndigoCookieConsentExtension extends Extension
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 2
    public function load(array $configs, ContainerBuilder $container)
19
    {
20 2
        $configuration = $this->getConfiguration($configs, $container);
21 2
        $config = $this->processConfiguration($configuration, $configs);
0 ignored issues
show
Documentation introduced by
$configuration is of type object|null, but the function expects a object<Symfony\Component...ConfigurationInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
22
23 2
        $container->setParameter('indigo_cookie_consent', $config);
24
25 2
        $loader = new XmlFileLoader(
26 2
            $container,
27 2
            new FileLocator(__DIR__.'/../Resources/config')
28 2
        );
29 2
        $loader->load('services.xml');
30 2
    }
31
}
32