| 1 | <?php |
||
| 22 | class UserHelper { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Determines if the connected user entity has role $roles. |
||
| 26 | * |
||
| 27 | * @param object $user The user. |
||
| 28 | * @param string|array $roles The role or roles. |
||
| 29 | * @param boolean $or OR ? If true, matches a role cause a break and the method returns true. |
||
| 30 | * @return boolean Returns true in case of success, false otherwise. |
||
| 31 | */ |
||
| 32 | public function hasRoles($user, $roles, $or = true) { |
||
| 58 | |||
| 59 | } |
||
| 60 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.