Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4.0961 |
Changes | 0 |
1 | <?php namespace Cairns\Radiate\Middleware; |
||
38 | 1 | public function execute($event, callable $next) |
|
39 | { |
||
40 | 1 | $listeners = $this->listeners->find($event); |
|
41 | |||
42 | 1 | if (! $listeners) { |
|
43 | return $next($event); |
||
44 | } |
||
45 | |||
46 | 1 | foreach ($listeners as $listener) { |
|
47 | 1 | $method = $this->inflector->inflect($event, $listener); |
|
48 | |||
49 | 1 | if (! $method) { |
|
50 | continue; |
||
51 | } |
||
52 | |||
53 | 1 | $listener = $this->locator->locate($listener); |
|
54 | |||
55 | 1 | call_user_func([$listener, $method], $event); |
|
56 | } |
||
57 | |||
58 | 1 | return $next($event); |
|
59 | } |
||
60 | } |
||
61 |