Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function handle(Request $request, \Closure $next) |
||
19 | { |
||
20 | $args = array_slice(func_get_args(), 2); |
||
21 | |||
22 | if (count($args) > 1) { |
||
23 | $type = array_shift($args); |
||
24 | |||
25 | if (!method_exists(Permission::class, $type)) { |
||
26 | throw new \InvalidArgumentException("Invaild permission method [$type]."); |
||
27 | } |
||
28 | |||
29 | call_user_func_array([Permission::class, $type], [$args]); |
||
30 | } |
||
31 | |||
32 | return $next($request); |
||
33 | } |
||
34 | } |
||
35 |