1 | <?php declare(strict_types=1); |
||
36 | class Acl implements AclInterface |
||
37 | { |
||
38 | /** |
||
39 | * @var Samshal\Acl\Registry\RegistryInterface $roleRegistry |
||
40 | */ |
||
41 | public $roleRegistry; |
||
42 | |||
43 | /** |
||
44 | * @var Samshal\Acl\Registry\RegistryInterface $resourceRegistry |
||
45 | */ |
||
46 | protected $resourceRegistry; |
||
47 | |||
48 | /** |
||
49 | * @var Samshal\Acl\Registry\RegistryInterface $permissionRegistry |
||
50 | */ |
||
51 | protected $permissionRegistry; |
||
52 | |||
53 | /** |
||
54 | * @var Samshal\Acl\Registry\RegistryInterface $globalRegistry |
||
55 | */ |
||
56 | public $globalRegistry; |
||
57 | |||
58 | /** |
||
59 | * @var string[] $sesion |
||
60 | */ |
||
61 | protected $session = []; |
||
62 | |||
63 | /** |
||
64 | * @var string SYN_ALLOW |
||
65 | */ |
||
66 | const SYN_ALLOW = "can"; |
||
67 | |||
68 | /** |
||
69 | * @var string SYN_DENY |
||
70 | */ |
||
71 | const SYN_DENY = "cannot"; |
||
72 | |||
73 | /** |
||
74 | * Performs bootstrapping |
||
75 | */ |
||
76 | public function __construct() |
||
81 | |||
82 | /** |
||
83 | * Initalizes the registries |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | protected function initRegistries() |
||
94 | |||
95 | /** |
||
96 | * Initializes the global session array and sets them to the default value |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | protected function initSession() |
||
105 | |||
106 | /** |
||
107 | * Listen for and intercept properties that're not set |
||
108 | * |
||
109 | * @param string $role; |
||
110 | * @throws \Exception |
||
111 | * @return AclInterface |
||
112 | */ |
||
113 | public function __get(string $role) : AclInterface |
||
140 | |||
141 | /** |
||
142 | * Listen for and intercept undefined methods |
||
143 | * |
||
144 | * @param string $permission |
||
145 | * @param string[] $args |
||
146 | * @throws \Exception |
||
147 | * @return boolean|null |
||
148 | */ |
||
149 | public function __call(string $permission, array $args) |
||
205 | |||
206 | /** |
||
207 | * Add a new role object to the registry |
||
208 | * |
||
209 | * @param string[] $role |
||
210 | * @return void |
||
211 | */ |
||
212 | public function addRole(string ...$role) |
||
219 | |||
220 | /** |
||
221 | * Add a new resource object to the registry |
||
222 | * |
||
223 | * @param string[] $resource |
||
224 | * @return void |
||
225 | */ |
||
226 | public function addResource(string ...$resource) |
||
233 | |||
234 | /** |
||
235 | * Add a new permission object to the registry |
||
236 | * |
||
237 | * @param string[] $permission |
||
238 | * @return void |
||
239 | */ |
||
240 | public function addPermission(string ...$permission) |
||
247 | |||
248 | /** |
||
249 | * Adds objects lazily. |
||
250 | * |
||
251 | * Automatically determine the type of an object and call the appropriate |
||
252 | * add method on it. |
||
253 | * |
||
254 | * @param ObjectInterface[] $objects |
||
255 | * @throws \Exception |
||
256 | * @return void |
||
257 | */ |
||
258 | public function add(ObjectInterface ...$objects) |
||
285 | |||
286 | /** |
||
287 | * Change the status option of an assigned permission to true |
||
288 | * |
||
289 | * @param string $role; |
||
290 | * @param string $permission |
||
291 | * @param string $resource |
||
292 | * @param boolean $status Optional |
||
293 | * @throws \Exception |
||
294 | * @return void |
||
295 | */ |
||
296 | public function allow(string $role, string $permission, string $resource, bool $status=null) |
||
328 | |||
329 | /** |
||
330 | * Change the status option of an assigned permission to false |
||
331 | * |
||
332 | * @param string $role; |
||
333 | * @param string $permission |
||
334 | * @param string $resource |
||
335 | * @return void |
||
336 | */ |
||
337 | public function deny(string $role, string $permission, string $resource) |
||
341 | |||
342 | /** |
||
343 | * Retrieve the status of a permission assigned to a role |
||
344 | * |
||
345 | * @param string $role; |
||
346 | * @param string $permission |
||
347 | * @param string $resource |
||
348 | * @return boolean |
||
349 | */ |
||
350 | public function getPermissionStatus(string $role, string $permission, string $resource) : bool |
||
384 | } |
||
385 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..