@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * Adds a new role object to the registry |
| 24 | 24 | * |
| 25 | - * @param string $role |
|
| 25 | + * @param string[] $role |
|
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | 28 | public function addRole(string ...$role); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * Adds a new resource object to the registry |
| 32 | 32 | * |
| 33 | - * @param string $resource |
|
| 33 | + * @param string[] $resource |
|
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | 36 | public function addResource(string ...$resource); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Adds a new permission object to the registry |
| 40 | 40 | * |
| 41 | - * @param string $permission |
|
| 41 | + * @param string[] $permission |
|
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | 44 | public function addPermission(string ...$permission); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * Automatically determine the type of an object and call the appropriate |
| 50 | 50 | * add method on it. |
| 51 | 51 | * |
| 52 | - * @param ObjectInterface $object |
|
| 52 | + * @param ObjectInterface[] $object |
|
| 53 | 53 | * @throws \Exception |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare (strict_types=1); |
|
| 1 | +<?php declare (strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Samshal\Acl library |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @throws \Exception |
| 66 | 66 | * @return void |
| 67 | 67 | */ |
| 68 | - public function allow(string $role, string $permission, string $resource, bool $status=null); |
|
| 68 | + public function allow(string $role, string $permission, string $resource, bool $status = null); |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Change the status option of an assigned permission to false |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | /** |
| 207 | 207 | * Add a new role object to the registry |
| 208 | 208 | * |
| 209 | - * @param string[] $role |
|
| 209 | + * @param string $role |
|
| 210 | 210 | * @return void |
| 211 | 211 | */ |
| 212 | 212 | public function addRole(string ...$role) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | /** |
| 221 | 221 | * Add a new resource object to the registry |
| 222 | 222 | * |
| 223 | - * @param string[] $resource |
|
| 223 | + * @param string $resource |
|
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | 226 | public function addResource(string ...$resource) |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | /** |
| 235 | 235 | * Add a new permission object to the registry |
| 236 | 236 | * |
| 237 | - * @param string[] $permission |
|
| 237 | + * @param string $permission |
|
| 238 | 238 | * @return void |
| 239 | 239 | */ |
| 240 | 240 | public function addPermission(string ...$permission) |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Samshal\Acl library |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | * @throws \Exception |
| 318 | 318 | * @return void |
| 319 | 319 | */ |
| 320 | - public function allow(string $role, string $permission, string $resource, bool $status=null) |
|
| 320 | + public function allow(string $role, string $permission, string $resource, bool $status = null) |
|
| 321 | 321 | { |
| 322 | 322 | $status = $status ?? true; |
| 323 | 323 | if (!$this->roleRegistry->exists($role)) { |
@@ -262,16 +262,13 @@ |
||
| 262 | 262 | if ($object instanceof RoleInterface) |
| 263 | 263 | { |
| 264 | 264 | $this->addRole((string)$object); |
| 265 | - } |
|
| 266 | - else if ($object instanceof ResourceInterface) |
|
| 265 | + } else if ($object instanceof ResourceInterface) |
|
| 267 | 266 | { |
| 268 | 267 | $this->addResource((string)$object); |
| 269 | - } |
|
| 270 | - else if ($object instanceof PermissionInterface) |
|
| 268 | + } else if ($object instanceof PermissionInterface) |
|
| 271 | 269 | { |
| 272 | 270 | $this->addPermission((string)$object); |
| 273 | - } |
|
| 274 | - else { |
|
| 271 | + } else { |
|
| 275 | 272 | throw new \Exception( |
| 276 | 273 | sprintf( |
| 277 | 274 | "%s must implement one of RoleInterface, '. |