Completed
Pull Request — master (#16)
by Nikola
01:29
created

AspectSymfonyKernel::init()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 17
Code Lines 9

Duplication

Lines 17
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 17
loc 17
rs 9.2
cc 4
eloc 9
nc 6
nop 1
1
<?php
2
/**
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2015, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Symfony\GoAopBundle\Kernel;
12
13
14
use Go\Core\AspectContainer;
15
use Go\Core\AspectKernel;
16
use Go\Instrument\ClassLoading\AopComposerLoader;
17
use Symfony\Component\Debug\DebugClassLoader;
18
19
class AspectSymfonyKernel extends AspectKernel
20
{
21
    /**
22
     * Configure an AspectContainer with advisors, aspects and pointcuts
23
     *
24
     * @param AspectContainer $container
25
     *
26
     * @return void
27
     */
28
    protected function configureAop(AspectContainer $container)
29
    {
30
        /* noop */
31
    }
32
33
    /**
34
     * Cache warmer in SF doesn't call Bundle::boot, so we need to duplicate this logic one more time
35
     *
36
     * @inheritDoc
37
     */
38 View Code Duplication
    public function init(array $options = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        // it is a quick way to check if loader was enabled
41
        $wasDebugEnabled = class_exists('\Symfony\Component\Debug\DebugClassLoader', false);
42
        if ($wasDebugEnabled) {
43
            // disable temporary to apply AOP loader first
44
            DebugClassLoader::disable();
45
        }
46
        parent::init($options);
47
48
        if (!AopComposerLoader::wasInitialized()) {
49
            throw new \RuntimeException("Initialization of AOP loader was failed, probably due to Debug::enable()");
50
        }
51
        if ($wasDebugEnabled) {
52
            DebugClassLoader::enable();
53
        }
54
    }
55
}
56