-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: SebastianKrupinski <[email protected]>
- Loading branch information
1 parent
83d3a08
commit 28c198e
Showing
4 changed files
with
63 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,8 +87,6 @@ public function findById(int $id): Account { | |
* @param string $address mail address (e.g. [email protected]) | ||
* | ||
* @return Account[] | ||
* | ||
* @throws ClientException | ||
*/ | ||
public function findByUserIdAndAddress(string $userId, string $address): array { | ||
// evaluate if cached accounts collection already exists | ||
|
@@ -101,21 +99,12 @@ public function findByUserIdAndAddress(string $userId, string $address): array { | |
$list[] = $account; | ||
} | ||
} | ||
// evaluate if any accounts where found and return them | ||
if (count($list) > 0) { | ||
return $list; | ||
} | ||
// if no accounts where found thrown an error | ||
throw new ClientException("Account with address $address does not exist or you don\'t have permission to access it"); | ||
return $list; | ||
} | ||
// if cached accounts collection did not exist retrieve account details directly from the data store | ||
try { | ||
return array_map(static function ($a) { | ||
return new Account($a); | ||
}, $this->mapper->findByUserIdAndAddress($userId, $address)); | ||
} catch (DoesNotExistException $e) { | ||
throw new ClientException("Account with address $address does not exist or you don\'t have permission to access it"); | ||
} | ||
return array_map(static function ($a) { | ||
return new Account($a); | ||
}, $this->mapper->findByUserIdAndAddress($userId, $address)); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters