mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code reordering and reformatting. I should really start employing style CI.
This commit is contained in:
@@ -96,7 +96,7 @@ trait JournalServiceTrait
|
||||
$search = null;
|
||||
// first attempt, find by ID.
|
||||
if (null !== $data['id']) {
|
||||
$search = $this->accountRepository->find((int) $data['id']);
|
||||
$search = $this->accountRepository->find((int)$data['id']);
|
||||
if (null !== $search && in_array($search->accountType->type, $types, true)) {
|
||||
Log::debug(
|
||||
sprintf('Found "account_id" object: #%d, "%s" of type %s', $search->id, $search->name, $search->accountType->type)
|
||||
@@ -174,10 +174,10 @@ trait JournalServiceTrait
|
||||
if (null === $account && null !== $data['number']) {
|
||||
Log::debug(sprintf('Searching for account number "%s".', $data['number']));
|
||||
// find by preferred type.
|
||||
$source = $this->accountRepository->findByAccountNumber((string) $data['number'], [$types[0]]);
|
||||
$source = $this->accountRepository->findByAccountNumber((string)$data['number'], [$types[0]]);
|
||||
|
||||
// or any expected type.
|
||||
$source = $source ?? $this->accountRepository->findByAccountNumber((string) $data['number'], $types);
|
||||
$source = $source ?? $this->accountRepository->findByAccountNumber((string)$data['number'], $types);
|
||||
|
||||
if (null !== $source) {
|
||||
Log::debug(sprintf('Found account: #%d, %s', $source->id, $source->name));
|
||||
@@ -214,7 +214,7 @@ trait JournalServiceTrait
|
||||
|
||||
// final attempt, create it.
|
||||
if (AccountType::ASSET === $preferredType) {
|
||||
throw new FireflyException(sprintf('TransactionFactory: Cannot create asset account with these values: %s',json_encode($data)));
|
||||
throw new FireflyException(sprintf('TransactionFactory: Cannot create asset account with these values: %s', json_encode($data)));
|
||||
}
|
||||
// fix name of account if only IBAN is given:
|
||||
if ('' === (string)$data['name'] && '' !== (string)$data['iban']) {
|
||||
@@ -227,7 +227,7 @@ trait JournalServiceTrait
|
||||
$data['name'] = $data['number'];
|
||||
}
|
||||
// if name is still NULL, return NULL.
|
||||
if(null === $data['name']) {
|
||||
if (null === $data['name']) {
|
||||
return null;
|
||||
}
|
||||
$data['name'] = $data['name'] ?? '(no name)';
|
||||
|
Reference in New Issue
Block a user