Conditions | 4 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
16 | public function startWatching($chainData) |
||
17 | { |
||
18 | 50 | Route::matched(function (RouteMatched $eventObj) use ($chainData) { |
|
19 | $matchedRoute = [ |
||
20 | 50 | $eventObj->route->getName(), |
|
21 | 50 | $eventObj->route->getActionName(), |
|
22 | 50 | $eventObj->request->method().$eventObj->route->uri, |
|
23 | ]; |
||
24 | 50 | $matchedCallbacks = []; |
|
25 | 50 | foreach (array_filter($matchedRoute) as $info) { |
|
26 | 50 | foreach ($chainData as $routeInfo => $callBacks) { |
|
27 | 48 | if (Str::is($routeInfo, $info)) { |
|
28 | 50 | $matchedCallbacks[] = array_pop($callBacks); |
|
29 | } |
||
30 | } |
||
31 | } |
||
32 | |||
33 | 50 | $this->exec($matchedCallbacks); |
|
34 | 50 | }); |
|
47 |