| Conditions | 6 |
| Paths | 6 |
| Total Lines | 25 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | private function check( |
||
| 50 | string $type, |
||
| 51 | array &$rules, |
||
| 52 | string $role, |
||
| 53 | string $resource, |
||
| 54 | string $privilege = null |
||
| 55 | ): bool { |
||
| 56 | $item = &$rules['roles']; |
||
| 57 | |||
| 58 | if (isset($item[$role][$type][$resource][$privilege])) { |
||
| 59 | return true; |
||
| 60 | } |
||
| 61 | |||
| 62 | foreach ($item[$role]['parents'] ?? [] as $parent => $value) { |
||
| 63 | if ($this->check($type, $rules, $parent, $resource, $privilege)) { |
||
| 64 | return true; |
||
| 65 | } |
||
| 66 | } |
||
| 67 | |||
| 68 | if (isset($item[$role][$type][$resource]) && |
||
| 69 | !count($item[$role][$type][$resource])) { |
||
| 70 | return true; |
||
| 71 | } |
||
| 72 | |||
| 73 | return false; |
||
| 74 | } |
||
| 76 |