Completed
Push — master ( 9ab051...22e98b )
by San
58s
created

PommBundle   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
c 4
b 0
f 0
lcom 0
cbo 8
dl 0
loc 44
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 11 1
A checkPhpVersion() 0 6 2
A getContainerExtension() 0 4 1
A shutdown() 0 4 1
1
<?php
2
/*
3
 * This file is part of the PommProject/PommBundle package.
4
 *
5
 * (c) 2014 Grégoire HUBERT <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PommProject\PommBundle;
11
12
use Symfony\Component\HttpKernel\Bundle\Bundle;
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
15
16
/**
17
 * PommBundle
18
 *
19
 * Pomm2 bundle class.
20
 *
21
 * @package PommBundle
22
 * @copyright 2014 Grégoire HUBERT
23
 * @author Nicolas JOSEPH
24
 * @license X11 {@link http://opensource.org/licenses/mit-license.php}
25
 * @see Bundle
26
 */
27
class PommBundle extends Bundle
28
{
29
    /**
30
     * build
31
     *
32
     * @see Bundle
33
     */
34
    public function build(ContainerBuilder $container)
35
    {
36
        parent::build($container);
37
38
        $this->checkPhpVersion();
39
40
        $container->addCompilerPass(new DependencyInjection\Compiler\ProfilerPass);
41
        $container->addCompilerPass(new DependencyInjection\Compiler\PoolerPass);
42
        $container->addCompilerPass(new DependencyInjection\Compiler\ModelPass);
43
        $container->addCompilerPass(new DependencyInjection\Compiler\BuilderPass);
44
    }
45
46
    private function checkPhpVersion()
47
    {
48
        if (PHP_MAJOR_VERSION === 5) {
49
            @trigger_error('The pomm bundle stop supporting PHP5 in version 3.0', E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
50
        }
51
    }
52
53
    /**
54
     * getContainerExtension
55
     *
56
     * @see Bundle
57
     */
58
    public function getContainerExtension()
59
    {
60
        return new DependencyInjection\PommExtension();
61
    }
62
63
    /**
64
     * @see Bundle
65
     */
66
    public function shutdown()
67
    {
68
        $this->container->get('pomm')->shutdown();
69
    }
70
}
71