RegisterSerializerMetadataPass::process()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1
Metric Value
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[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
namespace Xabbuh\XApi\Bundle\ClientBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Xabbuh\XApi\Serializer\Serializer;
17
18
/**
19
 * Compiler pass adding Serializer metadata for the xAPI model classes.
20
 *
21
 * @author Christian Flothmann <[email protected]>
22
 */
23
class RegisterSerializerMetadataPass implements CompilerPassInterface
24
{
25
    /**
26
     * {@inheritDoc}
27
     */
28 1
    public function process(ContainerBuilder $container)
29
    {
30 1
        $fileLocator = $container->findDefinition('jms_serializer.metadata.file_locator');
31 1
        $dirs = $fileLocator->getArgument(0);
32 1
        $dirs['Xabbuh\XApi\Model'] = Serializer::getMetadataDirectory();
33 1
        $fileLocator->replaceArgument(0, $dirs);
34 1
    }
35
}
36