Conditions | 2 |
Paths | 3 |
Total Lines | 8 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
23 | 4 | public function isUserRoleAuthorized(int $userId, array $allowedRoles): bool |
|
24 | { |
||
25 | try { |
||
26 | 4 | $userRole = $this->userRolesRepository->getUserRoles($userId); |
|
27 | 3 | 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 |