Completed
Push — master ( 1250b5...ac33b4 )
by Pavel
04:37
created

CrudsExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 3
c 3
b 1
f 0
lcom 0
cbo 5
dl 0
loc 20
ccs 13
cts 13
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 16 3
1
<?php
2
3
namespace ScayTrase\Api\Cruds\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Extension\Extension;
8
use Symfony\Component\DependencyInjection\Loader;
9
10
final class CrudsExtension extends Extension
11
{
12
    /** {@inheritdoc} */
13 2
    public function load(array $configs, ContainerBuilder $container)
14
    {
15 2
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
16 2
        $loader->load('cruds.yml');
17
18 2
        $config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
0 ignored issues
show
Documentation introduced by
$this->getConfiguration(array(), $container) 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...
19
20 2
        $configurator = new CrudsEntitiesConfigurator($container);
21 2
        $container->addObjectResource($configurator);
22 2
        $prefix = $config['prefix'];
23 2
        foreach ($config['entities'] as $name => $entityConfig) {
24 2
            $entityConfig['prefix'] = $entityConfig['prefix'] ?: '/'.$name;
25 2
            $entityConfig['prefix'] = $prefix.$entityConfig['prefix'];
26 2
            $configurator->processEntityConfiguration($name, $entityConfig);
27 2
        }
28 2
    }
29
}
30