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