Conditions | 3 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function hasAccess(User $user = null) |
||
29 | { |
||
30 | // if not in parameters, take from the request object {$this} |
||
31 | $user = $user ? : $this->user(); |
||
32 | |||
33 | $hasAccess = array_merge( |
||
34 | $this->hasAnyPermissionAccess($user), |
||
35 | $this->hasAnyRoleAccess($user) |
||
36 | ); |
||
37 | |||
38 | // allow access if user has access to any of the defined roles or permissions. |
||
39 | return empty($hasAccess) ? true : in_array(true, $hasAccess); |
||
40 | } |
||
41 | |||
54 |
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.