| Conditions | 4 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 20 | protected function isAllowed(string $slug): bool |
||
| 21 | { |
||
| 22 | $deniedPermissions = []; |
||
| 23 | \array_map(function (RoleInterface $role) use ($slug, &$deniedPermissions): void { |
||
| 24 | if ($role->has($slug) && $role->allow($slug) === false) { |
||
| 25 | $deniedPermissions[$slug] = true; |
||
| 26 | } |
||
| 27 | }, $this->roles); |
||
| 28 | |||
| 29 | $permission = \array_filter($this->roles, function (RoleInterface $role) use ($slug, $deniedPermissions) { |
||
| 30 | return !isset($deniedPermissions[$slug]) && $role->allow($slug); |
||
| 31 | }); |
||
| 32 | |||
| 33 | return (bool)\count($permission); |
||
| 34 | } |
||
| 36 |