Completed
Pull Request — master (#1)
by Kamil
07:23
created

LakionSyliusCmsExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
3
namespace Lakion\SyliusCmsBundle\DependencyInjection;
4
5
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
6
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
10
use Symfony\Component\DependencyInjection\Parameter;
11
12
final class LakionSyliusCmsExtension extends AbstractResourceExtension
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function load(array $config, ContainerBuilder $container)
18
    {
19
        $config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
0 ignored issues
show
Documentation introduced by
$this->getConfiguration($config, $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...
20
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
21
22
        $this->registerResources('lakion_sylius_cms', SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM, $config['resources'], $container);
23
24
        $loader->load('services.xml');
25
26
        $staticContentRepository = $container->getDefinition('lakion_sylius_cms.repository.static_content');
27
        $staticContentRepository->addArgument(new Parameter('cmf_content.persistence.phpcr.content_basepath'));
28
    }
29
}
30