Total Complexity | 4 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Coverage | 85.71% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class IsMyself implements NamedAssertion |
||
13 | { |
||
14 | /** |
||
15 | * Assert that the user is the current user himself. |
||
16 | * |
||
17 | * @param \Ecodev\Felix\Acl\Acl $acl |
||
18 | * @param RoleInterface $role |
||
19 | * @param ResourceInterface $resource |
||
20 | * @param string $privilege |
||
21 | * |
||
22 | * @return bool |
||
23 | */ |
||
24 | 2 | public function assert(Acl $acl, ?RoleInterface $role = null, ?ResourceInterface $resource = null, $privilege = null) |
|
25 | { |
||
26 | 2 | $user = $resource->getInstance(); |
|
27 | |||
28 | 2 | if (CurrentUser::get() && CurrentUser::get() === $user) { |
|
29 | return true; |
||
30 | } |
||
31 | |||
32 | 2 | return $acl->reject('it is not himself'); |
|
33 | } |
||
34 | |||
35 | 2 | public function getName(): string |
|
38 | } |
||
39 | } |
||
40 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.