Completed
Push — master ( 9b1160...9e63e2 )
by Walter
03:15
created

EventManagerVariant::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace PhpAbModule\Variant;
4
5
use PhpAb\Variant\VariantInterface;
6
use Zend\EventManager\EventManagerInterface;
7
use Zend\ServiceManager\FactoryInterface;
8
use Zend\ServiceManager\ServiceLocatorInterface;
9
10
class EventManagerVariant implements VariantInterface
11
{
12
    /**
13
     * @var EventManagerInterface
14
     */
15
    private $eventManager;
16
17
    /**
18
     * @var string
19
     */
20
    private $idenfier;
21
22
    /**
23
     * @var string
24
     */
25
    private $eventName;
26
27
    /**
28
     * @var callable
29
     */
30
    private $callback;
31
32
    /**
33
     * @var int
34
     */
35
    private $priority;
36
37
    public function __construct(EventManagerInterface $eventManager, $identifier, $eventName, $callback, $priority)
0 ignored issues
show
Unused Code introduced by
The parameter $priority is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        $this->eventManager = $eventManager;
40
        $this->idenfier = $identifier;
41
        $this->eventName = $eventName;
42
        $this->callback = $callback;
43
        $this->priority = 0;
44
    }
45
46
    public function getIdentifier()
47
    {
48
        return $this->idenfier;
49
    }
50
51
    public function run()
52
    {
53
        $this->eventManager->attach($this->eventName, $this->callback, $this->priority);
54
    }
55
}
56