Passed
Pull Request — master (#2)
by Romain
03:51
created

SymfonyCompilerPass::process()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 3
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Guzzle\ConfigOperationsBundle\DependencyInjection\CompilerPass;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Loader;
9
use Symfony\Component\Serializer\Serializer;
10
11
class SymfonyCompilerPass implements CompilerPassInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function process(ContainerBuilder $container)
17
    {
18
        if ($container->hasDefinition('serializer')
19
            && $container->getDefinition('serializer')->getClass() === Serializer::class) {
20
            $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../../Resources/config'));
21
            $loader->load('symfony_normalizer.yml');
22
        }
23
    }
24
}
25