Passed
Push — master ( 3ec415...9f2f47 )
by Daniel
16:25
created

SerializerCompilerPass::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1.0008

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 12
ccs 9
cts 10
cp 0.9
crap 1.0008
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentsBundle\DependencyInjection\CompilerPass;
15
16
use Silverback\ApiComponentsBundle\Serializer\MappingLoader\ComponentLoader;
17
use Silverback\ApiComponentsBundle\Serializer\MappingLoader\PublishableLoader;
18
use Silverback\ApiComponentsBundle\Serializer\MappingLoader\TimestampedLoader;
19
use Silverback\ApiComponentsBundle\Serializer\MappingLoader\UploadableLoader;
20
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
21
use Symfony\Component\DependencyInjection\ContainerBuilder;
22
use Symfony\Component\DependencyInjection\Reference;
23
24
/**
25
 * @author Vincent Chalamon <[email protected]>
26
 */
27
class SerializerCompilerPass implements CompilerPassInterface
28
{
29 1
    public function process(ContainerBuilder $container)
30
    {
31 1
        $definition = $container->getDefinition('serializer.mapping.chain_loader');
32 1
        $definition->replaceArgument(
33 1
            0,
34
            array_merge(
35 1
                $definition->getArgument(0),
36
                [
37 1
                    new Reference(PublishableLoader::class),
38 1
                    new Reference(TimestampedLoader::class),
39 1
                    new Reference(ComponentLoader::class),
40 1
                    new Reference(UploadableLoader::class),
41
                ]
42
            )
43
        );
44 1
    }
45
}
46