Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like RoleService often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use RoleService, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
43 | class RoleService implements APIRoleService, Sessionable |
||
44 | { |
||
45 | /** |
||
46 | * @var \eZ\Publish\Core\REST\Client\UserService |
||
47 | */ |
||
48 | private $userService; |
||
49 | |||
50 | /** |
||
51 | * @var \eZ\Publish\Core\REST\Client\HttpClient |
||
52 | */ |
||
53 | private $client; |
||
54 | |||
55 | /** |
||
56 | * @var \eZ\Publish\Core\REST\Common\Input\Dispatcher |
||
57 | */ |
||
58 | private $inputDispatcher; |
||
59 | |||
60 | /** |
||
61 | * @var \eZ\Publish\Core\REST\Common\Output\Visitor |
||
62 | */ |
||
63 | private $outputVisitor; |
||
64 | |||
65 | /** |
||
66 | * @var \eZ\Publish\Core\REST\Common\RequestParser |
||
67 | */ |
||
68 | private $requestParser; |
||
69 | |||
70 | /** |
||
71 | * @param \eZ\Publish\Core\REST\Client\UserService $userService |
||
72 | * @param \eZ\Publish\Core\REST\Client\HttpClient $client |
||
73 | * @param \eZ\Publish\Core\REST\Common\Input\Dispatcher $inputDispatcher |
||
74 | * @param \eZ\Publish\Core\REST\Common\Output\Visitor $outputVisitor |
||
75 | * @param \eZ\Publish\Core\REST\Common\RequestParser $requestParser |
||
76 | */ |
||
77 | View Code Duplication | public function __construct(UserService $userService, HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser) |
|
85 | |||
86 | /** |
||
87 | * Set session ID. |
||
88 | * |
||
89 | * Only for testing |
||
90 | * |
||
91 | * @param mixed $id |
||
92 | * |
||
93 | * @private |
||
94 | */ |
||
95 | public function setSession($id) |
||
101 | |||
102 | /** |
||
103 | * Creates a new RoleDraft for existing Role. |
||
104 | * |
||
105 | * @since 6.0 |
||
106 | * |
||
107 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a role |
||
108 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the Role already has a Role Draft that will need to be removed first |
||
109 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a policy limitation in the $roleCreateStruct is not valid |
||
110 | * |
||
111 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
112 | * |
||
113 | * @return \eZ\Publish\API\Repository\Values\User\RoleDraft |
||
114 | */ |
||
115 | public function createRoleDraft(APIRole $role) |
||
119 | |||
120 | /** |
||
121 | * Loads a role for the given id. |
||
122 | * |
||
123 | * @since 6.0 |
||
124 | * |
||
125 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role |
||
126 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a role with the given id was not found |
||
127 | * |
||
128 | * @param mixed $id |
||
129 | * |
||
130 | * @return \eZ\Publish\API\Repository\Values\User\RoleDraft |
||
131 | */ |
||
132 | public function loadRoleDraft($id) |
||
136 | |||
137 | /** |
||
138 | * Loads a RoleDraft by the ID of the role it was created from. |
||
139 | * |
||
140 | * @param mixed $roleId ID of the role the draft was created from. |
||
141 | * |
||
142 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role |
||
143 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a RoleDraft with the given id was not found |
||
144 | * |
||
145 | * @return \eZ\Publish\API\Repository\Values\User\RoleDraft |
||
146 | */ |
||
147 | public function loadRoleDraftByRoleId($roleId) |
||
151 | |||
152 | /** |
||
153 | * Updates the properties of a role draft. |
||
154 | * |
||
155 | * @since 6.0 |
||
156 | * |
||
157 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a role |
||
158 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the identifier of the role already exists |
||
159 | * |
||
160 | * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft |
||
161 | * @param \eZ\Publish\API\Repository\Values\User\RoleUpdateStruct $roleUpdateStruct |
||
162 | * |
||
163 | * @return \eZ\Publish\API\Repository\Values\User\RoleDraft |
||
164 | */ |
||
165 | public function updateRoleDraft(APIRoleDraft $roleDraft, RoleUpdateStruct $roleUpdateStruct) |
||
169 | |||
170 | /** |
||
171 | * Adds a new policy to the role draft. |
||
172 | * |
||
173 | * @since 6.0 |
||
174 | * |
||
175 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to add a policy |
||
176 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy create |
||
177 | * struct or if limitation is not allowed on module/function |
||
178 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyCreateStruct is not valid |
||
179 | * |
||
180 | * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft |
||
181 | * @param \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct $policyCreateStruct |
||
182 | * |
||
183 | * @return \eZ\Publish\API\Repository\Values\User\RoleDraft |
||
184 | */ |
||
185 | public function addPolicyByRoleDraft(APIRoleDraft $roleDraft, APIPolicyCreateStruct $policyCreateStruct) |
||
189 | |||
190 | /** |
||
191 | * Removes a policy from a role draft. |
||
192 | * |
||
193 | * @since 6.0 |
||
194 | * |
||
195 | * |
||
196 | * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft |
||
197 | * @param PolicyDraft $policyDraft the policy to remove from the role |
||
198 | * @return APIRoleDraft if the authenticated user is not allowed to remove a policy |
||
199 | */ |
||
200 | public function removePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policyDraft) |
||
204 | |||
205 | /** |
||
206 | * Updates the limitations of a policy. The module and function cannot be changed and |
||
207 | * the limitations are replaced by the ones in $roleUpdateStruct. |
||
208 | * |
||
209 | * @since 6.0 |
||
210 | * |
||
211 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a policy |
||
212 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy update |
||
213 | * struct or if limitation is not allowed on module/function |
||
214 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyUpdateStruct is not valid |
||
215 | * |
||
216 | * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft |
||
217 | * @param \eZ\Publish\API\Repository\Values\User\PolicyDraft $policy |
||
218 | * @param \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct $policyUpdateStruct |
||
219 | * |
||
220 | * @return \eZ\Publish\API\Repository\Values\User\PolicyDraft |
||
221 | */ |
||
222 | public function updatePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policy, APIPolicyUpdateStruct $policyUpdateStruct) |
||
226 | |||
227 | /** |
||
228 | * Deletes the given role. |
||
229 | * |
||
230 | * @since 6.0 |
||
231 | * |
||
232 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete this role |
||
233 | * |
||
234 | * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft |
||
235 | */ |
||
236 | public function deleteRoleDraft(APIRoleDraft $roleDraft) |
||
240 | |||
241 | /** |
||
242 | * Publishes a given Role draft. |
||
243 | * |
||
244 | * @since 6.0 |
||
245 | * |
||
246 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete this role |
||
247 | * |
||
248 | * @param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft |
||
249 | */ |
||
250 | public function publishRoleDraft(APIRoleDraft $roleDraft) |
||
254 | |||
255 | /** |
||
256 | * Creates a new Role draft. |
||
257 | * |
||
258 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a role |
||
259 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the name of the role already exists or if limitation of the |
||
260 | * same type is repeated in the policy create struct or if |
||
261 | * limitation is not allowed on module/function |
||
262 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a policy limitation in the $roleCreateStruct is not valid |
||
263 | * |
||
264 | * @param \eZ\Publish\API\Repository\Values\User\RoleCreateStruct $roleCreateStruct |
||
265 | * |
||
266 | * @return \eZ\Publish\API\Repository\Values\User\RoleDraft |
||
267 | */ |
||
268 | public function createRole(APIRoleCreateStruct $roleCreateStruct) |
||
315 | |||
316 | /** |
||
317 | * Updates the name of the role. |
||
318 | * |
||
319 | * @deprecated since 6.0, use {@see updateRoleDraft} |
||
320 | * |
||
321 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a role |
||
322 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the name of the role already exists |
||
323 | * |
||
324 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
325 | * @param \eZ\Publish\API\Repository\Values\User\RoleUpdateStruct $roleUpdateStruct |
||
326 | * |
||
327 | * @return \eZ\Publish\API\Repository\Values\User\Role |
||
328 | */ |
||
329 | public function updateRole(APIRole $role, RoleUpdateStruct $roleUpdateStruct) |
||
343 | |||
344 | /** |
||
345 | * Adds a new policy to the role. |
||
346 | * |
||
347 | * @deprecated since 6.0, use {@see addPolicyByRoleDraft} |
||
348 | * |
||
349 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to add a policy |
||
350 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy create |
||
351 | * struct or if limitation is not allowed on module/function |
||
352 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyCreateStruct is not valid |
||
353 | * |
||
354 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
355 | * @param \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct $policyCreateStruct |
||
356 | * |
||
357 | * @return \eZ\Publish\API\Repository\Values\User\Role |
||
358 | */ |
||
359 | public function addPolicy(APIRole $role, APIPolicyCreateStruct $policyCreateStruct) |
||
394 | |||
395 | /** |
||
396 | * Removes a policy from the role. |
||
397 | * |
||
398 | * @deprecated since 5.3, use {@link removePolicyByRoleDraft()} instead. |
||
399 | * |
||
400 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a policy |
||
401 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if policy does not belong to the given role |
||
402 | * |
||
403 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
404 | * @param \eZ\Publish\API\Repository\Values\User\Policy $policy the policy to remove from the role |
||
405 | * |
||
406 | * @return \eZ\Publish\API\Repository\Values\User\Role the updated role |
||
407 | */ |
||
408 | public function removePolicy(APIRole $role, APIPolicy $policy) |
||
435 | |||
436 | /** |
||
437 | * Deletes a policy. |
||
438 | * |
||
439 | * @deprecated since 6.0, use {@link removePolicyByRoleDraft()} instead. |
||
440 | * |
||
441 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a policy |
||
442 | * |
||
443 | * @param \eZ\Publish\API\Repository\Values\User\Policy $policy the policy to delete |
||
444 | */ |
||
445 | public function deletePolicy(APIPolicy $policy) |
||
449 | |||
450 | /** |
||
451 | * Updates the limitations of a policy. The module and function cannot be changed and |
||
452 | * the limitations are replaced by the ones in $roleUpdateStruct. |
||
453 | * |
||
454 | * @deprecated since 6.0, use {@link updatePolicyByRoleDraft()} instead. |
||
455 | * |
||
456 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to update a policy |
||
457 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if limitation of the same type is repeated in policy update |
||
458 | * struct or if limitation is not allowed on module/function |
||
459 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if a limitation in the $policyUpdateStruct is not valid |
||
460 | * |
||
461 | * @param \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct $policyUpdateStruct |
||
462 | * @param \eZ\Publish\API\Repository\Values\User\Policy $policy |
||
463 | * |
||
464 | * @return \eZ\Publish\API\Repository\Values\User\Policy |
||
465 | */ |
||
466 | public function updatePolicy(APIPolicy $policy, APIPolicyUpdateStruct $policyUpdateStruct) |
||
487 | |||
488 | /** |
||
489 | * Loads a role for the given id. |
||
490 | * |
||
491 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role |
||
492 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a role with the given name was not found |
||
493 | * |
||
494 | * @param mixed $id |
||
495 | * |
||
496 | * @return \eZ\Publish\API\Repository\Values\User\Role |
||
497 | */ |
||
498 | public function loadRole($id) |
||
528 | |||
529 | /** |
||
530 | * Loads a role for the given name. |
||
531 | * |
||
532 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role |
||
533 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a role with the given name was not found |
||
534 | * |
||
535 | * @param string $name |
||
536 | * |
||
537 | * @return \eZ\Publish\API\Repository\Values\User\Role |
||
538 | */ |
||
539 | public function loadRoleByIdentifier($name) |
||
540 | { |
||
541 | $response = $this->client->request( |
||
542 | 'GET', |
||
543 | $this->requestParser->generate('roleByIdentifier', array('role' => $name)), |
||
544 | new Message( |
||
545 | array('Accept' => $this->outputVisitor->getMediaType('RoleList')) |
||
546 | ) |
||
547 | ); |
||
548 | |||
549 | $result = $this->inputDispatcher->parse($response); |
||
550 | |||
551 | return reset($result); |
||
552 | } |
||
553 | |||
554 | /** |
||
555 | * Loads all roles. |
||
556 | * |
||
557 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read the roles |
||
558 | * |
||
559 | * @return \eZ\Publish\API\Repository\Values\User\Role[] |
||
560 | */ |
||
561 | View Code Duplication | public function loadRoles() |
|
573 | |||
574 | /** |
||
575 | * Deletes the given role. |
||
576 | * |
||
577 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete this role |
||
578 | * |
||
579 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
580 | */ |
||
581 | View Code Duplication | public function deleteRole(APIRole $role) |
|
599 | |||
600 | /** |
||
601 | * Loads all policies from roles which are assigned to a user or to user groups to which the user belongs. |
||
602 | * |
||
603 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given id was not found |
||
604 | * |
||
605 | * @param mixed $userId |
||
606 | * |
||
607 | * @return \eZ\Publish\API\Repository\Values\User\Policy[] |
||
608 | */ |
||
609 | View Code Duplication | public function loadPoliciesByUserId($userId) |
|
622 | |||
623 | /** |
||
624 | * Assigns a role to the given user group. |
||
625 | * |
||
626 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to assign a role |
||
627 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if $roleLimitation is not valid |
||
628 | * |
||
629 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
630 | * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup |
||
631 | * @param \eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation $roleLimitation an optional role limitation (which is either a subtree limitation or section limitation) |
||
632 | */ |
||
633 | View Code Duplication | public function assignRoleToUserGroup(APIRole $role, UserGroup $userGroup, RoleLimitation $roleLimitation = null) |
|
653 | |||
654 | /** |
||
655 | * removes a role from the given user group. |
||
656 | * |
||
657 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role |
||
658 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the role is not assigned to the given user group |
||
659 | * |
||
660 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
661 | * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup |
||
662 | */ |
||
663 | View Code Duplication | public function unassignRoleFromUserGroup(APIRole $role, UserGroup $userGroup) |
|
687 | |||
688 | /** |
||
689 | * Assigns a role to the given user. |
||
690 | * |
||
691 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to assign a role |
||
692 | * @throws \eZ\Publish\API\Repository\Exceptions\LimitationValidationException if $roleLimitation is not valid |
||
693 | * |
||
694 | * @todo add limitations |
||
695 | * |
||
696 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
697 | * @param \eZ\Publish\API\Repository\Values\User\User $user |
||
698 | * @param \eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation $roleLimitation an optional role limitation (which is either a subtree limitation or section limitation) |
||
699 | */ |
||
700 | View Code Duplication | public function assignRoleToUser(APIRole $role, User $user, RoleLimitation $roleLimitation = null) |
|
720 | |||
721 | /** |
||
722 | * removes a role from the given user. |
||
723 | * |
||
724 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role |
||
725 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the role is not assigned to the user |
||
726 | * |
||
727 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
728 | * @param \eZ\Publish\API\Repository\Values\User\User $user |
||
729 | */ |
||
730 | View Code Duplication | public function unassignRoleFromUser(APIRole $role, User $user) |
|
754 | |||
755 | /** |
||
756 | * Removes the given role assignment. |
||
757 | * |
||
758 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role assignment |
||
759 | * |
||
760 | * @param \eZ\Publish\API\Repository\Values\User\RoleAssignment $roleAssignment |
||
761 | */ |
||
762 | public function removeRoleAssignment(APIRoleAssignment $roleAssignment) |
||
766 | |||
767 | /** |
||
768 | * Loads a user assignment for the given id. |
||
769 | * |
||
770 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role |
||
771 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the role assignment was not found |
||
772 | * |
||
773 | * @param mixed $roleAssignmentId |
||
774 | * |
||
775 | * @return \eZ\Publish\API\Repository\Values\User\RoleAssignment |
||
776 | */ |
||
777 | public function loadRoleAssignment($roleAssignmentId) |
||
781 | |||
782 | /** |
||
783 | * Returns the assigned user and user groups to this role. |
||
784 | * |
||
785 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a role |
||
786 | * |
||
787 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
788 | * |
||
789 | * @return \eZ\Publish\API\Repository\Values\User\RoleAssignment[] |
||
790 | */ |
||
791 | public function getRoleAssignments(APIRole $role) |
||
795 | |||
796 | /** |
||
797 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() |
||
798 | */ |
||
799 | View Code Duplication | public function getRoleAssignmentsForUser(User $user, $inherited = false) |
|
824 | |||
825 | /** |
||
826 | * Returns the roles assigned to the given user group. |
||
827 | * |
||
828 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read a user group |
||
829 | * |
||
830 | * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup |
||
831 | * |
||
832 | * @return \eZ\Publish\API\Repository\Values\User\UserGroupRoleAssignment[] |
||
833 | */ |
||
834 | View Code Duplication | public function getRoleAssignmentsForUserGroup(UserGroup $userGroup) |
|
859 | |||
860 | /** |
||
861 | * Instantiates a role create class. |
||
862 | * |
||
863 | * @param string $name |
||
864 | * |
||
865 | * @return \eZ\Publish\API\Repository\Values\User\RoleCreateStruct |
||
866 | */ |
||
867 | public function newRoleCreateStruct($name) |
||
871 | |||
872 | /** |
||
873 | * Instantiates a policy create class. |
||
874 | * |
||
875 | * @param string $module |
||
876 | * @param string $function |
||
877 | * |
||
878 | * @return \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct |
||
879 | */ |
||
880 | public function newPolicyCreateStruct($module, $function) |
||
884 | |||
885 | /** |
||
886 | * Instantiates a policy update class. |
||
887 | * |
||
888 | * @return \eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct |
||
889 | */ |
||
890 | public function newPolicyUpdateStruct() |
||
894 | |||
895 | /** |
||
896 | * Instantiates a policy update class. |
||
897 | * |
||
898 | * @return \eZ\Publish\API\Repository\Values\User\RoleUpdateStruct |
||
899 | */ |
||
900 | public function newRoleUpdateStruct() |
||
904 | |||
905 | /** |
||
906 | * Returns the LimitationType registered with the given identifier. |
||
907 | * |
||
908 | * @param string $identifier |
||
909 | * |
||
910 | * @return \eZ\Publish\SPI\Limitation\Type |
||
911 | * |
||
912 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if there is no LimitationType with $identifier |
||
913 | */ |
||
914 | public function getLimitationType($identifier) |
||
918 | |||
919 | /** |
||
920 | * Returns the LimitationType's assigned to a given module/function. |
||
921 | * |
||
922 | * Typically used for: |
||
923 | * - Internal validation limitation value use on Policies |
||
924 | * - Role admin gui for editing policy limitations incl list limitation options via valueSchema() |
||
925 | * |
||
926 | * @param string $module Legacy name of "controller", it's a unique identifier like "content" |
||
927 | * @param string $function Legacy name of a controller "action", it's a unique within the controller like "read" |
||
928 | * |
||
929 | * @return \eZ\Publish\SPI\Limitation\Type[] |
||
930 | * |
||
931 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If module/function to limitation type mapping |
||
932 | * refers to a non existing identifier. |
||
933 | */ |
||
934 | public function getLimitationTypesByModuleFunction($module, $function) |
||
938 | } |
||
939 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.