Ecodev /
felix
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Ecodev\Felix\Acl; |
||
| 6 | |||
| 7 | use Exception; |
||
| 8 | use Laminas\Permissions\Acl\Role\RoleInterface; |
||
| 9 | use Stringable; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * A role containing multiple roles. |
||
| 13 | */ |
||
| 14 | class MultipleRoles implements RoleInterface, Stringable |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var string[] |
||
| 18 | */ |
||
| 19 | private array $roles = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param string[] $roles |
||
| 23 | */ |
||
| 24 | public function __construct(array $roles = []) |
||
| 25 | { |
||
| 26 | foreach ($roles as $role) { |
||
| 27 | $this->addRole($role); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Add a role to the list. |
||
| 33 | */ |
||
| 34 | public function addRole(string $role): void |
||
| 35 | { |
||
| 36 | $this->roles[] = $role; |
||
| 37 | |||
| 38 | $this->roles = array_unique($this->roles); |
||
| 39 | sort($this->roles); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getRoleId(): never |
||
|
1 ignored issue
–
show
|
|||
| 43 | { |
||
| 44 | throw new Exception('This should never be called. If it is, then it means this class is not used correctly'); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Return the role list. |
||
| 49 | * |
||
| 50 | * @return string[] |
||
| 51 | */ |
||
| 52 | public function getRoles(): array |
||
| 53 | { |
||
| 54 | return $this->roles; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Return whether the given role is included in the list. |
||
| 59 | */ |
||
| 60 | public function has(string $role): bool |
||
| 61 | { |
||
| 62 | return in_array($role, $this->roles, true); |
||
| 63 | } |
||
| 64 | |||
| 65 | public function __toString(): string |
||
| 66 | { |
||
| 67 | return '[' . implode(', ', $this->roles) . ']'; |
||
| 68 | } |
||
| 69 | } |
||
| 70 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths