Completed
Pull Request — master (#1)
by Yanick
02:41
created

TensideCoreBundle   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 4
c 2
b 0
f 1
lcom 0
cbo 5
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContainerExtension() 0 4 1
A boot() 0 16 2
A build() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of tenside/core-bundle.
5
 *
6
 * (c) Christian Schiffler <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * This project is provided in good faith and hope to be usable by anyone.
12
 *
13
 * @package    tenside/core-bundle
14
 * @author     Christian Schiffler <[email protected]>
15
 * @author     Yanick Witschi <[email protected]>
16
 * @copyright  2015 Christian Schiffler <[email protected]>
17
 * @license    https://github.com/tenside/core-bundle/blob/master/LICENSE MIT
18
 * @link       https://github.com/tenside/core-bundle
19
 * @filesource
20
 */
21
22
namespace Tenside\CoreBundle;
23
24
use Doctrine\Common\Annotations\AnnotationRegistry;
25
use Symfony\Component\DependencyInjection\ContainerBuilder;
26
use Symfony\Component\HttpKernel\Bundle\Bundle;
27
use Tenside\CoreBundle\DependencyInjection\Compiler\AddTaskFactoryPass;
28
use Tenside\CoreBundle\DependencyInjection\TensideCoreExtension;
29
30
/**
31
 * This class is the tenside core bundle.
32
 */
33
class TensideCoreBundle extends Bundle
34
{
35
    /**
36
     * {@inheritDoc}
37
     */
38
    public function getContainerExtension()
39
    {
40
        return new TensideCoreExtension();
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function boot()
47
    {
48
        parent::boot();
49
50
        // Load our annotation if it get's mentioned, Doctrine does not try to autoload it via plain PHP.
51
        AnnotationRegistry::registerLoader(
52
            function ($class) {
53
                if (0 === strcmp('Tenside\CoreBundle\Annotation\ApiDescription', $class)) {
54
                    class_exists('Tenside\CoreBundle\Annotation\ApiDescription');
55
                    return true;
56
                }
57
58
                return false;
59
            }
60
        );
61
    }
62
63
    /**
64
     * @param ContainerBuilder $container
65
     */
66
    public function build(ContainerBuilder $container)
67
    {
68
        parent::build($container);
69
70
        $container->addCompilerPass(new AddTaskFactoryPass());
71
    }
72
}
73