mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Refactor findNull to find
This commit is contained in:
@@ -71,14 +71,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
*
|
||||
* @return PiggyBank|null
|
||||
*/
|
||||
public function findNull(int $piggyBankId): ?PiggyBank
|
||||
public function find(int $piggyBankId): ?PiggyBank
|
||||
{
|
||||
$piggyBank = $this->user->piggyBanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
|
||||
if (null !== $piggyBank) {
|
||||
return $piggyBank;
|
||||
}
|
||||
|
||||
return null;
|
||||
$piggyBank = $this->user->piggyBanks()->find($piggyBankId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +87,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
Log::debug('Searching for piggy information.');
|
||||
|
||||
if (null !== $piggyBankId) {
|
||||
$searchResult = $this->findNull((int)$piggyBankId);
|
||||
$searchResult = $this->find((int)$piggyBankId);
|
||||
if (null !== $searchResult) {
|
||||
Log::debug(sprintf('Found piggy based on #%d, will return it.', $piggyBankId));
|
||||
|
||||
|
@@ -115,7 +115,7 @@ interface PiggyBankRepositoryInterface
|
||||
*
|
||||
* @return PiggyBank|null
|
||||
*/
|
||||
public function findNull(int $piggyBankId): ?PiggyBank;
|
||||
public function find(int $piggyBankId): ?PiggyBank;
|
||||
|
||||
/**
|
||||
* @param int|null $piggyBankId
|
||||
|
Reference in New Issue
Block a user