Completed
Push — master ( e4e35c...27cf60 )
by Walter
03:25
created

EventManagerVariant::getCallback()   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
 * This file is part of phpab/phpab-module. (https://github.com/phpab/phpab-module)
4
 *
5
 * @link https://github.com/phpab/phpab-module for the canonical source repository
6
 * @copyright Copyright (c) 2015-2016 phpab. (https://github.com/phpab/)
7
 * @license https://raw.githubusercontent.com/phpab/phpab-module/master/LICENSE MIT
8
 */
9
10
namespace PhpAbModule\Variant;
11
12
use PhpAb\Variant\VariantInterface;
13
use Zend\EventManager\EventManagerInterface;
14
use Zend\ServiceManager\FactoryInterface;
15
use Zend\ServiceManager\ServiceLocatorInterface;
16
17
class EventManagerVariant implements VariantInterface
18
{
19
    /**
20
     * @var EventManagerInterface
21
     */
22
    private $eventManager;
23
24
    /**
25
     * @var string
26
     */
27
    private $idenfier;
28
29
    /**
30
     * @var string
31
     */
32
    private $eventName;
33
34
    /**
35
     * @var callable
36
     */
37
    private $callback;
38
39
    /**
40
     * @var int
41
     */
42
    private $priority;
43
44
    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...
45
    {
46
        $this->eventManager = $eventManager;
47
        $this->idenfier = $identifier;
48
        $this->eventName = $eventName;
49
        $this->callback = $callback;
50
        $this->priority = 0;
51
    }
52
53
    public function getEventManager()
54
    {
55
        return $this->eventManager;
56
    }
57
58
    public function getIdentifier()
59
    {
60
        return $this->idenfier;
61
    }
62
63
    public function getEventName()
64
    {
65
        return $this->eventName;
66
    }
67
68
    public function getCallback()
69
    {
70
        return $this->callback;
71
    }
72
73
    public function getPriority()
74
    {
75
        return $this->priority;
76
    }
77
78
    public function run()
79
    {
80
        $this->getEventManager()->attach($this->getEventName(), $this->getCallback(), $this->getPriority());
81
    }
82
}
83