Completed
Push — master ( ff4180...f6540e )
by Yohan
07:27
created

CalendRExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
cbo 5
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 12 1
1
<?php
2
3
namespace CalendR\Bridge\Symfony\Bundle\DependencyInjection;
4
5
use CalendR\Calendar;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
9
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
10
11
class CalendRExtension extends Extension
12
{
13
    public function load(array $configs, ContainerBuilder $container)
14
    {
15
        $configuration = $this->getConfiguration($configs, $container);
16
        $config        = $this->processConfiguration($configuration, $configs);
0 ignored issues
show
Documentation introduced by
$configuration is of type null|object, 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...
17
18
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
19
        $loader->load('services.yaml');
20
21
        $container
22
            ->getDefinition(Calendar::class)
23
            ->addMethodCall('setFirstWeekday', [$config['periods']['default_first_weekday']]);
24
    }
25
}
26