LazyActionDispatcher   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 7
c 2
b 1
f 0
lcom 1
cbo 0
dl 0
loc 78
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A perform() 0 5 1
A performFromEvent() 0 5 1
A getName() 0 4 1
A setName() 0 6 1
A getInspectionId() 0 4 1
A setInspectionId() 0 6 1
1
<?php
2
3
namespace Vivait\Voter\Dispatcher;
4
5
use Symfony\Component\EventDispatcher\Event;
6
use Vivait\InspectorBundle\Model\ActionDispatcherFactory;
7
8
class LazyActionDispatcher implements ActionDispatcherInterface
9
{
10
    /**
11
     * @var ActionDispatcherFactory
12
     */
13
    private $actionDispatcherFactory;
14
15
    /**
16
     * @var string
17
     */
18
    private $inspectionId;
19
20
    /**
21
     * @var string
22
     */
23
    private $inspectionName;
24
25
    public function __construct($inspectionId, $inspectionName, ActionDispatcherFactory $actionDispatcherFactory)
26
    {
27
        $this->actionDispatcherFactory = $actionDispatcherFactory;
28
        $this->inspectionId = $inspectionId;
29
        $this->inspectionName = $inspectionName;
30
    }
31
32
    public function perform($entity)
33
    {
34
        $actionDispatcher = $this->actionDispatcherFactory->create($this->inspectionId);
35
        $actionDispatcher->perform($entity);
36
    }
37
38
    public function performFromEvent(Event $event, $eventName)
39
    {
40
        $actionDispatcher = $this->actionDispatcherFactory->create($this->inspectionId);
41
        $actionDispatcher->performFromEvent($event, $eventName);
42
    }
43
44
    /**
45
     * Gets inspectionName
46
     * @return string
47
     */
48
    public function getName()
49
    {
50
        return $this->inspectionName;
51
    }
52
53
    /**
54
     * Sets inspectionName
55
     * @param string $inspectionName
56
     * @return $this
57
     */
58
    public function setName($inspectionName)
59
    {
60
        $this->inspectionName = $inspectionName;
61
62
        return $this;
63
    }
64
65
    /**
66
     * Gets inspectionId
67
     * @return string
68
     */
69
    public function getInspectionId()
70
    {
71
        return $this->inspectionId;
72
    }
73
74
    /**
75
     * Sets inspectionId
76
     * @param string $inspectionId
77
     * @return $this
78
     */
79
    public function setInspectionId($inspectionId)
80
    {
81
        $this->inspectionId = $inspectionId;
82
83
        return $this;
84
    }
85
}
86