Conditions | 4 |
Paths | 8 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
16 | function aclGetALevel($level) |
||
17 | { |
||
18 | 21 | if (is_string($level)) { |
|
19 | 1 | $level = config('laravel-acl.level', Level::class)::whereName($level)->first(); |
|
20 | } |
||
21 | |||
22 | 21 | if (is_int($level)) { |
|
23 | 2 | $level = config('laravel-acl.level', Level::class)::find($level); |
|
24 | } |
||
25 | |||
26 | 21 | if (!$level) { |
|
27 | 1 | throw new LevelNotFoundException(); |
|
28 | } |
||
29 | |||
30 | 20 | return $level; |
|
31 | } |
||
32 | } |
||
56 | } |