Completed
Push — feature/fix-somescrutinizer-is... ( 840c34...8bd6e3 )
by Narcotic
15:02 queued 08:41
created

VersionCompilerPass::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1
Metric Value
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.6667
cc 1
eloc 6
nc 1
nop 1
crap 1
1
<?php
2
/** A custom compiler pass class */
3
4
namespace Graviton\CoreBundle\Compiler;
5
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\Yaml\Parser;
9
10
/**
11
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
12
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
13
 * @link     http://swisscom.ch
14
 */
15
class VersionCompilerPass implements CompilerPassInterface
16
{
17
18
    /**
19
     * add version numbers of packages to the container
20
     *
21
     * @param ContainerBuilder $container Container
22
     *
23
     * @return void
24
     */
25 1
    public function process(ContainerBuilder $container)
26
    {
27 1
        $yaml = new Parser();
28 1
        $versions = $yaml->parse(file_get_contents($container->getParameter('kernel.root_dir') . '/../versions.yml'));
29 1
        $container->setParameter(
30 1
            'graviton.core.version.data',
31
            $versions
32 1
        );
33 1
    }
34
}
35