| @@ 70-81 (lines=12) @@ | ||
| 67 | * |
|
| 68 | * @return $this |
|
| 69 | */ |
|
| 70 | public function addRole(string $role): PermissionManager |
|
| 71 | { |
|
| 72 | if ($this->hasRole($role)) { |
|
| 73 | throw new RoleException("Role '{$role}' already exists"); |
|
| 74 | } |
|
| 75 | ||
| 76 | $this->permissions[$role] = [ |
|
| 77 | //No associated permissions |
|
| 78 | ]; |
|
| 79 | ||
| 80 | return $this; |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * {@inheritdoc} |
|
| @@ 88-97 (lines=10) @@ | ||
| 85 | * |
|
| 86 | * @return $this |
|
| 87 | */ |
|
| 88 | public function removeRole(string $role): PermissionManager |
|
| 89 | { |
|
| 90 | if (!$this->hasRole($role)) { |
|
| 91 | throw new RoleException("Undefined role '{$role}'"); |
|
| 92 | } |
|
| 93 | ||
| 94 | unset($this->permissions[$role]); |
|
| 95 | ||
| 96 | return $this; |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * {@inheritdoc} |
|