| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 61 | public function allows(ActorInterface $actor, string $permission, array $context): bool |
||
| 62 | { |
||
| 63 | $allowed = 0; |
||
| 64 | foreach ($this->rules as $rule) { |
||
| 65 | $rule = $this->repository->get($rule); |
||
| 66 | |||
| 67 | if ($rule->allows($actor, $permission, $context)) { |
||
| 68 | if (static::JOINER == self::BOOLEAN_OR) { |
||
| 69 | return true; |
||
| 70 | } |
||
| 71 | |||
| 72 | $allowed++; |
||
| 73 | } elseif (static::JOINER == self::BOOLEAN_AND) { |
||
| 74 | return false; |
||
| 75 | } |
||
| 76 | } |
||
| 77 | |||
| 78 | return $allowed === count($this->rules); |
||
| 79 | } |
||
| 80 | } |