AspectSymfonyKernel::configureAop()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
use Go\Core\AspectContainer;
14
use Go\Core\AspectKernel;
15
use Go\Instrument\ClassLoading\AopComposerLoader;
16
use Symfony\Component\Debug\DebugClassLoader;
17
18
class AspectSymfonyKernel extends AspectKernel
19
{
20
    /**
21
     * Configure an AspectContainer with advisors, aspects and pointcuts
22
     *
23
     * @param AspectContainer $container
24
     *
25
     * @return void
26
     */
27
    protected function configureAop(AspectContainer $container)
28
    {
29
        /* noop */
30
    }
31
32
    /**
33
     * Cache warmer in SF doesn't call Bundle::boot, so we need to duplicate this logic one more time
34
     *
35
     * @inheritDoc
36
     */
37 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...
38
    {
39
        // it is a quick way to check if loader was enabled
40
        $wasDebugEnabled = class_exists(DebugClassLoader::class, false);
41
        if ($wasDebugEnabled) {
42
            // disable temporary to apply AOP loader first
43
            DebugClassLoader::disable();
44
        }
45
        parent::init($options);
46
47
        if (!AopComposerLoader::wasInitialized()) {
48
            throw new \RuntimeException("Initialization of AOP loader was failed, probably due to Debug::enable()");
49
        }
50
        if ($wasDebugEnabled) {
51
            DebugClassLoader::enable();
52
        }
53
    }
54
}
55