Total Complexity | 5 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
5 | class ViewEventManager |
||
6 | { |
||
7 | private $views = []; |
||
8 | |||
9 | /** |
||
10 | * ViewEventManager constructor. |
||
11 | * |
||
12 | * @param $views |
||
13 | * |
||
14 | * @return ViewEventManager |
||
15 | */ |
||
16 | 14 | public function init(array $views): ViewEventManager |
|
21 | } |
||
22 | |||
23 | /** |
||
24 | * @param $listener |
||
25 | */ |
||
26 | 14 | public function startGuarding(callable $listener) |
|
27 | { |
||
28 | foreach ($this->views as $view) { |
||
29 | 14 | view()->creator($view, $this->wrapForIgnorance($listener)); |
|
30 | 12 | } |
|
31 | } |
||
32 | 14 | ||
33 | private function wrapForIgnorance(callable $callback): callable |
||
38 | } |
||
39 | }; |
||
42 |