Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | class BasicEventManager |
||
8 | { |
||
9 | private $events; |
||
10 | |||
11 | /** |
||
12 | * BasicEventManager constructor. |
||
13 | * |
||
14 | * @param $events |
||
15 | * |
||
16 | * @return BasicEventManager |
||
17 | */ |
||
18 | 6 | public function init(array $events): BasicEventManager |
|
23 | } |
||
24 | |||
25 | /** |
||
26 | * @param $listener |
||
27 | */ |
||
28 | 6 | public function startGuarding(callable $listener) |
|
29 | { |
||
30 | Event::listen($this->events, $this->wrapForIgnorance($listener)); |
||
31 | 6 | } |
|
32 | 5 | ||
33 | /** |
||
34 | 6 | * @param callable $callback |
|
35 | 6 | * @return \Closure |
|
36 | 6 | */ |
|
37 | 6 | private function wrapForIgnorance(callable $callback): \Closure |
|
42 | } |
||
43 | }; |
||
46 |