mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-25 13:10:35 +00:00
Clean up code.
This commit is contained in:
@@ -164,7 +164,7 @@ trait JournalServiceTrait
|
||||
// find by preferred type.
|
||||
$source = $this->accountRepository->findByIbanNull($data['iban'], [$types[0]]);
|
||||
// or any expected type.
|
||||
$source = $source ?? $this->accountRepository->findByIbanNull($data['iban'], $types);
|
||||
$source ??= $this->accountRepository->findByIbanNull($data['iban'], $types);
|
||||
|
||||
if (null !== $source) {
|
||||
app('log')->debug(sprintf('Found "account_iban" object: #%d, %s', $source->id, $source->name));
|
||||
@@ -196,7 +196,7 @@ trait JournalServiceTrait
|
||||
$source = $this->accountRepository->findByAccountNumber((string)$data['number'], [$types[0]]);
|
||||
|
||||
// or any expected type.
|
||||
$source = $source ?? $this->accountRepository->findByAccountNumber((string)$data['number'], $types);
|
||||
$source ??= $this->accountRepository->findByAccountNumber((string)$data['number'], $types);
|
||||
|
||||
if (null !== $source) {
|
||||
app('log')->debug(sprintf('Found account: #%d, %s', $source->id, $source->name));
|
||||
@@ -230,7 +230,7 @@ trait JournalServiceTrait
|
||||
$source = $this->accountRepository->findByName($data['name'], [$types[0]]);
|
||||
|
||||
// or any expected type.
|
||||
$source = $source ?? $this->accountRepository->findByName($data['name'], $types);
|
||||
$source ??= $this->accountRepository->findByName($data['name'], $types);
|
||||
|
||||
if (null !== $source) {
|
||||
app('log')->debug(sprintf('Found "account_name" object: #%d, %s', $source->id, $source->name));
|
||||
|
||||
@@ -40,7 +40,7 @@ trait LocationServiceTrait
|
||||
*/
|
||||
protected function storeNewLocation(Model $model, array $data): ?Location
|
||||
{
|
||||
$data['store_location'] = $data['store_location'] ?? false;
|
||||
$data['store_location'] ??= false;
|
||||
if ($data['store_location']) {
|
||||
$location = new Location();
|
||||
$location->latitude = $data['latitude'] ?? config('firefly.default_location.latitude');
|
||||
|
||||
@@ -497,9 +497,9 @@ class JournalUpdateService
|
||||
{
|
||||
$type = $this->transactionJournal->transactionType->type;
|
||||
if ((
|
||||
array_key_exists('bill_id', $this->data)
|
||||
array_key_exists('bill_id', $this->data)
|
||||
|| array_key_exists('bill_name', $this->data)
|
||||
)
|
||||
)
|
||||
&& TransactionType::WITHDRAWAL === $type
|
||||
) {
|
||||
$billId = (int)($this->data['bill_id'] ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user