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) |
||
196 | |||
197 | /** |
||
198 | * Add a new role object to the registry |
||
199 | * |
||
200 | * @param string[] $role |
||
201 | * @return void |
||
202 | */ |
||
203 | public function addRole(string ...$role) |
||
210 | |||
211 | /** |
||
212 | * Add a new resource object to the registry |
||
213 | * |
||
214 | * @param string[] $resource |
||
215 | * @return void |
||
216 | */ |
||
217 | public function addResource(string ...$resource) |
||
224 | |||
225 | /** |
||
226 | * Add a new permission object to the registry |
||
227 | * |
||
228 | * @param string[] $permission |
||
229 | * @return void |
||
230 | */ |
||
231 | public function addPermission(string ...$permission) |
||
238 | |||
239 | /** |
||
240 | * Adds objects lazily. |
||
241 | * |
||
242 | * Automatically determine the type of an object and call the appropriate |
||
243 | * add method on it. |
||
244 | * |
||
245 | * @param ObjectInterface[] $objects |
||
246 | * @throws \Exception |
||
247 | * @return void |
||
248 | */ |
||
249 | public function add(ObjectInterface ...$objects) |
||
276 | |||
277 | /** |
||
278 | * Change the status option of an assigned permission to true |
||
279 | * |
||
280 | * @param string $role; |
||
281 | * @param string $permission |
||
282 | * @param string $resource |
||
283 | * @param boolean $status Optional |
||
284 | * @throws \Exception |
||
285 | * @return void |
||
286 | */ |
||
287 | public function allow(string $role, string $permission, string $resource, bool $status=null) |
||
319 | |||
320 | /** |
||
321 | * Change the status option of an assigned permission to false |
||
322 | * |
||
323 | * @param string $role; |
||
324 | * @param string $permission |
||
325 | * @param string $resource |
||
326 | * @return void |
||
327 | */ |
||
328 | public function deny(string $role, string $permission, string $resource) |
||
332 | |||
333 | /** |
||
334 | * Retrieve the status of a permission assigned to a role |
||
335 | * |
||
336 | * @param string $role; |
||
337 | * @param string $permission |
||
338 | * @param string $resource |
||
339 | * @return boolean |
||
340 | */ |
||
341 | public function getPermissionStatus(string $role, string $permission, string $resource) : bool |
||
375 | } |
||
376 |
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..