Completed
Pull Request — master (#29)
by Paulo Rodrigues
06:00
created

RjFrontendBundle   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Test Coverage

Coverage 30.76%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 8
dl 0
loc 26
ccs 4
cts 13
cp 0.3076
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 6 1
A registerCommands() 0 8 2
A addConsoleHelpers() 0 7 2
1
<?php
2
3
namespace Rj\FrontendBundle;
4
5
use Rj\FrontendBundle\DependencyInjection\Compiler\AssetCompilerPass;
6
use Rj\FrontendBundle\Util\Util;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\HttpKernel\Bundle\Bundle;
9
use Symfony\Component\Console\Application;
10
use Symfony\Bundle\FrameworkBundle\Console\Application as FrameworkApplication;
11
12
class RjFrontendBundle extends Bundle
13
{
14 12
    public function build(ContainerBuilder $container)
15
    {
16 12
        parent::build($container);
17
18 12
        $container->addCompilerPass(new AssetCompilerPass());
19 12
    }
20
21
    public function registerCommands(Application $app)
22
    {
23
        if ($app instanceof FrameworkApplication) {
24
            $this->addConsoleHelpers($app);
25
        }
26
27
        return parent::registerCommands($app);
28
    }
29
30
    private function addConsoleHelpers(FrameworkApplication $app)
31
    {
32
        if (!Util::hasQuestionHelper()) {
33
            $helper = $app->getKernel()->getContainer()->get('rj_frontend.console.helper.question_legacy');
34
            $app->getHelperSet()->set($helper, 'question');
35
        }
36
    }
37
}
38