| Conditions | 4 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace GeneaLabs\LaravelCaffeine\Providers; |
||
| 33 | private function middlewareGroupExists(string $group) : bool |
||
| 34 | { |
||
| 35 | $routes = collect(app('router')->getRoutes()->getRoutes()); |
||
| 36 | |||
| 37 | return $routes->reduce(function ($carry, $route) use ($group) { |
||
| 38 | $carry = ($carry ?? false) ?: false; |
||
| 39 | $actions = (array) $route->getAction(); |
||
| 40 | |||
| 41 | if (array_key_exists('middleware', $actions) |
||
| 42 | && in_array($group, (array) $actions['middleware']) |
||
| 43 | ) { |
||
| 44 | return true; |
||
| 45 | } |
||
| 46 | |||
| 47 | return $carry; |
||
| 48 | }) ?? false; |
||
| 49 | } |
||
| 51 |