Conditions | 4 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public static function create(Rule $rule, array|string $subjects = []): BouncerInterface |
||
23 | { |
||
24 | if (is_string($subjects)) { |
||
|
|||
25 | $trimmed = []; |
||
26 | foreach (explode(';', $subjects) as $subject) { |
||
27 | if (!empty($subject)) { |
||
28 | $trimmed[] = trim($subject); |
||
29 | } |
||
30 | } |
||
31 | $subjects = $trimmed; |
||
32 | } |
||
33 | return match ($rule) { |
||
34 | Rule::ALLOW => new AllowList($subjects), |
||
35 | Rule::DENY => new DenyList($subjects), |
||
36 | }; |
||
49 |