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

VersionCompilerPass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 20
ccs 0
cts 9
cp 0
rs 10

1 Method

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