| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 7 | public function getAccessibleSubQuery(?User $user): string |
|
| 21 | { |
||
| 22 | 7 | if (!$user) { |
|
| 23 | 1 | return '-1'; |
|
| 24 | } |
||
| 25 | |||
| 26 | 6 | if (in_array($user->getRole(), [User::ROLE_RESPONSIBLE, User::ROLE_ADMINISTRATOR], true)) { |
|
| 27 | 3 | return $this->getAllIdsQuery(); |
|
| 28 | } |
||
| 29 | |||
| 30 | return 'SELECT transaction_line.id FROM transaction_line |
||
| 31 | JOIN account ON transaction_line.debit_id = account.id OR transaction_line.credit_id = account.id |
||
| 32 | 3 | WHERE account.owner_id = ' . $user->getId(); |
|
| 33 | } |
||
| 49 |