Completed
Push — master ( 1ead1a...42494f )
by Beñat
02:05
created

TwigBridgeBundle::basePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the BenGorUser package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorUser\TwigBridgeBundle;
14
15
use BenGorUser\UserBundle\DependentBenGorUserBundle;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\HttpKernel\Bundle\Bundle;
18
19
/**
20
 * Twig bridge bundle kernel class.
21
 *
22
 * @author Beñat Espiña <[email protected]>
23
 */
24
class TwigBridgeBundle extends Bundle
25
{
26
    use DependentBenGorUserBundle;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function build(ContainerBuilder $container)
32
    {
33
        $this->checkDependencies(['BenGorUserBundle', 'TwigBundle'], $container);
34
35
        $container->loadFromExtension('framework', [
36
            'translator' => [
37
                'paths' => [
38
                    $this->basePath() . '/Translations',
39
                ],
40
            ],
41
        ]);
42
        $container->loadFromExtension('twig', [
43
            'paths' => [
44
                $this->basePath() . '/Twig/views' => 'bengor_user',
45
            ],
46
        ]);
47
    }
48
49
    /**
50
     * Gets the base path obtained via reflection,
51
     * agnostic to the Symfony root dir location.
52
     *
53
     * @return string
54
     */
55
    private function basePath()
56
    {
57
        $directory = dirname((new \ReflectionClass(self::class))->getFileName());
58
59
        return $directory . '/../../../../twig-bridge/src/BenGorUser/TwigBridge/Infrastructure/Ui';
60
    }
61
}
62