AspectSymfonyKernel   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 45.95 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 0
cbo 3
dl 17
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureAop() 0 4 1
A init() 17 17 4

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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