Completed
Branch feature/moar-test-optimizing (8cffd1)
by Lucas
19:31 queued 13:44
created

VersionCompilerPass::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.6666
cc 1
eloc 6
nc 1
nop 1
crap 2
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
    public function process(ContainerBuilder $container)
26
    {
27
        $yaml = new Parser();
28
        $versions = $yaml->parse(file_get_contents($container->getParameter('kernel.root_dir') . '/../versions.yml'));
29
        $container->setParameter(
30
            'graviton.core.version.data',
31
            $versions
32
        );
33
    }
34
}
35