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

VersionCompilerPass   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 20
ccs 7
cts 7
cp 1
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 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