1 | <?php |
||
8 | final class Acl extends ZendAcl |
||
9 | { |
||
10 | /** |
||
11 | * @var string privilege to make POST request to the specified resource |
||
12 | */ |
||
13 | const PRIVILEGE_POST = 'post'; |
||
14 | |||
15 | /** |
||
16 | * @var string privilege to mekt GET request to the specified resource |
||
17 | */ |
||
18 | const PRIVILEGE_GET = 'get'; |
||
19 | |||
20 | /** |
||
21 | * @var string guard can be applied to resources |
||
22 | */ |
||
23 | const GUARD_TYPE_RESOURCE = 'resources'; |
||
24 | |||
25 | /** |
||
26 | * @var string guard can be applied to routes |
||
27 | */ |
||
28 | const GUARD_TYPE_ROUTE = 'routes'; |
||
29 | |||
30 | /** |
||
31 | * @var guard can be applied to callables |
||
32 | */ |
||
33 | const GUARD_TYPE_CALLABLE = 'callables'; |
||
34 | |||
35 | /** |
||
36 | * Acl constructor. |
||
37 | * |
||
38 | * @param $configuration ACL configuration - see app settings ACL section |
||
39 | * @throws \Exception |
||
40 | */ |
||
41 | public function __construct($configuration) |
||
73 | |||
74 | /** |
||
75 | * Verify guard rule correctness |
||
76 | * |
||
77 | * @param $guardType |
||
78 | * @param array $rule |
||
79 | * @return bool |
||
80 | * @throws \Exception |
||
81 | */ |
||
82 | protected function verifyRule($guardType, array $rule) |
||
116 | |||
117 | /** |
||
118 | * Parse rule description into separate parts |
||
119 | * |
||
120 | * @param $guardType |
||
121 | * @param $rule |
||
122 | * @return array |
||
123 | */ |
||
124 | protected function parseRule($guardType, $rule) |
||
139 | |||
140 | /** |
||
141 | * Build name of the resource based on guard type |
||
142 | * |
||
143 | * @param $guardType guard type |
||
144 | * @param $base base part of the resource name to be built |
||
145 | * @return string ready resource name |
||
146 | * @throws \Exception |
||
147 | */ |
||
148 | public static function buildResourceName($guardType, $base) |
||
161 | |||
162 | /** |
||
163 | * Get one of PRIVILEGE_XXX constants based on HTTP method - GET, POST, PUT, etc |
||
164 | * |
||
165 | * @param $method HTTP method GET, POST, PUT, etc |
||
166 | * @return null|string |
||
167 | */ |
||
168 | public static function getPrivilegeByHTTPMethod($method) |
||
180 | } |
||
181 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.