| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 6 | private function defineNewGate($gate) |
|
| 20 | { |
||
| 21 | // Define a Gate for inline closures passed as gate |
||
| 22 | 6 | if (is_callable($gate)) { |
|
| 23 | 1 | $closure = $gate; |
|
| 24 | 1 | $gate = Str::random(10); |
|
| 25 | 1 | GateFacade::define($gate, $closure); |
|
| 26 | } |
||
| 27 | |||
| 28 | // Define a Gate for "class@method" gates |
||
| 29 | 6 | if (is_string($gate) && Str::contains($gate, '@')) { |
|
| 30 | 1 | GateFacade::define($gate, $gate); |
|
| 31 | } |
||
| 32 | |||
| 33 | 6 | return $gate; |
|
| 34 | } |
||
| 41 |