Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -75,7 +75,7 @@ class AccountUpdateService
// find currency, or use default currency instead.
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
$currency = $this->getCurrency((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null));
$currency = $this->getCurrency((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null));
unset($data['currency_code'], $data['currency_id']);
$data['currency_id'] = $currency->id;
}
@@ -94,7 +94,7 @@ class AccountUpdateService
// update note:
if (array_key_exists('notes', $data) && null !== $data['notes']) {
$this->updateNote($account, (string)$data['notes']);
$this->updateNote($account, (string) $data['notes']);
}
// update preferences if inactive:
@@ -120,7 +120,7 @@ class AccountUpdateService
$account->active = $data['active'];
}
if (array_key_exists('iban', $data)) {
$account->iban = app('steam')->filterSpaces((string)$data['iban']);
$account->iban = app('steam')->filterSpaces((string) $data['iban']);
}
// set liability, but account must already be a liability.
@@ -132,7 +132,7 @@ class AccountUpdateService
// set liability, alternative method used in v1 layout:
if ($this->isLiability($account) && array_key_exists('account_type_id', $data)) {
$type = AccountType::find((int)$data['account_type_id']);
$type = AccountType::find((int) $data['account_type_id']);
if (null !== $type && in_array($type->type, config('firefly.valid_liabilities'), true)) {
$account->account_type_id = $type->id;
@@ -305,9 +305,9 @@ class AccountUpdateService
$removeAccountId = $account->id;
$new = [];
foreach ($array as $value) {
if ((int)$value !== $removeAccountId) {
if ((int) $value !== $removeAccountId) {
app('log')->debug(sprintf('Will include: %d', $value));
$new[] = (int)$value;
$new[] = (int) $value;
}
}
app('log')->debug('Final new array is', $new);