| Conditions | 2 |
| Paths | 3 |
| Total Lines | 8 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 5 | public function isUserRoleAuthorized(int $userId, array $allowedRoles): bool |
|
| 24 | { |
||
| 25 | try { |
||
| 26 | 5 | $userRole = $this->userRolesRepository->getUserRoles($userId); |
|
| 27 | 4 | return count(array_intersect((array)$userRole, $allowedRoles)) > 0; |
|
| 28 | 1 | } catch (Exception $exception) { |
|
| 29 | 1 | error_log('Exception occurred: ' . $exception->getMessage()); |
|
| 30 | 1 | return false; |
|
| 31 | } |
||
| 34 |