Completed
Pull Request — master (#8)
by Yann
02:27
created

ct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace EnumBundle\DependencyInjection\CompilerPass;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
/**
9
 * @author Yann Eugoné <[email protected]>
10
 */
11
class ConventionedEnumCollectorCompilerPass implements CompilerPassInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function process(ContainerBuilder $container)
17
    {
18
        $bundles = $container->getParameter('enum.register_bundles');
19
20
        if (!$bundles) {
21 3
            return;
22
        }
23 3
24 3
        if (true === $bundles) {
25
            $bundles = $container->getParameter('kernel.bundles');
26
        } else {
27
            $bundles = (array) $bundles;
28
        }
29 3
30
        foreach ($bundles as $bundleClass) {
31 3
            $declarativePass = new DeclarativeEnumCollectorCompilerPass($bundleClass);
32 3
            $declarativePass->process($container);
33 3
        }
34
    }
35
}
36