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