Total Complexity | 9 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | trait AclListQueryTrait { |
||
12 | |||
13 | abstract public function getRoleByName(string $name); |
||
14 | |||
15 | abstract public function getResourceByName(string $name); |
||
16 | |||
17 | abstract public function getPermissionByName(string $name); |
||
18 | |||
19 | public function getAclsWithRole(string $role) { |
||
20 | $result = []; |
||
21 | foreach ($this->acls as $acl) { |
||
22 | if ($acl->getRole()->getName() === $role) { |
||
23 | $result[] = $acl; |
||
24 | } |
||
25 | } |
||
26 | return $result; |
||
27 | } |
||
28 | |||
29 | public function getAclsWithResource(string $resource) { |
||
30 | $result = []; |
||
31 | foreach ($this->acls as $acl) { |
||
32 | if ($acl->getResource()->getName() === $resource) { |
||
33 | $result[] = $acl; |
||
34 | } |
||
35 | } |
||
36 | return $result; |
||
37 | } |
||
38 | |||
39 | public function getAclsWithPermission(string $permission) { |
||
47 | } |
||
48 | } |
||
49 | |||
50 |