Completed
Push — master ( c2c0b4...47e138 )
by Kévin
10s
created

DunglasDoctrineJsonOdmExtension.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * (c) Kévin Dunglas <[email protected]>
5
 *
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
namespace Dunglas\DoctrineJsonOdm\Bundle\DependencyInjection;
11
12
use Symfony\Component\Config\FileLocator;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
15
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
16
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
17
18
/**
19
 * @author Kévin Dunglas <[email protected]>
20
 */
21
final class DunglasDoctrineJsonOdmExtension extends Extension implements PrependExtensionInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function prepend(ContainerBuilder $container)
27
    {
28
        if (empty($frameworkConfiguration = $container->getExtensionConfig('framework'))) {
29
            return;
30
        }
31
32 View Code Duplication
        if (!isset($frameworkConfiguration['serializer']) || !isset($frameworkConfiguration['serializer']['enabled'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
            $container->prependExtensionConfig('framework', ['serializer' => ['enabled' => true]]);
34
        }
35
36 View Code Duplication
        if (!isset($frameworkConfiguration['property_info']) || !isset($frameworkConfiguration['property_info']['enabled'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
            $container->prependExtensionConfig('framework', ['property_info' => ['enabled' => true]]);
38
        }
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function load(array $configs, ContainerBuilder $container)
45
    {
46
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
47
        $loader->load('services.xml');
48
    }
49
}
50