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

PommBundle::checkPhpVersion()   A

Complexity

Conditions 2
Paths 2

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 2
eloc 3
nc 2
nop 0
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 Sanpi
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