| @@ 76-90 (lines=15) @@ | ||
| 73 | * @param $accountId |
|
| 74 | * @return IAccount |
|
| 75 | */ |
|
| 76 | public function find($currentUserId, $accountId) { |
|
| 77 | if ($this->accounts !== null) { |
|
| 78 | foreach ($this->accounts as $account) { |
|
| 79 | if ($account->getId() === $accountId) { |
|
| 80 | return $account; |
|
| 81 | } |
|
| 82 | } |
|
| 83 | throw new Exception("Invalid account id <$accountId>"); |
|
| 84 | } |
|
| 85 | ||
| 86 | if ((int)$accountId === UnifiedAccount::ID) { |
|
| 87 | return $this->buildUnifiedAccount($currentUserId); |
|
| 88 | } |
|
| 89 | return new Account($this->mapper->find($currentUserId, $accountId)); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @param int $accountId |
|
| @@ 55-69 (lines=15) @@ | ||
| 52 | * @param $accountId |
|
| 53 | * @return IAccount |
|
| 54 | */ |
|
| 55 | public function findAll($currentUserId, $accountId) { |
|
| 56 | if ($this->accounts !== null) { |
|
| 57 | foreach ($this->accounts as $account) { |
|
| 58 | if ($account->getId() === $accountId) { |
|
| 59 | return $account; |
|
| 60 | } |
|
| 61 | } |
|
| 62 | throw new Exception("Invalid account id <$accountId>"); |
|
| 63 | } |
|
| 64 | ||
| 65 | if ((int)$accountId === UnifiedAccount::ID) { |
|
| 66 | return $this->buildUnifiedAccount($currentUserId); |
|
| 67 | } |
|
| 68 | return new Account($this->mapper->find($currentUserId, $accountId)); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * @param int $accountId |
|