Passed
Push — master ( 43a943...86b561 )
by Daniel
12:01
created

SerializerCompilerPass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 14
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 1
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 1
            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