Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | private function defineNewGate($gate): string |
||
24 | { |
||
25 | // Define a Gate for inline closures passed as gate |
||
26 | if (is_callable($gate)) { |
||
27 | $closure = $gate; |
||
28 | $gate = str_random(10); |
||
29 | GateFacade::define($gate, $closure); |
||
30 | } |
||
31 | |||
32 | // Define a Gate for "class@method" gates |
||
33 | if (is_string($gate) && str_contains($gate, '@')) { |
||
34 | GateFacade::define($gate, $gate); |
||
35 | } |
||
36 | |||
37 | return $gate; |
||
38 | } |
||
46 | } |