BaseSubscriber   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 54
ccs 0
cts 10
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setEnabled() 0 3 1
A __construct() 0 7 1
1
<?php
2
/**
3
 * @author Gerard van Helden <[email protected]>
4
 * @copyright Zicht online <http://zicht.nl>
5
 */
6
7
namespace Zicht\Bundle\UrlBundle\Aliasing\Doctrine;
8
9
use Doctrine\Common\EventSubscriber;
10
use Symfony\Component\DependencyInjection\Container;
11
12
/**
13
 * Base class for the subscriber implementations
14
 */
15
abstract class BaseSubscriber implements EventSubscriber
16
{
17
    /**
18
     * @var Container
19
     */
20
    protected $container;
21
22
    /**
23
     * @var string
24
     */
25
    protected $aliaserServiceId;
26
27
    /**
28
     * @var string
29
     */
30
    protected $className;
31
32
    /**
33
     * @var bool
34
     */
35
    protected $enabled;
36
37
    /**
38
     * Constructor.
39
     *
40
     * @param Container $container
41
     * @param string $aliaserServiceId
42
     * @param string $className
43
     * @param boolean $enabled
44
     */
45
    public function __construct(Container $container, $aliaserServiceId, $className, $enabled = true)
46
    {
47
        // we inject the container because otherwise a circular reference would occur.
48
        $this->container = $container;
49
        $this->aliaserServiceId = $aliaserServiceId;
50
        $this->className = $className;
51
        $this->enabled = $enabled;
52
    }
53
54
    /**
55
     * Explicitly set the the subscriber to be enabled or disabled
56
     *
57
     * @param string $enabled
58
     * @return void
59
     */
60
    /**
61
     * Enable or disable the subscriber
62
     *
63
     * @param boolean $enabled
64
     * @return void
65
     */
66
    final public function setEnabled($enabled)
67
    {
68
        $this->enabled = $enabled;
69
    }
70
}
71