diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php index e9a6cfd232..63efe2f28c 100644 --- a/app/Api/V1/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php @@ -81,7 +81,7 @@ class AccountController extends Controller $date = $data['date'] ?? today(config('app.timezone')); $return = []; - $result = $this->repository->searchAccount((string)$query, $types, $data['limit']); + $result = $this->repository->searchAccount((string) $query, $types, $data['limit']); $defaultCurrency = app('amount')->getDefaultCurrency(); /** @var Account $account */ @@ -95,7 +95,7 @@ class AccountController extends Controller } $return[] = [ - 'id' => (string)$account->id, + 'id' => (string) $account->id, 'name' => $account->name, 'name_with_balance' => $nameWithBalance, 'type' => $account->accountType->type, diff --git a/app/Api/V1/Controllers/Autocomplete/BillController.php b/app/Api/V1/Controllers/Autocomplete/BillController.php index 6033d7f6e3..7b4270b725 100644 --- a/app/Api/V1/Controllers/Autocomplete/BillController.php +++ b/app/Api/V1/Controllers/Autocomplete/BillController.php @@ -70,7 +70,7 @@ class BillController extends Controller $filtered = $result->map( static function (Bill $item) { return [ - 'id' => (string)$item->id, + 'id' => (string) $item->id, 'name' => $item->name, ]; } diff --git a/app/Api/V1/Controllers/Autocomplete/BudgetController.php b/app/Api/V1/Controllers/Autocomplete/BudgetController.php index c1ddc3e638..60d56f7fb0 100644 --- a/app/Api/V1/Controllers/Autocomplete/BudgetController.php +++ b/app/Api/V1/Controllers/Autocomplete/BudgetController.php @@ -70,7 +70,7 @@ class BudgetController extends Controller $filtered = $result->map( static function (Budget $item) { return [ - 'id' => (string)$item->id, + 'id' => (string) $item->id, 'name' => $item->name, ]; } diff --git a/app/Api/V1/Controllers/Autocomplete/CategoryController.php b/app/Api/V1/Controllers/Autocomplete/CategoryController.php index 4bf324f815..3e29a7aa33 100644 --- a/app/Api/V1/Controllers/Autocomplete/CategoryController.php +++ b/app/Api/V1/Controllers/Autocomplete/CategoryController.php @@ -70,7 +70,7 @@ class CategoryController extends Controller $filtered = $result->map( static function (Category $item) { return [ - 'id' => (string)$item->id, + 'id' => (string) $item->id, 'name' => $item->name, ]; } diff --git a/app/Api/V1/Controllers/Autocomplete/CurrencyController.php b/app/Api/V1/Controllers/Autocomplete/CurrencyController.php index 4d1f508d67..e0eef2e62a 100644 --- a/app/Api/V1/Controllers/Autocomplete/CurrencyController.php +++ b/app/Api/V1/Controllers/Autocomplete/CurrencyController.php @@ -72,7 +72,7 @@ class CurrencyController extends Controller /** @var TransactionCurrency $currency */ foreach ($collection as $currency) { $result[] = [ - 'id' => (string)$currency->id, + 'id' => (string) $currency->id, 'name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol, @@ -101,7 +101,7 @@ class CurrencyController extends Controller /** @var TransactionCurrency $currency */ foreach ($collection as $currency) { $result[] = [ - 'id' => (string)$currency->id, + 'id' => (string) $currency->id, 'name' => sprintf('%s (%s)', $currency->name, $currency->code), 'code' => $currency->code, 'symbol' => $currency->symbol, diff --git a/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php b/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php index e4328a62ef..aaab2e1594 100644 --- a/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php +++ b/app/Api/V1/Controllers/Autocomplete/ObjectGroupController.php @@ -72,7 +72,7 @@ class ObjectGroupController extends Controller /** @var ObjectGroup $objectGroup */ foreach ($result as $objectGroup) { $return[] = [ - 'id' => (string)$objectGroup->id, + 'id' => (string) $objectGroup->id, 'name' => $objectGroup->title, 'title' => $objectGroup->title, ]; diff --git a/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php b/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php index 2a903e1318..6efbe495cf 100644 --- a/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php +++ b/app/Api/V1/Controllers/Autocomplete/PiggyBankController.php @@ -78,7 +78,7 @@ class PiggyBankController extends Controller foreach ($piggies as $piggy) { $currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency; $response[] = [ - 'id' => (string)$piggy->id, + 'id' => (string) $piggy->id, 'name' => $piggy->name, 'currency_id' => $currency->id, 'currency_name' => $currency->name, @@ -110,7 +110,7 @@ class PiggyBankController extends Controller $currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency; $currentAmount = $this->piggyRepository->getRepetition($piggy)->currentamount ?? '0'; $response[] = [ - 'id' => (string)$piggy->id, + 'id' => (string) $piggy->id, 'name' => $piggy->name, 'name_with_balance' => sprintf( '%s (%s / %s)', $piggy->name, app('amount')->formatAnything($currency, $currentAmount, false), diff --git a/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php b/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php index aa133d7192..93e6bbd315 100644 --- a/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php +++ b/app/Api/V1/Controllers/Autocomplete/RecurrenceController.php @@ -69,7 +69,7 @@ class RecurrenceController extends Controller /** @var Recurrence $recurrence */ foreach ($recurrences as $recurrence) { $response[] = [ - 'id' => (string)$recurrence->id, + 'id' => (string) $recurrence->id, 'name' => $recurrence->title, 'description' => $recurrence->description, ]; diff --git a/app/Api/V1/Controllers/Autocomplete/RuleController.php b/app/Api/V1/Controllers/Autocomplete/RuleController.php index dadfd66d75..47c24795ea 100644 --- a/app/Api/V1/Controllers/Autocomplete/RuleController.php +++ b/app/Api/V1/Controllers/Autocomplete/RuleController.php @@ -69,7 +69,7 @@ class RuleController extends Controller /** @var Rule $rule */ foreach ($rules as $rule) { $response[] = [ - 'id' => (string)$rule->id, + 'id' => (string) $rule->id, 'name' => $rule->title, 'description' => $rule->description, ]; diff --git a/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php b/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php index a4fc1cf437..d5f88aa3cf 100644 --- a/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php +++ b/app/Api/V1/Controllers/Autocomplete/RuleGroupController.php @@ -69,7 +69,7 @@ class RuleGroupController extends Controller /** @var RuleGroup $group */ foreach ($groups as $group) { $response[] = [ - 'id' => (string)$group->id, + 'id' => (string) $group->id, 'name' => $group->title, 'description' => $group->description, ]; diff --git a/app/Api/V1/Controllers/Autocomplete/TagController.php b/app/Api/V1/Controllers/Autocomplete/TagController.php index 12e3498415..95e031ebf7 100644 --- a/app/Api/V1/Controllers/Autocomplete/TagController.php +++ b/app/Api/V1/Controllers/Autocomplete/TagController.php @@ -72,7 +72,7 @@ class TagController extends Controller /** @var Tag $tag */ foreach ($result as $tag) { $array[] = [ - 'id' => (string)$tag->id, + 'id' => (string) $tag->id, 'name' => $tag->tag, 'tag' => $tag->tag, ]; diff --git a/app/Api/V1/Controllers/Autocomplete/TransactionController.php b/app/Api/V1/Controllers/Autocomplete/TransactionController.php index 923d9d1602..d24902ae89 100644 --- a/app/Api/V1/Controllers/Autocomplete/TransactionController.php +++ b/app/Api/V1/Controllers/Autocomplete/TransactionController.php @@ -80,8 +80,8 @@ class TransactionController extends Controller /** @var TransactionJournal $journal */ foreach ($filtered as $journal) { $array[] = [ - 'id' => (string)$journal->id, - 'transaction_group_id' => (string)$journal->transaction_group_id, + 'id' => (string) $journal->id, + 'transaction_group_id' => (string) $journal->transaction_group_id, 'name' => $journal->description, 'description' => $journal->description, ]; @@ -104,7 +104,7 @@ class TransactionController extends Controller $result = new Collection; if (is_numeric($data['query'])) { // search for group, not journal. - $firstResult = $this->groupRepository->find((int)$data['query']); + $firstResult = $this->groupRepository->find((int) $data['query']); if (null !== $firstResult) { // group may contain multiple journals, each a result: foreach ($firstResult->transactionJournals as $journal) { @@ -122,8 +122,8 @@ class TransactionController extends Controller /** @var TransactionJournal $journal */ foreach ($result as $journal) { $array[] = [ - 'id' => (string)$journal->id, - 'transaction_group_id' => (string)$journal->transaction_group_id, + 'id' => (string) $journal->id, + 'transaction_group_id' => (string) $journal->transaction_group_id, 'name' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description), 'description' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description), ]; diff --git a/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php b/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php index 2318c5fdb3..24d09276f8 100644 --- a/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php +++ b/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php @@ -70,7 +70,7 @@ class TransactionTypeController extends Controller foreach ($types as $type) { // different key for consistency. $array[] = [ - 'id' => (string)$type->id, + 'id' => (string) $type->id, 'name' => $type->type, 'type' => $type->type, ]; diff --git a/app/Api/V1/Controllers/Chart/AccountController.php b/app/Api/V1/Controllers/Chart/AccountController.php index 27a2a07101..251299d787 100644 --- a/app/Api/V1/Controllers/Chart/AccountController.php +++ b/app/Api/V1/Controllers/Chart/AccountController.php @@ -109,7 +109,7 @@ class AccountController extends Controller } $currentSet = [ 'label' => $account->name, - 'currency_id' => (string)$currency->id, + 'currency_id' => (string) $currency->id, 'currency_code' => $currency->code, 'currency_symbol' => $currency->symbol, 'currency_decimal_places' => $currency->decimal_places, @@ -121,11 +121,11 @@ class AccountController extends Controller ]; $currentStart = clone $start; $range = app('steam')->balanceInRange($account, $start, clone $end); - $previous = round((float)array_values($range)[0], 12); + $previous = round((float) array_values($range)[0], 12); while ($currentStart <= $end) { $format = $currentStart->format('Y-m-d'); $label = $currentStart->toAtomString(); - $balance = array_key_exists($format, $range) ? round((float)$range[$format], 12) : $previous; + $balance = array_key_exists($format, $range) ? round((float) $range[$format], 12) : $previous; $previous = $balance; $currentStart->addDay(); $currentSet['entries'][$label] = $balance; diff --git a/app/Api/V1/Controllers/Data/Bulk/AccountController.php b/app/Api/V1/Controllers/Data/Bulk/AccountController.php index a1fa0fa6a5..3d80897e83 100644 --- a/app/Api/V1/Controllers/Data/Bulk/AccountController.php +++ b/app/Api/V1/Controllers/Data/Bulk/AccountController.php @@ -66,8 +66,8 @@ class AccountController extends Controller */ public function moveTransactions(MoveTransactionsRequest $request): JsonResponse { - $accountIds = $request->getAll(); - $original = $this->repository->find($accountIds['original_account']); + $accountIds = $request->getAll(); + $original = $this->repository->find($accountIds['original_account']); $destination = $this->repository->find($accountIds['destination_account']); /** @var AccountDestroyService $service */ diff --git a/app/Api/V1/Controllers/Data/Bulk/TransactionController.php b/app/Api/V1/Controllers/Data/Bulk/TransactionController.php index 79435f58b8..f04e698b97 100644 --- a/app/Api/V1/Controllers/Data/Bulk/TransactionController.php +++ b/app/Api/V1/Controllers/Data/Bulk/TransactionController.php @@ -76,8 +76,8 @@ class TransactionController extends Controller // to respond to what is in the $query. // this is OK because only one thing can be in the query at the moment. if ($this->updatesTransactionAccount($params)) { - $original = $this->repository->find((int)$params['where']['account_id']); - $destination = $this->repository->find((int)$params['update']['account_id']); + $original = $this->repository->find((int) $params['where']['account_id']); + $destination = $this->repository->find((int) $params['update']['account_id']); /** @var AccountDestroyService $service */ $service = app(AccountDestroyService::class); diff --git a/app/Api/V1/Controllers/Data/Export/ExportController.php b/app/Api/V1/Controllers/Data/Export/ExportController.php index 58e1ab5090..c6eef16cef 100644 --- a/app/Api/V1/Controllers/Data/Export/ExportController.php +++ b/app/Api/V1/Controllers/Data/Export/ExportController.php @@ -78,9 +78,9 @@ class ExportController extends Controller */ private function returnExport(string $key): LaravelResponse { - $date = date('Y-m-d-H-i-s'); + $date = date('Y-m-d-H-i-s'); $fileName = sprintf('%s-export-%s.csv', $date, $key); - $data = $this->exporter->export(); + $data = $this->exporter->export(); /** @var LaravelResponse $response */ $response = response($data[$key]); @@ -93,7 +93,7 @@ class ExportController extends Controller ->header('Expires', '0') ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') ->header('Pragma', 'public') - ->header('Content-Length', (string)strlen($data[$key])); + ->header('Content-Length', (string) strlen($data[$key])); return $response; } diff --git a/app/Api/V1/Controllers/Insight/Expense/AccountController.php b/app/Api/V1/Controllers/Insight/Expense/AccountController.php index af32ae9e60..cb2f74ca68 100644 --- a/app/Api/V1/Controllers/Insight/Expense/AccountController.php +++ b/app/Api/V1/Controllers/Insight/Expense/AccountController.php @@ -91,11 +91,11 @@ class AccountController extends Controller /** @var array $expense */ foreach ($expenses as $expense) { $result[] = [ - 'id' => (string)$expense['id'], + 'id' => (string) $expense['id'], 'name' => $expense['name'], 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } @@ -123,11 +123,11 @@ class AccountController extends Controller /** @var array $expense */ foreach ($expenses as $expense) { $result[] = [ - 'id' => (string)$expense['id'], + 'id' => (string) $expense['id'], 'name' => $expense['name'], 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } diff --git a/app/Api/V1/Controllers/Insight/Expense/BillController.php b/app/Api/V1/Controllers/Insight/Expense/BillController.php index e79633d264..4bcf455c23 100644 --- a/app/Api/V1/Controllers/Insight/Expense/BillController.php +++ b/app/Api/V1/Controllers/Insight/Expense/BillController.php @@ -85,33 +85,33 @@ class BillController extends Controller $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $billId = (int)$journal['bill_id']; - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $billId = (int) $journal['bill_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; $key = sprintf('%d-%d', $billId, $currencyId); $foreignKey = sprintf('%d-%d', $billId, $foreignCurrencyId); if (0 !== $currencyId) { $response[$key] = $response[$key] ?? [ - 'id' => (string)$billId, + 'id' => (string) $billId, 'name' => $journal['bill_name'], 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']); - $response[$key]['difference_float'] = (float)$response[$key]['difference']; + $response[$key]['difference_float'] = (float) $response[$key]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignKey] = $response[$foreignKey] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']); - $response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; + $response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; } } @@ -143,28 +143,28 @@ class BillController extends Controller $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $currencyId) { $response[$currencyId] = $response[$currencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']); - $response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; + $response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']); - $response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; + $response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; } } diff --git a/app/Api/V1/Controllers/Insight/Expense/BudgetController.php b/app/Api/V1/Controllers/Insight/Expense/BudgetController.php index e8881e09ef..cf135f6abd 100644 --- a/app/Api/V1/Controllers/Insight/Expense/BudgetController.php +++ b/app/Api/V1/Controllers/Insight/Expense/BudgetController.php @@ -88,11 +88,11 @@ class BudgetController extends Controller /** @var array $expense */ foreach ($expenses as $expense) { $result[] = [ - 'id' => (string)$budget->id, + 'id' => (string) $budget->id, 'name' => $budget->name, 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } @@ -120,8 +120,8 @@ class BudgetController extends Controller foreach ($expenses as $expense) { $result[] = [ 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } diff --git a/app/Api/V1/Controllers/Insight/Expense/CategoryController.php b/app/Api/V1/Controllers/Insight/Expense/CategoryController.php index db8f31a2c3..cc2b25fc4a 100644 --- a/app/Api/V1/Controllers/Insight/Expense/CategoryController.php +++ b/app/Api/V1/Controllers/Insight/Expense/CategoryController.php @@ -89,11 +89,11 @@ class CategoryController extends Controller /** @var array $expense */ foreach ($expenses as $expense) { $result[] = [ - 'id' => (string)$category->id, + 'id' => (string) $category->id, 'name' => $category->name, 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } @@ -121,8 +121,8 @@ class CategoryController extends Controller foreach ($expenses as $expense) { $result[] = [ 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } diff --git a/app/Api/V1/Controllers/Insight/Expense/PeriodController.php b/app/Api/V1/Controllers/Insight/Expense/PeriodController.php index a83f6ca66a..6d32267b8f 100644 --- a/app/Api/V1/Controllers/Insight/Expense/PeriodController.php +++ b/app/Api/V1/Controllers/Insight/Expense/PeriodController.php @@ -55,28 +55,28 @@ class PeriodController extends Controller $collector->setTypes([TransactionType::WITHDRAWAL])->setRange($start, $end)->setSourceAccounts($accounts); $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $currencyId) { $response[$currencyId] = $response[$currencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']); - $response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; + $response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']); - $response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; + $response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; } } diff --git a/app/Api/V1/Controllers/Insight/Expense/TagController.php b/app/Api/V1/Controllers/Insight/Expense/TagController.php index d856d01c3d..9ea0a0fa04 100644 --- a/app/Api/V1/Controllers/Insight/Expense/TagController.php +++ b/app/Api/V1/Controllers/Insight/Expense/TagController.php @@ -79,28 +79,28 @@ class TagController extends Controller $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $currencyId) { $response[$currencyId] = $response[$currencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']); - $response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; + $response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']); - $response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; + $response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; } } @@ -137,8 +137,8 @@ class TagController extends Controller $genericSet = $collector->getExtractedJournals(); /** @var array $journal */ foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; /** @var array $tag */ foreach ($journal['tags'] as $tag) { @@ -149,15 +149,15 @@ class TagController extends Controller // on currency ID if (0 !== $currencyId) { $response[$key] = $response[$key] ?? [ - 'id' => (string)$tagId, + 'id' => (string) $tagId, 'name' => $tag['name'], 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']); - $response[$key]['difference_float'] = (float)$response[$key]['difference']; + $response[$key]['difference_float'] = (float) $response[$key]['difference']; } // on foreign ID @@ -165,11 +165,11 @@ class TagController extends Controller $response[$foreignKey] = $journal[$foreignKey] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']); - $response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; + $response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; } } } diff --git a/app/Api/V1/Controllers/Insight/Income/AccountController.php b/app/Api/V1/Controllers/Insight/Income/AccountController.php index 719a77ab6c..ecad08b6b4 100644 --- a/app/Api/V1/Controllers/Insight/Income/AccountController.php +++ b/app/Api/V1/Controllers/Insight/Income/AccountController.php @@ -90,11 +90,11 @@ class AccountController extends Controller /** @var array $entry */ foreach ($income as $entry) { $result[] = [ - 'id' => (string)$entry['id'], + 'id' => (string) $entry['id'], 'name' => $entry['name'], 'difference' => $entry['sum'], - 'difference_float' => (float)$entry['sum'], - 'currency_id' => (string)$entry['currency_id'], + 'difference_float' => (float) $entry['sum'], + 'currency_id' => (string) $entry['currency_id'], 'currency_code' => $entry['currency_code'], ]; } @@ -122,11 +122,11 @@ class AccountController extends Controller /** @var array $entry */ foreach ($income as $entry) { $result[] = [ - 'id' => (string)$entry['id'], + 'id' => (string) $entry['id'], 'name' => $entry['name'], 'difference' => $entry['sum'], - 'difference_float' => (float)$entry['sum'], - 'currency_id' => (string)$entry['currency_id'], + 'difference_float' => (float) $entry['sum'], + 'currency_id' => (string) $entry['currency_id'], 'currency_code' => $entry['currency_code'], ]; } diff --git a/app/Api/V1/Controllers/Insight/Income/CategoryController.php b/app/Api/V1/Controllers/Insight/Income/CategoryController.php index 47007f432f..79f0c4bf79 100644 --- a/app/Api/V1/Controllers/Insight/Income/CategoryController.php +++ b/app/Api/V1/Controllers/Insight/Income/CategoryController.php @@ -89,11 +89,11 @@ class CategoryController extends Controller /** @var array $expense */ foreach ($expenses as $expense) { $result[] = [ - 'id' => (string)$category->id, + 'id' => (string) $category->id, 'name' => $category->name, 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } @@ -121,8 +121,8 @@ class CategoryController extends Controller foreach ($expenses as $expense) { $result[] = [ 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } diff --git a/app/Api/V1/Controllers/Insight/Income/PeriodController.php b/app/Api/V1/Controllers/Insight/Income/PeriodController.php index 4ec6c12acb..41aa682337 100644 --- a/app/Api/V1/Controllers/Insight/Income/PeriodController.php +++ b/app/Api/V1/Controllers/Insight/Income/PeriodController.php @@ -55,30 +55,30 @@ class PeriodController extends Controller $collector->setTypes([TransactionType::DEPOSIT])->setRange($start, $end)->setDestinationAccounts($accounts); $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $currencyId) { $response[$currencyId] = $response[$currencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount'])); - $response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; + $response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignCurrencyId]['difference'] = bcadd( $response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount']) ); - $response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; + $response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; } } diff --git a/app/Api/V1/Controllers/Insight/Income/TagController.php b/app/Api/V1/Controllers/Insight/Income/TagController.php index 8e58fbf01d..10ea364f8c 100644 --- a/app/Api/V1/Controllers/Insight/Income/TagController.php +++ b/app/Api/V1/Controllers/Insight/Income/TagController.php @@ -80,30 +80,30 @@ class TagController extends Controller $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $currencyId) { $response[$currencyId] = $response[$currencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount'])); - $response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; + $response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignCurrencyId]['difference'] = bcadd( $response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount']) ); - $response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; + $response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; } } @@ -140,8 +140,8 @@ class TagController extends Controller $genericSet = $collector->getExtractedJournals(); /** @var array $journal */ foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; /** @var array $tag */ foreach ($journal['tags'] as $tag) { @@ -152,15 +152,15 @@ class TagController extends Controller // on currency ID if (0 !== $currencyId) { $response[$key] = $response[$key] ?? [ - 'id' => (string)$tagId, + 'id' => (string) $tagId, 'name' => $tag['name'], 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount'])); - $response[$key]['difference_float'] = (float)$response[$key]['difference']; + $response[$key]['difference_float'] = (float) $response[$key]['difference']; } // on foreign ID @@ -168,13 +168,13 @@ class TagController extends Controller $response[$foreignKey] = $journal[$foreignKey] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignKey]['difference'] = bcadd( $response[$foreignKey]['difference'], app('steam')->positive($journal['foreign_amount']) ); - $response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; + $response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; } } } diff --git a/app/Api/V1/Controllers/Insight/Transfer/CategoryController.php b/app/Api/V1/Controllers/Insight/Transfer/CategoryController.php index 43b77675ed..d42772f9be 100644 --- a/app/Api/V1/Controllers/Insight/Transfer/CategoryController.php +++ b/app/Api/V1/Controllers/Insight/Transfer/CategoryController.php @@ -88,11 +88,11 @@ class CategoryController extends Controller /** @var array $expense */ foreach ($expenses as $expense) { $result[] = [ - 'id' => (string)$category->id, + 'id' => (string) $category->id, 'name' => $category->name, 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } @@ -120,8 +120,8 @@ class CategoryController extends Controller foreach ($expenses as $expense) { $result[] = [ 'difference' => $expense['sum'], - 'difference_float' => (float)$expense['sum'], - 'currency_id' => (string)$expense['currency_id'], + 'difference_float' => (float) $expense['sum'], + 'currency_id' => (string) $expense['currency_id'], 'currency_code' => $expense['currency_code'], ]; } diff --git a/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php b/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php index ecb42d4a9f..8f8eab7428 100644 --- a/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php +++ b/app/Api/V1/Controllers/Insight/Transfer/PeriodController.php @@ -55,30 +55,30 @@ class PeriodController extends Controller $collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts); $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $currencyId) { $response[$currencyId] = $response[$currencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount'])); - $response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; + $response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignCurrencyId]['difference'] = bcadd( $response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount']) ); - $response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; + $response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; } } diff --git a/app/Api/V1/Controllers/Insight/Transfer/TagController.php b/app/Api/V1/Controllers/Insight/Transfer/TagController.php index 59404dcbbb..edd0ab859f 100644 --- a/app/Api/V1/Controllers/Insight/Transfer/TagController.php +++ b/app/Api/V1/Controllers/Insight/Transfer/TagController.php @@ -77,30 +77,30 @@ class TagController extends Controller $genericSet = $collector->getExtractedJournals(); foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $currencyId) { $response[$currencyId] = $response[$currencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount'])); - $response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; + $response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; } if (0 !== $foreignCurrencyId) { $response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignCurrencyId]['difference'] = bcadd( $response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount']) ); - $response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; + $response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; } } @@ -137,8 +137,8 @@ class TagController extends Controller $genericSet = $collector->getExtractedJournals(); /** @var array $journal */ foreach ($genericSet as $journal) { - $currencyId = (int)$journal['currency_id']; - $foreignCurrencyId = (int)$journal['foreign_currency_id']; + $currencyId = (int) $journal['currency_id']; + $foreignCurrencyId = (int) $journal['foreign_currency_id']; /** @var array $tag */ foreach ($journal['tags'] as $tag) { @@ -149,15 +149,15 @@ class TagController extends Controller // on currency ID if (0 !== $currencyId) { $response[$key] = $response[$key] ?? [ - 'id' => (string)$tagId, + 'id' => (string) $tagId, 'name' => $tag['name'], 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$currencyId, + 'currency_id' => (string) $currencyId, 'currency_code' => $journal['currency_code'], ]; $response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount'])); - $response[$key]['difference_float'] = (float)$response[$key]['difference']; + $response[$key]['difference_float'] = (float) $response[$key]['difference']; } // on foreign ID @@ -165,13 +165,13 @@ class TagController extends Controller $response[$foreignKey] = $journal[$foreignKey] ?? [ 'difference' => '0', 'difference_float' => 0, - 'currency_id' => (string)$foreignCurrencyId, + 'currency_id' => (string) $foreignCurrencyId, 'currency_code' => $journal['foreign_currency_code'], ]; $response[$foreignKey]['difference'] = bcadd( $response[$foreignKey]['difference'], app('steam')->positive($journal['foreign_amount']) ); - $response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; + $response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; } } } diff --git a/app/Api/V1/Controllers/Models/Account/ListController.php b/app/Api/V1/Controllers/Models/Account/ListController.php index 9731129957..a56131a639 100644 --- a/app/Api/V1/Controllers/Models/Account/ListController.php +++ b/app/Api/V1/Controllers/Models/Account/ListController.php @@ -82,7 +82,7 @@ class ListController extends Controller public function attachments(Account $account): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttachments($account); $count = $collection->count(); @@ -118,7 +118,7 @@ class ListController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getPiggyBanks($account); @@ -156,7 +156,7 @@ class ListController extends Controller */ public function transactions(Request $request, Account $account): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php index a5650ebf23..3ad5c13933 100644 --- a/app/Api/V1/Controllers/Models/Account/ShowController.php +++ b/app/Api/V1/Controllers/Models/Account/ShowController.php @@ -84,8 +84,8 @@ class ShowController extends Controller $this->parameters->set('type', $type); // types to get, page size: - $types = $this->mapAccountTypes($this->parameters->get('type')); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $types = $this->mapAccountTypes($this->parameters->get('type')); + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. $this->repository->resetAccountOrder(); diff --git a/app/Api/V1/Controllers/Models/Account/UpdateController.php b/app/Api/V1/Controllers/Models/Account/UpdateController.php index 49a6f2c794..65221bbeda 100644 --- a/app/Api/V1/Controllers/Models/Account/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Account/UpdateController.php @@ -74,10 +74,10 @@ class UpdateController extends Controller public function update(UpdateRequest $request, Account $account): JsonResponse { Log::debug(sprintf('Now in %s', __METHOD__)); - $data = $request->getUpdateData(); + $data = $request->getUpdateData(); $data['type'] = config('firefly.shortNamesByFullName.' . $account->accountType->type); - $account = $this->repository->update($account, $data); - $manager = $this->getManager(); + $account = $this->repository->update($account, $data); + $manager = $this->getManager(); $account->refresh(); Preferences::mark(); diff --git a/app/Api/V1/Controllers/Models/Attachment/DestroyController.php b/app/Api/V1/Controllers/Models/Attachment/DestroyController.php index bbf72975d9..3fad5d77bd 100644 --- a/app/Api/V1/Controllers/Models/Attachment/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Attachment/DestroyController.php @@ -49,7 +49,7 @@ class DestroyController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); + $user = auth()->user(); $this->repository = app(AttachmentRepositoryInterface::class); $this->repository->setUser($user); diff --git a/app/Api/V1/Controllers/Models/Attachment/ShowController.php b/app/Api/V1/Controllers/Models/Attachment/ShowController.php index e724d80d52..55537851c8 100644 --- a/app/Api/V1/Controllers/Models/Attachment/ShowController.php +++ b/app/Api/V1/Controllers/Models/Attachment/ShowController.php @@ -103,7 +103,7 @@ class ShowController extends Controller ->header('Expires', '0') ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') ->header('Pragma', 'public') - ->header('Content-Length', (string)strlen($content)); + ->header('Content-Length', (string) strlen($content)); return $response; } @@ -125,7 +125,7 @@ class ShowController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of attachments. Count it and split it. $collection = $this->repository->get(); diff --git a/app/Api/V1/Controllers/Models/Attachment/UpdateController.php b/app/Api/V1/Controllers/Models/Attachment/UpdateController.php index fda955b2bf..f5d350b1e4 100644 --- a/app/Api/V1/Controllers/Models/Attachment/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Attachment/UpdateController.php @@ -52,7 +52,7 @@ class UpdateController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); + $user = auth()->user(); $this->repository = app(AttachmentRepositoryInterface::class); $this->repository->setUser($user); diff --git a/app/Api/V1/Controllers/Models/AvailableBudget/DestroyController.php b/app/Api/V1/Controllers/Models/AvailableBudget/DestroyController.php index 8eda2dda48..0297e839c7 100644 --- a/app/Api/V1/Controllers/Models/AvailableBudget/DestroyController.php +++ b/app/Api/V1/Controllers/Models/AvailableBudget/DestroyController.php @@ -47,7 +47,7 @@ class DestroyController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); + $user = auth()->user(); $this->abRepository = app(AvailableBudgetRepositoryInterface::class); $this->abRepository->setUser($user); diff --git a/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php b/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php index 24d7a1608b..210648d109 100644 --- a/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php +++ b/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php @@ -77,7 +77,7 @@ class ShowController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $start = $this->parameters->get('start'); $end = $this->parameters->get('end'); diff --git a/app/Api/V1/Controllers/Models/Bill/ListController.php b/app/Api/V1/Controllers/Models/Bill/ListController.php index b73e94942b..686277b718 100644 --- a/app/Api/V1/Controllers/Models/Bill/ListController.php +++ b/app/Api/V1/Controllers/Models/Bill/ListController.php @@ -81,7 +81,7 @@ class ListController extends Controller public function attachments(Bill $bill): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttachments($bill); $count = $collection->count(); @@ -118,7 +118,7 @@ class ListController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getRulesForBill($bill); @@ -155,7 +155,7 @@ class ListController extends Controller */ public function transactions(Request $request, Bill $bill): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/Bill/ShowController.php b/app/Api/V1/Controllers/Models/Bill/ShowController.php index 5246af526a..2fba6af816 100644 --- a/app/Api/V1/Controllers/Models/Bill/ShowController.php +++ b/app/Api/V1/Controllers/Models/Bill/ShowController.php @@ -74,7 +74,7 @@ class ShowController extends Controller $this->repository->correctOrder(); $bills = $this->repository->getBills(); $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $count = $bills->count(); $bills = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); $paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page')); diff --git a/app/Api/V1/Controllers/Models/Bill/StoreController.php b/app/Api/V1/Controllers/Models/Bill/StoreController.php index f28e8fbdfe..7c5cd8b3b5 100644 --- a/app/Api/V1/Controllers/Models/Bill/StoreController.php +++ b/app/Api/V1/Controllers/Models/Bill/StoreController.php @@ -72,8 +72,8 @@ class StoreController extends Controller */ public function store(StoreRequest $request): JsonResponse { - $data = $request->getAll(); - $bill = $this->repository->store($data); + $data = $request->getAll(); + $bill = $this->repository->store($data); $manager = $this->getManager(); /** @var BillTransformer $transformer */ diff --git a/app/Api/V1/Controllers/Models/Bill/UpdateController.php b/app/Api/V1/Controllers/Models/Bill/UpdateController.php index d5fdf38b03..2705e62263 100644 --- a/app/Api/V1/Controllers/Models/Bill/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Bill/UpdateController.php @@ -69,8 +69,8 @@ class UpdateController extends Controller */ public function update(UpdateRequest $request, Bill $bill): JsonResponse { - $data = $request->getAll(); - $bill = $this->repository->update($bill, $data); + $data = $request->getAll(); + $bill = $this->repository->update($bill, $data); $manager = $this->getManager(); /** @var BillTransformer $transformer */ diff --git a/app/Api/V1/Controllers/Models/Budget/ListController.php b/app/Api/V1/Controllers/Models/Budget/ListController.php index 8fdddd2513..70e84c2fe8 100644 --- a/app/Api/V1/Controllers/Models/Budget/ListController.php +++ b/app/Api/V1/Controllers/Models/Budget/ListController.php @@ -83,7 +83,7 @@ class ListController extends Controller public function attachments(Budget $budget): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttachments($budget); $count = $collection->count(); @@ -118,7 +118,7 @@ class ListController extends Controller public function budgetLimits(Budget $budget): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $this->parameters->set('budget_id', $budget->id); $collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end')); $count = $collection->count(); @@ -151,7 +151,7 @@ class ListController extends Controller */ public function transactions(Request $request, Budget $budget): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // user can overrule page size with limit parameter. $limit = $this->parameters->get('limit'); @@ -217,7 +217,7 @@ class ListController extends Controller */ public function withoutBudget(Request $request): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // user can overrule page size with limit parameter. $limit = $this->parameters->get('limit'); diff --git a/app/Api/V1/Controllers/Models/Budget/ShowController.php b/app/Api/V1/Controllers/Models/Budget/ShowController.php index f2831e1918..d408bccf5e 100644 --- a/app/Api/V1/Controllers/Models/Budget/ShowController.php +++ b/app/Api/V1/Controllers/Models/Budget/ShowController.php @@ -53,7 +53,7 @@ class ShowController extends Controller parent::__construct(); $this->middleware( function ($request, $next) { - $this->repository = app(BudgetRepositoryInterface::class); + $this->repository = app(BudgetRepositoryInterface::class); $this->blRepository = app(BudgetLimitRepositoryInterface::class); $this->repository->setUser(auth()->user()); $this->blRepository->setUser(auth()->user()); @@ -78,7 +78,7 @@ class ShowController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getBudgets(); diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php b/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php index 79a03c0cce..8b2b2276e4 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php @@ -81,7 +81,7 @@ class ListController extends Controller */ public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php index 108a8612d8..ac628b3550 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php @@ -86,7 +86,7 @@ class ShowController extends Controller { $manager = $this->getManager(); $manager->parseIncludes('budget'); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end')); $count = $collection->count(); $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); @@ -119,7 +119,7 @@ class ShowController extends Controller { $manager = $this->getManager(); $manager->parseIncludes('budget'); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->blRepository->getAllBudgetLimits($this->parameters->get('start'), $this->parameters->get('end')); $count = $collection->count(); $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); @@ -149,7 +149,7 @@ class ShowController extends Controller */ public function show(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse { - if ((int)$budget->id !== (int)$budgetLimit->budget_id) { + if ((int) $budget->id !== (int) $budgetLimit->budget_id) { throw new FireflyException('20028: The budget limit does not belong to the budget.'); } // continue! diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/UpdateController.php b/app/Api/V1/Controllers/Models/BudgetLimit/UpdateController.php index 54150f26da..9325d3297d 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/UpdateController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/UpdateController.php @@ -77,7 +77,7 @@ class UpdateController extends Controller public function update(UpdateRequest $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse { - if ((int)$budget->id !== (int)$budgetLimit->budget_id) { + if ((int) $budget->id !== (int) $budgetLimit->budget_id) { throw new FireflyException('20028: The budget limit does not belong to the budget.'); } $data = $request->getAll(); diff --git a/app/Api/V1/Controllers/Models/Category/ListController.php b/app/Api/V1/Controllers/Models/Category/ListController.php index ceb2fd5d1e..1cfdf8e268 100644 --- a/app/Api/V1/Controllers/Models/Category/ListController.php +++ b/app/Api/V1/Controllers/Models/Category/ListController.php @@ -78,7 +78,7 @@ class ListController extends Controller public function attachments(Category $category): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttachments($category); $count = $collection->count(); @@ -114,7 +114,7 @@ class ListController extends Controller */ public function transactions(Request $request, Category $category): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/Category/ShowController.php b/app/Api/V1/Controllers/Models/Category/ShowController.php index d463a6ce52..0f18d8f831 100644 --- a/app/Api/V1/Controllers/Models/Category/ShowController.php +++ b/app/Api/V1/Controllers/Models/Category/ShowController.php @@ -74,7 +74,7 @@ class ShowController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getCategories(); diff --git a/app/Api/V1/Controllers/Models/Category/UpdateController.php b/app/Api/V1/Controllers/Models/Category/UpdateController.php index 66bfce6859..f7d3532da0 100644 --- a/app/Api/V1/Controllers/Models/Category/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Category/UpdateController.php @@ -69,9 +69,9 @@ class UpdateController extends Controller */ public function update(UpdateRequest $request, Category $category): JsonResponse { - $data = $request->getAll(); + $data = $request->getAll(); $category = $this->repository->update($category, $data); - $manager = $this->getManager(); + $manager = $this->getManager(); /** @var CategoryTransformer $transformer */ $transformer = app(CategoryTransformer::class); diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php b/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php index cc8211b4dd..bbb27aa355 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php @@ -47,7 +47,7 @@ class DestroyController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); + $user = auth()->user(); $this->repository = app(ObjectGroupRepositoryInterface::class); $this->repository->setUser($user); diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php index 8ac8308e6f..907500a309 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php @@ -53,7 +53,7 @@ class ListController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); + $user = auth()->user(); $this->repository = app(ObjectGroupRepositoryInterface::class); $this->repository->setUser($user); @@ -78,7 +78,7 @@ class ListController extends Controller { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of piggy banks. Count it and split it. $collection = $this->repository->getBills($objectGroup); $count = $collection->count(); @@ -116,7 +116,7 @@ class ListController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of piggy banks. Count it and split it. $collection = $this->repository->getPiggyBanks($objectGroup); diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php index c11d756761..bfc001fa93 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php @@ -80,7 +80,7 @@ class ShowController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $this->repository->resetOrder(); $collection = $this->repository->get(); diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/UpdateController.php b/app/Api/V1/Controllers/Models/ObjectGroup/UpdateController.php index 45a8858f39..ceb2e32dc9 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/UpdateController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/UpdateController.php @@ -50,7 +50,7 @@ class UpdateController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); + $user = auth()->user(); $this->repository = app(ObjectGroupRepositoryInterface::class); $this->repository->setUser($user); diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php index 264e5dc528..d7537df365 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php @@ -72,7 +72,7 @@ class ListController extends Controller public function attachments(PiggyBank $piggyBank): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttachments($piggyBank); $count = $collection->count(); @@ -107,7 +107,7 @@ class ListController extends Controller public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse { // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $manager = $this->getManager(); $collection = $this->repository->getEvents($piggyBank); diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php b/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php index 37e86c867d..ccdcaeebf5 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php @@ -73,7 +73,7 @@ class ShowController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->getPiggyBanks(); diff --git a/app/Api/V1/Controllers/Models/PiggyBank/UpdateController.php b/app/Api/V1/Controllers/Models/PiggyBank/UpdateController.php index e6634cf5e2..41d69b904b 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/UpdateController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/UpdateController.php @@ -69,7 +69,7 @@ class UpdateController extends Controller */ public function update(UpdateRequest $request, PiggyBank $piggyBank): JsonResponse { - $data = $request->getAll(); + $data = $request->getAll(); $piggyBank = $this->repository->update($piggyBank, $data); if (array_key_exists('current_amount', $data) && '' !== $data['current_amount']) { diff --git a/app/Api/V1/Controllers/Models/Recurrence/ListController.php b/app/Api/V1/Controllers/Models/Recurrence/ListController.php index 17cf615b66..9b13fc88d7 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/ListController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/ListController.php @@ -78,7 +78,7 @@ class ListController extends Controller */ public function transactions(Request $request, Recurrence $recurrence): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php index ecb7438755..1d53b2528a 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php @@ -74,7 +74,7 @@ class ShowController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->get(); diff --git a/app/Api/V1/Controllers/Models/Recurrence/StoreController.php b/app/Api/V1/Controllers/Models/Recurrence/StoreController.php index 03c60fd43a..8ca5672b2a 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/StoreController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/StoreController.php @@ -69,9 +69,9 @@ class StoreController extends Controller */ public function store(StoreRequest $request): JsonResponse { - $data = $request->getAll(); + $data = $request->getAll(); $recurrence = $this->repository->store($data); - $manager = $this->getManager(); + $manager = $this->getManager(); /** @var RecurrenceTransformer $transformer */ $transformer = app(RecurrenceTransformer::class); diff --git a/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php b/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php index 18696ee68e..8e0ec86815 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php @@ -69,9 +69,9 @@ class UpdateController extends Controller */ public function update(UpdateRequest $request, Recurrence $recurrence): JsonResponse { - $data = $request->getAll(); + $data = $request->getAll(); $recurrence = $this->repository->update($recurrence, $data); - $manager = $this->getManager(); + $manager = $this->getManager(); /** @var RecurrenceTransformer $transformer */ $transformer = app(RecurrenceTransformer::class); diff --git a/app/Api/V1/Controllers/Models/Rule/ShowController.php b/app/Api/V1/Controllers/Models/Rule/ShowController.php index 6ab5b01e2c..c633aac828 100644 --- a/app/Api/V1/Controllers/Models/Rule/ShowController.php +++ b/app/Api/V1/Controllers/Models/Rule/ShowController.php @@ -78,7 +78,7 @@ class ShowController extends Controller $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->ruleRepository->getAll(); diff --git a/app/Api/V1/Controllers/Models/Rule/StoreController.php b/app/Api/V1/Controllers/Models/Rule/StoreController.php index 7d861c71f4..322cf814d5 100644 --- a/app/Api/V1/Controllers/Models/Rule/StoreController.php +++ b/app/Api/V1/Controllers/Models/Rule/StoreController.php @@ -71,7 +71,7 @@ class StoreController extends Controller */ public function store(StoreRequest $request): JsonResponse { - $rule = $this->ruleRepository->store($request->getAll()); + $rule = $this->ruleRepository->store($request->getAll()); $manager = $this->getManager(); /** @var RuleTransformer $transformer */ $transformer = app(RuleTransformer::class); diff --git a/app/Api/V1/Controllers/Models/Rule/UpdateController.php b/app/Api/V1/Controllers/Models/Rule/UpdateController.php index 28859b99de..b8e3996e8b 100644 --- a/app/Api/V1/Controllers/Models/Rule/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Rule/UpdateController.php @@ -73,8 +73,8 @@ class UpdateController extends Controller */ public function update(UpdateRequest $request, Rule $rule): JsonResponse { - $data = $request->getAll(); - $rule = $this->ruleRepository->update($rule, $data); + $data = $request->getAll(); + $rule = $this->ruleRepository->update($rule, $data); $manager = $this->getManager(); /** @var RuleTransformer $transformer */ diff --git a/app/Api/V1/Controllers/Models/RuleGroup/ListController.php b/app/Api/V1/Controllers/Models/RuleGroup/ListController.php index 30e7c3a68b..f730025352 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/ListController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/ListController.php @@ -76,7 +76,7 @@ class ListController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->ruleGroupRepository->getRules($group); diff --git a/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php b/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php index 7e77e6fd41..da714489aa 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php @@ -76,7 +76,7 @@ class ShowController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of rule groups. Count it and split it. $collection = $this->ruleGroupRepository->get(); diff --git a/app/Api/V1/Controllers/Models/RuleGroup/StoreController.php b/app/Api/V1/Controllers/Models/RuleGroup/StoreController.php index 0487988536..5f87c6866f 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/StoreController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/StoreController.php @@ -38,7 +38,7 @@ use League\Fractal\Resource\Item; class StoreController extends Controller { - private AccountRepositoryInterface $accountRepository; + private AccountRepositoryInterface $accountRepository; private RuleGroupRepositoryInterface $ruleGroupRepository; /** diff --git a/app/Api/V1/Controllers/Models/Tag/ListController.php b/app/Api/V1/Controllers/Models/Tag/ListController.php index 51ef7f7307..855a7169f2 100644 --- a/app/Api/V1/Controllers/Models/Tag/ListController.php +++ b/app/Api/V1/Controllers/Models/Tag/ListController.php @@ -81,7 +81,7 @@ class ListController extends Controller public function attachments(Tag $tag): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttachments($tag); $count = $collection->count(); @@ -116,7 +116,7 @@ class ListController extends Controller */ public function transactions(Request $request, Tag $tag): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/Tag/ShowController.php b/app/Api/V1/Controllers/Models/Tag/ShowController.php index dc4e58162d..3aede9926f 100644 --- a/app/Api/V1/Controllers/Models/Tag/ShowController.php +++ b/app/Api/V1/Controllers/Models/Tag/ShowController.php @@ -77,7 +77,7 @@ class ShowController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. $collection = $this->repository->get(); diff --git a/app/Api/V1/Controllers/Models/Tag/StoreController.php b/app/Api/V1/Controllers/Models/Tag/StoreController.php index c31e903c6a..9b2dcff1c5 100644 --- a/app/Api/V1/Controllers/Models/Tag/StoreController.php +++ b/app/Api/V1/Controllers/Models/Tag/StoreController.php @@ -71,7 +71,7 @@ class StoreController extends Controller */ public function store(StoreRequest $request): JsonResponse { - $rule = $this->repository->store($request->getAll()); + $rule = $this->repository->store($request->getAll()); $manager = $this->getManager(); /** @var TagTransformer $transformer */ $transformer = app(TagTransformer::class); diff --git a/app/Api/V1/Controllers/Models/Tag/UpdateController.php b/app/Api/V1/Controllers/Models/Tag/UpdateController.php index 377c362f3f..5646a4b302 100644 --- a/app/Api/V1/Controllers/Models/Tag/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Tag/UpdateController.php @@ -73,7 +73,7 @@ class UpdateController extends Controller */ public function update(UpdateRequest $request, Tag $tag): JsonResponse { - $rule = $this->repository->update($tag, $request->getAll()); + $rule = $this->repository->update($tag, $request->getAll()); $manager = $this->getManager(); /** @var TagTransformer $transformer */ $transformer = app(TagTransformer::class); diff --git a/app/Api/V1/Controllers/Models/Transaction/ListController.php b/app/Api/V1/Controllers/Models/Transaction/ListController.php index 19e9569df1..025836433b 100644 --- a/app/Api/V1/Controllers/Models/Transaction/ListController.php +++ b/app/Api/V1/Controllers/Models/Transaction/ListController.php @@ -79,7 +79,7 @@ class ListController extends Controller public function attachments(TransactionGroup $transactionGroup): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = new Collection; foreach ($transactionGroup->transactionJournals as $transactionJournal) { $collection = $this->journalAPIRepository->getAttachments($transactionJournal)->merge($collection); @@ -116,7 +116,7 @@ class ListController extends Controller { $manager = $this->getManager(); $collection = new Collection; - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; foreach ($transactionGroup->transactionJournals as $transactionJournal) { $collection = $this->journalAPIRepository->getPiggyBankEvents($transactionJournal)->merge($collection); } @@ -155,7 +155,7 @@ class ListController extends Controller { $manager = $this->getManager(); $collection = $this->journalAPIRepository->getJournalLinks($transactionJournal); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $count = $collection->count(); $journalLinks = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); diff --git a/app/Api/V1/Controllers/Models/Transaction/ShowController.php b/app/Api/V1/Controllers/Models/Transaction/ShowController.php index 20af38f182..c86af23b9b 100644 --- a/app/Api/V1/Controllers/Models/Transaction/ShowController.php +++ b/app/Api/V1/Controllers/Models/Transaction/ShowController.php @@ -59,7 +59,7 @@ class ShowController extends Controller */ public function index(Request $request): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php index f09bbc82d2..261d3eb9e9 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php @@ -50,7 +50,7 @@ class DestroyController extends Controller parent::__construct(); $this->middleware( function ($request, $next) { - $this->repository = app(CurrencyRepositoryInterface::class); + $this->repository = app(CurrencyRepositoryInterface::class); $this->userRepository = app(UserRepositoryInterface::class); $this->repository->setUser(auth()->user()); diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php index 94a8f80457..21b4ec9880 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php @@ -109,7 +109,7 @@ class ListController extends Controller // types to get, page size: $types = $this->mapAccountTypes($this->parameters->get('type')); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. /** @var AccountRepositoryInterface $accountRepository */ @@ -119,7 +119,7 @@ class ListController extends Controller // filter list on currency preference: $collection = $unfiltered->filter( static function (Account $account) use ($currency, $accountRepository) { - $currencyId = (int)$accountRepository->getMetaValue($account, 'currency_id'); + $currencyId = (int) $accountRepository->getMetaValue($account, 'currency_id'); return $currencyId === $currency->id; } @@ -157,7 +157,7 @@ class ListController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of available budgets. Count it and split it. /** @var AvailableBudgetRepositoryInterface $abRepository */ @@ -198,7 +198,7 @@ class ListController extends Controller /** @var BillRepositoryInterface $billRepos */ $billRepos = app(BillRepositoryInterface::class); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $unfiltered = $billRepos->getBills(); // filter and paginate list: @@ -242,7 +242,7 @@ class ListController extends Controller $blRepository = app(BudgetLimitRepositoryInterface::class); $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $blRepository->getAllBudgetLimitsByCurrency($currency, $this->parameters->get('start'), $this->parameters->get('end')); $count = $collection->count(); $budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); @@ -275,7 +275,7 @@ class ListController extends Controller { $manager = $this->getManager(); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. /** @var RecurringRepositoryInterface $recurringRepos */ @@ -328,7 +328,7 @@ class ListController extends Controller public function rules(TransactionCurrency $currency): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of budgets. Count it and split it. /** @var RuleRepositoryInterface $ruleRepos */ @@ -382,7 +382,7 @@ class ListController extends Controller */ public function transactions(Request $request, TransactionCurrency $currency): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php index 919a8ed085..39e121c1ad 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php @@ -76,7 +76,7 @@ class ShowController extends Controller */ public function index(): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAll(); $count = $collection->count(); // slice them: diff --git a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php index db0a6aaf31..7d34561c7b 100644 --- a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php @@ -83,12 +83,12 @@ class ShowController extends Controller $name = $request->get('name'); // types to get, page size: - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $linkType = $this->repository->findByName($name); // get list of transaction links. Count it and split it. - $collection = $this->repository->getJournalLinks($linkType); - $count = $collection->count(); + $collection = $this->repository->getJournalLinks($linkType); + $count = $collection->count(); $journalLinks = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); // make paginator: diff --git a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php index dd843887dd..d1ae43c0da 100644 --- a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php @@ -82,7 +82,7 @@ class ListController extends Controller */ public function transactions(Request $request, LinkType $linkType): JsonResponse { - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $type = $request->get('type') ?? 'default'; $this->parameters->set('type', $type); diff --git a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php index 5046570c87..5bc8538995 100644 --- a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php @@ -82,7 +82,7 @@ class ShowController extends Controller { // create some objects: $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; // get list of accounts. Count it and split it. $collection = $this->repository->get(); diff --git a/app/Api/V1/Controllers/Search/AccountController.php b/app/Api/V1/Controllers/Search/AccountController.php index 20fea66f3d..2950b6cf17 100644 --- a/app/Api/V1/Controllers/Search/AccountController.php +++ b/app/Api/V1/Controllers/Search/AccountController.php @@ -70,8 +70,8 @@ class AccountController extends Controller { Log::debug('Now in account search()'); $manager = $this->getManager(); - $query = trim((string)$request->get('query')); - $field = trim((string)$request->get('field')); + $query = trim((string) $request->get('query')); + $field = trim((string) $request->get('field')); $type = $request->get('type') ?? 'all'; if ('' === $query || !in_array($field, $this->validFields, true)) { return response(null, 422); diff --git a/app/Api/V1/Controllers/Search/TransactionController.php b/app/Api/V1/Controllers/Search/TransactionController.php index a2464313a3..016af96eda 100644 --- a/app/Api/V1/Controllers/Search/TransactionController.php +++ b/app/Api/V1/Controllers/Search/TransactionController.php @@ -51,10 +51,10 @@ class TransactionController extends Controller public function search(Request $request, SearchInterface $searcher): JsonResponse { $manager = $this->getManager(); - $fullQuery = (string)$request->get('query'); - $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page'); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; - $pageSize = 0 === (int)$request->get('limit') ? $pageSize : (int)$request->get('limit'); + $fullQuery = (string) $request->get('query'); + $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page'); + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = 0 === (int) $request->get('limit') ? $pageSize : (int) $request->get('limit'); $searcher->parseQuery($fullQuery); $searcher->setPage($page); $searcher->setLimit($pageSize); diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index 362d6802e0..2b9e9de2e4 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -148,7 +148,7 @@ class BasicController extends Controller $set = $collector->getExtractedJournals(); /** @var array $transactionJournal */ foreach ($set as $transactionJournal) { - $currencyId = (int)$transactionJournal['currency_id']; + $currencyId = (int) $transactionJournal['currency_id']; $incomes[$currencyId] = $incomes[$currencyId] ?? '0'; $incomes[$currencyId] = bcadd($incomes[$currencyId], bcmul($transactionJournal['amount'], '-1') @@ -170,7 +170,7 @@ class BasicController extends Controller /** @var array $transactionJournal */ foreach ($set as $transactionJournal) { - $currencyId = (int)$transactionJournal['currency_id']; + $currencyId = (int) $transactionJournal['currency_id']; $expenses[$currencyId] = $expenses[$currencyId] ?? '0'; $expenses[$currencyId] = bcadd($expenses[$currencyId], $transactionJournal['amount']); $sums[$currencyId] = $sums[$currencyId] ?? '0'; @@ -188,7 +188,7 @@ class BasicController extends Controller $return[] = [ 'key' => sprintf('balance-in-%s', $currency->code), 'title' => trans('firefly.box_balance_in_currency', ['currency' => $currency->symbol]), - 'monetary_value' => round((float)$sums[$currencyId] ?? 0, $currency->decimal_places), + 'monetary_value' => round((float) $sums[$currencyId] ?? 0, $currency->decimal_places), 'currency_id' => $currency->id, 'currency_code' => $currency->code, 'currency_symbol' => $currency->symbol, @@ -201,7 +201,7 @@ class BasicController extends Controller $return[] = [ 'key' => sprintf('spent-in-%s', $currency->code), 'title' => trans('firefly.box_spent_in_currency', ['currency' => $currency->symbol]), - 'monetary_value' => round((float)($expenses[$currencyId] ?? 0), $currency->decimal_places), + 'monetary_value' => round((float) ($expenses[$currencyId] ?? 0), $currency->decimal_places), 'currency_id' => $currency->id, 'currency_code' => $currency->code, 'currency_symbol' => $currency->symbol, @@ -213,7 +213,7 @@ class BasicController extends Controller $return[] = [ 'key' => sprintf('earned-in-%s', $currency->code), 'title' => trans('firefly.box_earned_in_currency', ['currency' => $currency->symbol]), - 'monetary_value' => round((float)($incomes[$currencyId] ?? 0), $currency->decimal_places), + 'monetary_value' => round((float) ($incomes[$currencyId] ?? 0), $currency->decimal_places), 'currency_id' => $currency->id, 'currency_code' => $currency->code, 'currency_symbol' => $currency->symbol, @@ -244,14 +244,14 @@ class BasicController extends Controller $return = []; foreach ($paidAmount as $currencyId => $amount) { $amount = bcmul($amount, '-1'); - $currency = $this->currencyRepos->find((int)$currencyId); + $currency = $this->currencyRepos->find((int) $currencyId); if (null === $currency) { continue; } $return[] = [ 'key' => sprintf('bills-paid-in-%s', $currency->code), 'title' => trans('firefly.box_bill_paid_in_currency', ['currency' => $currency->symbol]), - 'monetary_value' => round((float)$amount, $currency->decimal_places), + 'monetary_value' => round((float) $amount, $currency->decimal_places), 'currency_id' => $currency->id, 'currency_code' => $currency->code, 'currency_symbol' => $currency->symbol, @@ -264,14 +264,14 @@ class BasicController extends Controller foreach ($unpaidAmount as $currencyId => $amount) { $amount = bcmul($amount, '-1'); - $currency = $this->currencyRepos->find((int)$currencyId); + $currency = $this->currencyRepos->find((int) $currencyId); if (null === $currency) { continue; } $return[] = [ 'key' => sprintf('bills-unpaid-in-%s', $currency->code), 'title' => trans('firefly.box_bill_unpaid_in_currency', ['currency' => $currency->symbol]), - 'monetary_value' => round((float)$amount, $currency->decimal_places), + 'monetary_value' => round((float) $amount, $currency->decimal_places), 'currency_id' => $currency->id, 'currency_code' => $currency->code, 'currency_symbol' => $currency->symbol, @@ -309,20 +309,20 @@ class BasicController extends Controller $days = $today->diffInDays($end) + 1; $perDay = '0'; if (0 !== $days && bccomp($leftToSpend, '0') > -1) { - $perDay = bcdiv($leftToSpend, (string)$days); + $perDay = bcdiv($leftToSpend, (string) $days); } $return[] = [ 'key' => sprintf('left-to-spend-in-%s', $row['currency_code']), 'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $row['currency_symbol']]), - 'monetary_value' => round((float)$leftToSpend, $row['currency_decimal_places']), + 'monetary_value' => round((float) $leftToSpend, $row['currency_decimal_places']), 'currency_id' => $row['currency_id'], 'currency_code' => $row['currency_code'], 'currency_symbol' => $row['currency_symbol'], 'currency_decimal_places' => $row['currency_decimal_places'], 'value_parsed' => app('amount')->formatFlat($row['currency_symbol'], $row['currency_decimal_places'], $leftToSpend, false), 'local_icon' => 'money', - 'sub_title' => (string)trans( + 'sub_title' => (string) trans( 'firefly.box_spend_per_day', ['amount' => app('amount')->formatFlat( $row['currency_symbol'], @@ -373,7 +373,7 @@ class BasicController extends Controller foreach ($netWorthSet as $data) { /** @var TransactionCurrency $currency */ $currency = $data['currency']; - $amount = round((float)$data['balance'], $currency->decimal_places); + $amount = round((float) $data['balance'], $currency->decimal_places); if (0.0 === $amount) { continue; } diff --git a/app/Api/V1/Controllers/System/ConfigurationController.php b/app/Api/V1/Controllers/System/ConfigurationController.php index dce33eafbb..f4e98f53f3 100644 --- a/app/Api/V1/Controllers/System/ConfigurationController.php +++ b/app/Api/V1/Controllers/System/ConfigurationController.php @@ -104,8 +104,8 @@ class ConfigurationController extends Controller return [ 'is_demo_site' => $isDemoSite?->data, - 'permission_update_check' => null === $updateCheck ? null : (int)$updateCheck->data, - 'last_update_check' => null === $lastCheck ? null : (int)$lastCheck->data, + 'permission_update_check' => null === $updateCheck ? null : (int) $updateCheck->data, + 'last_update_check' => null === $lastCheck ? null : (int) $lastCheck->data, 'single_user_mode' => $singleUser?->data, ]; } diff --git a/app/Api/V1/Controllers/System/UserController.php b/app/Api/V1/Controllers/System/UserController.php index 536f0bc6ba..fadac9cdee 100644 --- a/app/Api/V1/Controllers/System/UserController.php +++ b/app/Api/V1/Controllers/System/UserController.php @@ -102,7 +102,7 @@ class UserController extends Controller public function index(): JsonResponse { // user preferences - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $manager = $this->getManager(); // build collection diff --git a/app/Api/V1/Controllers/User/PreferencesController.php b/app/Api/V1/Controllers/User/PreferencesController.php index 2eb2533c0d..08650f24ae 100644 --- a/app/Api/V1/Controllers/User/PreferencesController.php +++ b/app/Api/V1/Controllers/User/PreferencesController.php @@ -59,7 +59,7 @@ class PreferencesController extends Controller $collection = app('preferences')->all(); $manager = $this->getManager(); $count = $collection->count(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $preferences = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); // make paginator: diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index eaad374f1a..3d80cad8d7 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -77,7 +77,7 @@ class AttemptController extends Controller } $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getAttempts($message); $count = $collection->count(); $attempts = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index e6ee8a1c5d..b9fd26272e 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -68,7 +68,7 @@ class MessageController extends Controller public function index(Webhook $webhook): JsonResponse { $manager = $this->getManager(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; $collection = $this->repository->getMessages($webhook); $count = $collection->count(); diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php index 6baa755cd3..22550f00e3 100644 --- a/app/Api/V1/Controllers/Webhook/ShowController.php +++ b/app/Api/V1/Controllers/Webhook/ShowController.php @@ -70,11 +70,11 @@ class ShowController extends Controller */ public function index(): JsonResponse { - $manager = $this->getManager(); + $manager = $this->getManager(); $collection = $this->repository->all(); - $pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; - $count = $collection->count(); - $webhooks = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); + $pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data; + $count = $collection->count(); + $webhooks = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); // make paginator: $paginator = new LengthAwarePaginator($webhooks, $count, $pageSize, $this->parameters->get('page')); diff --git a/app/Api/V1/Controllers/Webhook/StoreController.php b/app/Api/V1/Controllers/Webhook/StoreController.php index 933b7331dd..a55a8659cd 100644 --- a/app/Api/V1/Controllers/Webhook/StoreController.php +++ b/app/Api/V1/Controllers/Webhook/StoreController.php @@ -64,7 +64,7 @@ class StoreController extends Controller */ public function store(CreateRequest $request): JsonResponse { - $data = $request->getData(); + $data = $request->getData(); $webhook = $this->repository->store($data); $manager = $this->getManager(); /** @var WebhookTransformer $transformer */ diff --git a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php index f28790f0dd..4cd1b85675 100644 --- a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php +++ b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php @@ -76,10 +76,10 @@ class MoveTransactionsRequest extends FormRequest if (array_key_exists('original_account', $data) && array_key_exists('destination_account', $data)) { $repository = app(AccountRepositoryInterface::class); $repository->setUser(auth()->user()); - $original = $repository->find((int)$data['original_account']); - $destination = $repository->find((int)$data['destination_account']); + $original = $repository->find((int) $data['original_account']); + $destination = $repository->find((int) $data['destination_account']); if ($original->accountType->type !== $destination->accountType->type) { - $validator->errors()->add('title', (string)trans('validation.same_account_type')); + $validator->errors()->add('title', (string) trans('validation.same_account_type')); return; } @@ -87,7 +87,7 @@ class MoveTransactionsRequest extends FormRequest $originalCurrency = $repository->getAccountCurrency($original); $destinationCurrency = $repository->getAccountCurrency($destination); if (null === $originalCurrency xor null === $destinationCurrency) { - $validator->errors()->add('title', (string)trans('validation.same_account_currency')); + $validator->errors()->add('title', (string) trans('validation.same_account_currency')); return; } @@ -96,7 +96,7 @@ class MoveTransactionsRequest extends FormRequest return; } if ($originalCurrency->code !== $destinationCurrency->code) { - $validator->errors()->add('title', (string)trans('validation.same_account_currency')); + $validator->errors()->add('title', (string) trans('validation.same_account_currency')); } } } diff --git a/app/Api/V1/Requests/Data/Export/ExportRequest.php b/app/Api/V1/Requests/Data/Export/ExportRequest.php index 78dccc2a0a..8d27d6c8ed 100644 --- a/app/Api/V1/Requests/Data/Export/ExportRequest.php +++ b/app/Api/V1/Requests/Data/Export/ExportRequest.php @@ -51,7 +51,7 @@ class ExportRequest extends FormRequest $accounts = new Collection; foreach ($parts as $part) { - $accountId = (int)$part; + $accountId = (int) $part; if (0 !== $accountId) { $account = $repository->find($accountId); if (null !== $account && AccountType::ASSET === $account->accountType->type) { diff --git a/app/Api/V1/Requests/Insight/GenericRequest.php b/app/Api/V1/Requests/Insight/GenericRequest.php index 27aed9dc1a..3eb5757ee1 100644 --- a/app/Api/V1/Requests/Insight/GenericRequest.php +++ b/app/Api/V1/Requests/Insight/GenericRequest.php @@ -94,7 +94,7 @@ class GenericRequest extends FormRequest $array = $this->get('accounts'); if (is_array($array)) { foreach ($array as $accountId) { - $accountId = (int)$accountId; + $accountId = (int) $accountId; $account = $repository->find($accountId); if (null !== $account) { $this->accounts->push($account); @@ -126,7 +126,7 @@ class GenericRequest extends FormRequest $array = $this->get('bills'); if (is_array($array)) { foreach ($array as $billId) { - $billId = (int)$billId; + $billId = (int) $billId; $bill = $repository->find($billId); if (null !== $billId) { $this->bills->push($bill); @@ -158,7 +158,7 @@ class GenericRequest extends FormRequest $array = $this->get('budgets'); if (is_array($array)) { foreach ($array as $budgetId) { - $budgetId = (int)$budgetId; + $budgetId = (int) $budgetId; $budget = $repository->find($budgetId); if (null !== $budgetId) { $this->budgets->push($budget); @@ -190,7 +190,7 @@ class GenericRequest extends FormRequest $array = $this->get('categories'); if (is_array($array)) { foreach ($array as $categoryId) { - $categoryId = (int)$categoryId; + $categoryId = (int) $categoryId; $category = $repository->find($categoryId); if (null !== $categoryId) { $this->categories->push($category); @@ -280,7 +280,7 @@ class GenericRequest extends FormRequest $array = $this->get('tags'); if (is_array($array)) { foreach ($array as $tagId) { - $tagId = (int)$tagId; + $tagId = (int) $tagId; $tag = $repository->find($tagId); if (null !== $tagId) { $this->tags->push($tag); diff --git a/app/Api/V1/Requests/Models/AvailableBudget/Request.php b/app/Api/V1/Requests/Models/AvailableBudget/Request.php index c3277c3ab0..5ffbca27bf 100644 --- a/app/Api/V1/Requests/Models/AvailableBudget/Request.php +++ b/app/Api/V1/Requests/Models/AvailableBudget/Request.php @@ -90,7 +90,7 @@ class Request extends FormRequest $start = new Carbon($data['start']); $end = new Carbon($data['end']); if ($end->isBefore($start)) { - $validator->errors()->add('end', (string)trans('validation.date_after')); + $validator->errors()->add('end', (string) trans('validation.date_after')); } } } diff --git a/app/Api/V1/Requests/Models/Bill/StoreRequest.php b/app/Api/V1/Requests/Models/Bill/StoreRequest.php index d4ea90da3a..5a90f9eab3 100644 --- a/app/Api/V1/Requests/Models/Bill/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Bill/StoreRequest.php @@ -104,10 +104,10 @@ class StoreRequest extends FormRequest $validator->after( static function (Validator $validator) { $data = $validator->getData(); - $min = (float)($data['amount_min'] ?? 0); - $max = (float)($data['amount_max'] ?? 0); + $min = (float) ($data['amount_min'] ?? 0); + $max = (float) ($data['amount_max'] ?? 0); if ($min > $max) { - $validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max')); + $validator->errors()->add('amount_min', (string) trans('validation.amount_min_over_max')); } } ); diff --git a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php index 5a3fbc91ef..7ab518c0bf 100644 --- a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php @@ -105,10 +105,10 @@ class UpdateRequest extends FormRequest static function (Validator $validator) { $data = $validator->getData(); if (array_key_exists('amount_min', $data) && array_key_exists('amount_max', $data)) { - $min = (float)($data['amount_min'] ?? 0); - $max = (float)($data['amount_max'] ?? 0); + $min = (float) ($data['amount_min'] ?? 0); + $max = (float) ($data['amount_max'] ?? 0); if ($min > $max) { - $validator->errors()->add('amount_min', (string)trans('validation.amount_min_over_max')); + $validator->errors()->add('amount_min', (string) trans('validation.amount_min_over_max')); } } } diff --git a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php index 26859034b5..fc1cec7ea5 100644 --- a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php @@ -90,7 +90,7 @@ class UpdateRequest extends FormRequest $start = new Carbon($data['start']); $end = new Carbon($data['end']); if ($end->isBefore($start)) { - $validator->errors()->add('end', (string)trans('validation.date_after')); + $validator->errors()->add('end', (string) trans('validation.date_after')); } } } diff --git a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php index 6beaeaf3f9..5da9c567bf 100644 --- a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php @@ -115,10 +115,10 @@ class StoreRequest extends FormRequest $current['moment'] = $repetition['moment']; } if (array_key_exists('skip', $repetition)) { - $current['skip'] = (int)$repetition['skip']; + $current['skip'] = (int) $repetition['skip']; } if (array_key_exists('weekend', $repetition)) { - $current['weekend'] = (int)$repetition['weekend']; + $current['weekend'] = (int) $repetition['weekend']; } $return[] = $current; @@ -135,19 +135,19 @@ class StoreRequest extends FormRequest public function rules(): array { return [ - 'type' => 'required|in:withdrawal,transfer,deposit', - 'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title', - 'description' => 'between:1,65000', - 'first_date' => 'required|date', - 'apply_rules' => [new IsBoolean], - 'active' => [new IsBoolean], - 'repeat_until' => 'nullable|date', - 'nr_of_repetitions' => 'nullable|numeric|between:1,31', + 'type' => 'required|in:withdrawal,transfer,deposit', + 'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title', + 'description' => 'between:1,65000', + 'first_date' => 'required|date', + 'apply_rules' => [new IsBoolean], + 'active' => [new IsBoolean], + 'repeat_until' => 'nullable|date', + 'nr_of_repetitions' => 'nullable|numeric|between:1,31', - 'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly', - 'repetitions.*.moment' => 'between:0,10', - 'repetitions.*.skip' => 'nullable|numeric|between:0,31', - 'repetitions.*.weekend' => 'numeric|min:1|max:4', + 'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly', + 'repetitions.*.moment' => 'between:0,10', + 'repetitions.*.skip' => 'nullable|numeric|between:0,31', + 'repetitions.*.weekend' => 'numeric|min:1|max:4', 'transactions.*.description' => 'required|between:1,255', 'transactions.*.amount' => 'required|numeric|gt:0', @@ -162,11 +162,11 @@ class StoreRequest extends FormRequest 'transactions.*.destination_name' => 'between:1,255|nullable', // new and updated fields: - 'transactions.*.budget_id' => ['nullable','mustExist:budgets,id', new BelongsUser], + 'transactions.*.budget_id' => ['nullable', 'mustExist:budgets,id', new BelongsUser], 'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser], - 'transactions.*.category_id' => ['nullable','mustExist:categories,id', new BelongsUser], + 'transactions.*.category_id' => ['nullable', 'mustExist:categories,id', new BelongsUser], 'transactions.*.category_name' => 'between:1,255|nullable', - 'transactions.*.piggy_bank_id' => ['nullable','numeric', 'mustExist:piggy_banks,id', new BelongsUser], + 'transactions.*.piggy_bank_id' => ['nullable', 'numeric', 'mustExist:piggy_banks,id', new BelongsUser], 'transactions.*.piggy_bank_name' => ['between:1,255', 'nullable', new BelongsUser], 'transactions.*.tags' => 'nullable|between:1,64000', ]; diff --git a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php index 0dd9509fec..e008cdad7c 100644 --- a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php @@ -97,15 +97,15 @@ class UpdateRequest extends FormRequest } if (array_key_exists('moment', $repetition)) { - $current['moment'] = (string)$repetition['moment']; + $current['moment'] = (string) $repetition['moment']; } if (array_key_exists('skip', $repetition)) { - $current['skip'] = (int)$repetition['skip']; + $current['skip'] = (int) $repetition['skip']; } if (array_key_exists('weekend', $repetition)) { - $current['weekend'] = (int)$repetition['weekend']; + $current['weekend'] = (int) $repetition['weekend']; } $return[] = $current; } @@ -150,13 +150,13 @@ class UpdateRequest extends FormRequest $recurrence = $this->route()->parameter('recurrence'); return [ - 'title' => sprintf('between:1,255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id), - 'description' => 'between:1,65000', - 'first_date' => 'date', - 'apply_rules' => [new IsBoolean], - 'active' => [new IsBoolean], - 'repeat_until' => 'nullable|date', - 'nr_of_repetitions' => 'nullable|numeric|between:1,31', + 'title' => sprintf('between:1,255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id), + 'description' => 'between:1,65000', + 'first_date' => 'date', + 'apply_rules' => [new IsBoolean], + 'active' => [new IsBoolean], + 'repeat_until' => 'nullable|date', + 'nr_of_repetitions' => 'nullable|numeric|between:1,31', 'repetitions.*.type' => 'in:daily,weekly,ndom,monthly,yearly', 'repetitions.*.moment' => 'between:0,10', @@ -176,11 +176,11 @@ class UpdateRequest extends FormRequest 'transactions.*.destination_name' => 'between:1,255|nullable', // new and updated fields: - 'transactions.*.budget_id' => ['nullable','mustExist:budgets,id', new BelongsUser], + 'transactions.*.budget_id' => ['nullable', 'mustExist:budgets,id', new BelongsUser], 'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser], - 'transactions.*.category_id' => ['nullable','mustExist:categories,id', new BelongsUser], + 'transactions.*.category_id' => ['nullable', 'mustExist:categories,id', new BelongsUser], 'transactions.*.category_name' => 'between:1,255|nullable', - 'transactions.*.piggy_bank_id' => ['nullable','numeric', 'mustExist:piggy_banks,id', new BelongsUser], + 'transactions.*.piggy_bank_id' => ['nullable', 'numeric', 'mustExist:piggy_banks,id', new BelongsUser], 'transactions.*.piggy_bank_name' => ['between:1,255', 'nullable', new BelongsUser], 'transactions.*.tags' => 'nullable|between:1,64000', diff --git a/app/Api/V1/Requests/Models/Rule/StoreRequest.php b/app/Api/V1/Requests/Models/Rule/StoreRequest.php index 8664e50e74..ac86fee418 100644 --- a/app/Api/V1/Requests/Models/Rule/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Rule/StoreRequest.php @@ -76,8 +76,8 @@ class StoreRequest extends FormRequest $return[] = [ 'type' => $trigger['type'], 'value' => $trigger['value'], - 'active' => $this->convertBoolean((string)($trigger['active'] ?? 'false')), - 'stop_processing' => $this->convertBoolean((string)($trigger['stop_processing'] ?? 'false')), + 'active' => $this->convertBoolean((string) ($trigger['active'] ?? 'false')), + 'stop_processing' => $this->convertBoolean((string) ($trigger['stop_processing'] ?? 'false')), ]; } } @@ -97,8 +97,8 @@ class StoreRequest extends FormRequest $return[] = [ 'type' => $action['type'], 'value' => $action['value'], - 'active' => $this->convertBoolean((string)($action['active'] ?? 'false')), - 'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')), + 'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')), + 'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')), ]; } } @@ -170,7 +170,22 @@ class StoreRequest extends FormRequest $triggers = $data['triggers'] ?? []; // need at least one trigger if (!is_countable($triggers) || empty($triggers)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_trigger')); + $validator->errors()->add('title', (string) trans('validation.at_least_one_trigger')); + } + } + + /** + * Adds an error to the validator when there are no repetitions in the array of data. + * + * @param Validator $validator + */ + protected function atLeastOneAction(Validator $validator): void + { + $data = $validator->getData(); + $actions = $data['actions'] ?? []; + // need at least one trigger + if (!is_countable($actions) || empty($actions)) { + $validator->errors()->add('title', (string) trans('validation.at_least_one_action')); } } @@ -199,7 +214,7 @@ class StoreRequest extends FormRequest } } if (true === $allInactive) { - $validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_trigger')); + $validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger')); } } @@ -228,22 +243,7 @@ class StoreRequest extends FormRequest } } if (true === $allInactive) { - $validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_action')); - } - } - - /** - * Adds an error to the validator when there are no repetitions in the array of data. - * - * @param Validator $validator - */ - protected function atLeastOneAction(Validator $validator): void - { - $data = $validator->getData(); - $actions = $data['actions'] ?? []; - // need at least one trigger - if (!is_countable($actions) || empty($actions)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_action')); + $validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action')); } } } diff --git a/app/Api/V1/Requests/Models/Rule/TestRequest.php b/app/Api/V1/Requests/Models/Rule/TestRequest.php index 6b77117878..640ca7c218 100644 --- a/app/Api/V1/Requests/Models/Rule/TestRequest.php +++ b/app/Api/V1/Requests/Models/Rule/TestRequest.php @@ -55,7 +55,7 @@ class TestRequest extends FormRequest */ private function getPage(): int { - return 0 === (int)$this->query('page') ? 1 : (int)$this->query('page'); + return 0 === (int) $this->query('page') ? 1 : (int) $this->query('page'); } diff --git a/app/Api/V1/Requests/Models/Rule/TriggerRequest.php b/app/Api/V1/Requests/Models/Rule/TriggerRequest.php index 89d4c359a8..932c54a0b2 100644 --- a/app/Api/V1/Requests/Models/Rule/TriggerRequest.php +++ b/app/Api/V1/Requests/Models/Rule/TriggerRequest.php @@ -55,7 +55,7 @@ class TriggerRequest extends FormRequest */ private function getDate(string $field): ?Carbon { - return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($this->query($field),0,10)); + return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($this->query($field), 0, 10)); } /** diff --git a/app/Api/V1/Requests/Models/Rule/UpdateRequest.php b/app/Api/V1/Requests/Models/Rule/UpdateRequest.php index e9a6764985..6f18a7400c 100644 --- a/app/Api/V1/Requests/Models/Rule/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Rule/UpdateRequest.php @@ -110,8 +110,8 @@ class UpdateRequest extends FormRequest $return[] = [ 'type' => $action['type'], 'value' => $action['value'], - 'active' => $this->convertBoolean((string)($action['active'] ?? 'false')), - 'stop_processing' => $this->convertBoolean((string)($action['stop_processing'] ?? 'false')), + 'active' => $this->convertBoolean((string) ($action['active'] ?? 'false')), + 'stop_processing' => $this->convertBoolean((string) ($action['stop_processing'] ?? 'false')), ]; } } @@ -185,7 +185,7 @@ class UpdateRequest extends FormRequest $triggers = $data['triggers'] ?? null; // need at least one trigger if (is_array($triggers) && empty($triggers)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_trigger')); + $validator->errors()->add('title', (string) trans('validation.at_least_one_trigger')); } } @@ -214,7 +214,7 @@ class UpdateRequest extends FormRequest } } if (true === $allInactive) { - $validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_trigger')); + $validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger')); } } @@ -229,7 +229,7 @@ class UpdateRequest extends FormRequest $actions = $data['actions'] ?? null; // need at least one action if (is_array($actions) && empty($actions)) { - $validator->errors()->add('title', (string)trans('validation.at_least_one_action')); + $validator->errors()->add('title', (string) trans('validation.at_least_one_action')); } } @@ -259,7 +259,7 @@ class UpdateRequest extends FormRequest } } if (true === $allInactive) { - $validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string)trans('validation.at_least_one_active_action')); + $validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action')); } } } diff --git a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php index f7dace4d65..69c44249dc 100644 --- a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php @@ -80,73 +80,73 @@ class StoreRequest extends FormRequest $return[] = [ 'type' => $this->clearString($object['type'], false), 'date' => $this->dateFromValue($object['date']), - 'order' => $this->integerFromValue((string)$object['order']), + 'order' => $this->integerFromValue((string) $object['order']), - 'currency_id' => $this->integerFromValue((string)$object['currency_id']), - 'currency_code' => $this->clearString((string)$object['currency_code'], false), + 'currency_id' => $this->integerFromValue((string) $object['currency_id']), + 'currency_code' => $this->clearString((string) $object['currency_code'], false), // foreign currency info: - 'foreign_currency_id' => $this->integerFromValue((string)$object['foreign_currency_id']), - 'foreign_currency_code' => $this->clearString((string)$object['foreign_currency_code'], false), + 'foreign_currency_id' => $this->integerFromValue((string) $object['foreign_currency_id']), + 'foreign_currency_code' => $this->clearString((string) $object['foreign_currency_code'], false), // amount and foreign amount. Cannot be 0. - 'amount' => $this->clearString((string)$object['amount'], false), - 'foreign_amount' => $this->clearString((string)$object['foreign_amount'], false), + 'amount' => $this->clearString((string) $object['amount'], false), + 'foreign_amount' => $this->clearString((string) $object['foreign_amount'], false), // description. 'description' => $this->clearString($object['description'], false), // source of transaction. If everything is null, assume cash account. - 'source_id' => $this->integerFromValue((string)$object['source_id']), - 'source_name' => $this->clearString((string)$object['source_name'], false), - 'source_iban' => $this->clearString((string)$object['source_iban'], false), - 'source_number' => $this->clearString((string)$object['source_number'], false), - 'source_bic' => $this->clearString((string)$object['source_bic'], false), + 'source_id' => $this->integerFromValue((string) $object['source_id']), + 'source_name' => $this->clearString((string) $object['source_name'], false), + 'source_iban' => $this->clearString((string) $object['source_iban'], false), + 'source_number' => $this->clearString((string) $object['source_number'], false), + 'source_bic' => $this->clearString((string) $object['source_bic'], false), // destination of transaction. If everything is null, assume cash account. - 'destination_id' => $this->integerFromValue((string)$object['destination_id']), - 'destination_name' => $this->clearString((string)$object['destination_name'], false), - 'destination_iban' => $this->clearString((string)$object['destination_iban'], false), - 'destination_number' => $this->clearString((string)$object['destination_number'], false), - 'destination_bic' => $this->clearString((string)$object['destination_bic'], false), + 'destination_id' => $this->integerFromValue((string) $object['destination_id']), + 'destination_name' => $this->clearString((string) $object['destination_name'], false), + 'destination_iban' => $this->clearString((string) $object['destination_iban'], false), + 'destination_number' => $this->clearString((string) $object['destination_number'], false), + 'destination_bic' => $this->clearString((string) $object['destination_bic'], false), // budget info - 'budget_id' => $this->integerFromValue((string)$object['budget_id']), - 'budget_name' => $this->clearString((string)$object['budget_name'], false), + 'budget_id' => $this->integerFromValue((string) $object['budget_id']), + 'budget_name' => $this->clearString((string) $object['budget_name'], false), // category info - 'category_id' => $this->integerFromValue((string)$object['category_id']), - 'category_name' => $this->clearString((string)$object['category_name'], false), + 'category_id' => $this->integerFromValue((string) $object['category_id']), + 'category_name' => $this->clearString((string) $object['category_name'], false), // journal bill reference. Optional. Will only work for withdrawals - 'bill_id' => $this->integerFromValue((string)$object['bill_id']), - 'bill_name' => $this->clearString((string)$object['bill_name'], false), + 'bill_id' => $this->integerFromValue((string) $object['bill_id']), + 'bill_name' => $this->clearString((string) $object['bill_name'], false), // piggy bank reference. Optional. Will only work for transfers - 'piggy_bank_id' => $this->integerFromValue((string)$object['piggy_bank_id']), - 'piggy_bank_name' => $this->clearString((string)$object['piggy_bank_name'], false), + 'piggy_bank_id' => $this->integerFromValue((string) $object['piggy_bank_id']), + 'piggy_bank_name' => $this->clearString((string) $object['piggy_bank_name'], false), // some other interesting properties - 'reconciled' => $this->convertBoolean((string)$object['reconciled']), - 'notes' => $this->clearString((string)$object['notes']), + 'reconciled' => $this->convertBoolean((string) $object['reconciled']), + 'notes' => $this->clearString((string) $object['notes']), 'tags' => $this->arrayFromValue($object['tags']), // all custom fields: - 'internal_reference' => $this->clearString((string)$object['internal_reference'], false), - 'external_id' => $this->clearString((string)$object['external_id'], false), + 'internal_reference' => $this->clearString((string) $object['internal_reference'], false), + 'external_id' => $this->clearString((string) $object['external_id'], false), 'original_source' => sprintf('ff3-v%s|api-v%s', config('firefly.version'), config('firefly.api_version')), 'recurrence_id' => $this->integerFromValue($object['recurrence_id']), - 'bunq_payment_id' => $this->clearString((string)$object['bunq_payment_id'], false), - 'external_url' => $this->clearString((string)$object['external_url'], false), + 'bunq_payment_id' => $this->clearString((string) $object['bunq_payment_id'], false), + 'external_url' => $this->clearString((string) $object['external_url'], false), - 'sepa_cc' => $this->clearString((string)$object['sepa_cc'], false), - 'sepa_ct_op' => $this->clearString((string)$object['sepa_ct_op'], false), - 'sepa_ct_id' => $this->clearString((string)$object['sepa_ct_id'], false), - 'sepa_db' => $this->clearString((string)$object['sepa_db'], false), - 'sepa_country' => $this->clearString((string)$object['sepa_country'], false), - 'sepa_ep' => $this->clearString((string)$object['sepa_ep'], false), - 'sepa_ci' => $this->clearString((string)$object['sepa_ci'], false), - 'sepa_batch_id' => $this->clearString((string)$object['sepa_batch_id'], false), + 'sepa_cc' => $this->clearString((string) $object['sepa_cc'], false), + 'sepa_ct_op' => $this->clearString((string) $object['sepa_ct_op'], false), + 'sepa_ct_id' => $this->clearString((string) $object['sepa_ct_id'], false), + 'sepa_db' => $this->clearString((string) $object['sepa_db'], false), + 'sepa_country' => $this->clearString((string) $object['sepa_country'], false), + 'sepa_ep' => $this->clearString((string) $object['sepa_ep'], false), + 'sepa_ci' => $this->clearString((string) $object['sepa_ci'], false), + 'sepa_batch_id' => $this->clearString((string) $object['sepa_batch_id'], false), // custom date fields. Must be Carbon objects. Presence is optional. 'interest_date' => $this->dateFromValue($object['interest_date']), 'book_date' => $this->dateFromValue($object['book_date']), @@ -211,7 +211,7 @@ class StoreRequest extends FormRequest // budget, category, bill and piggy 'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser], 'transactions.*.budget_name' => ['between:1,255', 'nullable', new BelongsUser], - 'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser,'nullable'], + 'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser, 'nullable'], 'transactions.*.category_name' => 'between:1,255|nullable', 'transactions.*.bill_id' => ['numeric', 'nullable', 'mustExist:bills,id', new BelongsUser], 'transactions.*.bill_name' => ['between:1,255', 'nullable', new BelongsUser], diff --git a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php index c22b71723b..f9db392594 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php @@ -102,8 +102,8 @@ class StoreRequest extends FormRequest $journalRepos->setUser($user); $data = $validator->getData(); - $inwardId = (int)($data['inward_id'] ?? 0); - $outwardId = (int)($data['outward_id'] ?? 0); + $inwardId = (int) ($data['inward_id'] ?? 0); + $outwardId = (int) ($data['outward_id'] ?? 0); $inward = $journalRepos->find($inwardId); $outward = $journalRepos->find($outwardId); diff --git a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php index a22c207bff..ddfbd7fd50 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php @@ -104,8 +104,8 @@ class UpdateRequest extends FormRequest $inwardId = $data['inward_id'] ?? $existing->source_id; $outwardId = $data['outward_id'] ?? $existing->destination_id; - $inward = $journalRepos->find((int)$inwardId); - $outward = $journalRepos->find((int)$outwardId); + $inward = $journalRepos->find((int) $inwardId); + $outward = $journalRepos->find((int) $outwardId); if (null === $inward) { $inward = $existing->source; } diff --git a/app/Api/V1/Requests/System/UserUpdateRequest.php b/app/Api/V1/Requests/System/UserUpdateRequest.php index 7e94a3ad96..adb44107ab 100644 --- a/app/Api/V1/Requests/System/UserUpdateRequest.php +++ b/app/Api/V1/Requests/System/UserUpdateRequest.php @@ -95,7 +95,7 @@ class UserUpdateRequest extends FormRequest { $current = $this->route()->parameter('user'); $validator->after( - static function (Validator $validator) use($current) { + static function (Validator $validator) use ($current) { $isAdmin = auth()->user()->hasRole('owner'); // not admin, and not own user? if (auth()->check() && false === $isAdmin && $current?->id !== auth()->user()->id) { diff --git a/app/Api/V1/Requests/User/PreferenceStoreRequest.php b/app/Api/V1/Requests/User/PreferenceStoreRequest.php index 5e7037c136..18f513fd85 100644 --- a/app/Api/V1/Requests/User/PreferenceStoreRequest.php +++ b/app/Api/V1/Requests/User/PreferenceStoreRequest.php @@ -47,7 +47,7 @@ class PreferenceStoreRequest extends FormRequest $array['data'] = false; } if (is_numeric($array['data'])) { - $array['data'] = (float)$array['data']; + $array['data'] = (float) $array['data']; } return $array; diff --git a/app/Api/V1/Requests/User/PreferenceUpdateRequest.php b/app/Api/V1/Requests/User/PreferenceUpdateRequest.php index 067fd12730..0c6d66bd4f 100644 --- a/app/Api/V1/Requests/User/PreferenceUpdateRequest.php +++ b/app/Api/V1/Requests/User/PreferenceUpdateRequest.php @@ -48,7 +48,7 @@ class PreferenceUpdateRequest extends FormRequest $array['data'] = false; } if (is_numeric($array['data'])) { - $array['data'] = (float)$array['data']; + $array['data'] = (float) $array['data']; } return $array; diff --git a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php index 9055e0aa34..5a7551c361 100644 --- a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php +++ b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php @@ -155,7 +155,7 @@ class CorrectOpeningBalanceCurrencies extends Command private function setCurrency(TransactionJournal $journal, TransactionCurrency $currency): int { $count = 0; - if ((int)$journal->transaction_currency_id !== (int)$currency->id) { + if ((int) $journal->transaction_currency_id !== (int) $currency->id) { $journal->transaction_currency_id = $currency->id; $journal->save(); $count = 1; @@ -163,7 +163,7 @@ class CorrectOpeningBalanceCurrencies extends Command /** @var Transaction $transaction */ foreach ($journal->transactions as $transaction) { - if ((int)$transaction->transaction_currency_id !== (int)$currency->id) { + if ((int) $transaction->transaction_currency_id !== (int) $currency->id) { $transaction->transaction_currency_id = $currency->id; $transaction->save(); $count = 1; diff --git a/app/Console/Commands/Correction/DeleteEmptyJournals.php b/app/Console/Commands/Correction/DeleteEmptyJournals.php index f73b293a5d..d1b4d4451a 100644 --- a/app/Console/Commands/Correction/DeleteEmptyJournals.php +++ b/app/Console/Commands/Correction/DeleteEmptyJournals.php @@ -73,18 +73,18 @@ class DeleteEmptyJournals extends Command $total = 0; /** @var Transaction $row */ foreach ($set as $row) { - $count = (int)$row->the_count; + $count = (int) $row->the_count; if (1 === $count % 2) { // uneven number, delete journal and transactions: try { - TransactionJournal::find((int)$row->transaction_journal_id)->delete(); + TransactionJournal::find((int) $row->transaction_journal_id)->delete(); } catch (Exception $e) { // @phpstan-ignore-line Log::info(sprintf('Could not delete journal: %s', $e->getMessage())); } - Transaction::where('transaction_journal_id', (int)$row->transaction_journal_id)->delete(); + Transaction::where('transaction_journal_id', (int) $row->transaction_journal_id)->delete(); $this->info(sprintf('Deleted transaction journal #%d because it had an uneven number of transactions.', $row->transaction_journal_id)); $total++; } diff --git a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php index 359930b51a..9e54af2e0f 100644 --- a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php +++ b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php @@ -84,7 +84,7 @@ class DeleteOrphanedTransactions extends Command ); /** @var stdClass $entry */ foreach ($set as $entry) { - $transaction = Transaction::find((int)$entry->transaction_id); + $transaction = Transaction::find((int) $entry->transaction_id); $transaction->delete(); $this->info( sprintf( @@ -106,7 +106,7 @@ class DeleteOrphanedTransactions extends Command private function deleteFromOrphanedAccounts(): void { $set - = Transaction + = Transaction ::leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id') ->whereNotNull('accounts.deleted_at') ->get(['transactions.*']); @@ -114,7 +114,7 @@ class DeleteOrphanedTransactions extends Command /** @var Transaction $transaction */ foreach ($set as $transaction) { // delete journals - $journal = TransactionJournal::find((int)$transaction->transaction_journal_id); + $journal = TransactionJournal::find((int) $transaction->transaction_journal_id); if ($journal) { try { $journal->delete(); @@ -124,7 +124,7 @@ class DeleteOrphanedTransactions extends Command } } - Transaction::where('transaction_journal_id', (int)$transaction->transaction_journal_id)->delete(); + Transaction::where('transaction_journal_id', (int) $transaction->transaction_journal_id)->delete(); $this->line( sprintf( 'Deleted transaction journal #%d because account #%d was already deleted.', diff --git a/app/Console/Commands/Correction/EnableCurrencies.php b/app/Console/Commands/Correction/EnableCurrencies.php index b0046ee6fa..3e1aaee2d1 100644 --- a/app/Console/Commands/Correction/EnableCurrencies.php +++ b/app/Console/Commands/Correction/EnableCurrencies.php @@ -63,30 +63,30 @@ class EnableCurrencies extends Command /** @var Collection $meta */ $meta = AccountMeta::where('name', 'currency_id')->groupBy('data')->get(['data']); foreach ($meta as $entry) { - $found[] = (int)$entry->data; + $found[] = (int) $entry->data; } // get all from journals: $journals = TransactionJournal::groupBy('transaction_currency_id')->get(['transaction_currency_id']); foreach ($journals as $entry) { - $found[] = (int)$entry->transaction_currency_id; + $found[] = (int) $entry->transaction_currency_id; } // get all from transactions $transactions = Transaction::groupBy('transaction_currency_id', 'foreign_currency_id')->get(['transaction_currency_id', 'foreign_currency_id']); foreach ($transactions as $entry) { - $found[] = (int)$entry->transaction_currency_id; - $found[] = (int)$entry->foreign_currency_id; + $found[] = (int) $entry->transaction_currency_id; + $found[] = (int) $entry->foreign_currency_id; } // get all from budget limits $limits = BudgetLimit::groupBy('transaction_currency_id')->get(['transaction_currency_id']); foreach ($limits as $entry) { - $found[] = (int)$entry->transaction_currency_id; + $found[] = (int) $entry->transaction_currency_id; } - $found = array_values(array_unique($found)); - $found = array_values( + $found = array_values(array_unique($found)); + $found = array_values( array_filter( $found, function (int $currencyId) { return $currencyId !== 0; diff --git a/app/Console/Commands/Correction/FixFrontpageAccounts.php b/app/Console/Commands/Correction/FixFrontpageAccounts.php index a1f5e7e2d2..64372c7db4 100644 --- a/app/Console/Commands/Correction/FixFrontpageAccounts.php +++ b/app/Console/Commands/Correction/FixFrontpageAccounts.php @@ -88,7 +88,7 @@ class FixFrontpageAccounts extends Command if (is_array($data)) { /** @var string $accountId */ foreach ($data as $accountId) { - $accountIdInt = (int)$accountId; + $accountIdInt = (int) $accountId; $account = $repository->find($accountIdInt); if (null !== $account && in_array($account->accountType->type, [AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE], true) diff --git a/app/Console/Commands/Correction/FixGroupAccounts.php b/app/Console/Commands/Correction/FixGroupAccounts.php index 7b818ce46e..9ed55a330e 100644 --- a/app/Console/Commands/Correction/FixGroupAccounts.php +++ b/app/Console/Commands/Correction/FixGroupAccounts.php @@ -62,8 +62,8 @@ class FixGroupAccounts extends Command ->get(['transaction_group_id', DB::raw('COUNT(transaction_group_id) as the_count')]); /** @var TransactionJournal $journal */ foreach ($res as $journal) { - if ((int)$journal->the_count > 1) { - $groups[] = (int)$journal->transaction_group_id; + if ((int) $journal->the_count > 1) { + $groups[] = (int) $journal->transaction_group_id; } } $handler = new UpdatedGroupEventHandler; diff --git a/app/Console/Commands/Correction/FixIbans.php b/app/Console/Commands/Correction/FixIbans.php index 259b916dc9..6ecf3a1a62 100644 --- a/app/Console/Commands/Correction/FixIbans.php +++ b/app/Console/Commands/Correction/FixIbans.php @@ -58,7 +58,7 @@ class FixIbans extends Command $iban = $account->iban; if (str_contains($iban, ' ')) { - $iban = app('steam')->filterSpaces((string)$account->iban); + $iban = app('steam')->filterSpaces((string) $account->iban); if ('' !== $iban) { $account->iban = $iban; $account->save(); diff --git a/app/Console/Commands/Correction/FixLongDescriptions.php b/app/Console/Commands/Correction/FixLongDescriptions.php index 32fa810ec7..2dfd02d15b 100644 --- a/app/Console/Commands/Correction/FixLongDescriptions.php +++ b/app/Console/Commands/Correction/FixLongDescriptions.php @@ -68,7 +68,7 @@ class FixLongDescriptions extends Command $groups = TransactionGroup::get(['id', 'title']); /** @var TransactionGroup $group */ foreach ($groups as $group) { - if (strlen((string)$group->title) > self::MAX_LENGTH) { + if (strlen((string) $group->title) > self::MAX_LENGTH) { $group->title = substr($group->title, 0, self::MAX_LENGTH); $group->save(); $this->line(sprintf('Truncated description of transaction group #%d', $group->id)); diff --git a/app/Console/Commands/Correction/FixTransactionTypes.php b/app/Console/Commands/Correction/FixTransactionTypes.php index a3a01326e7..02296d3a36 100644 --- a/app/Console/Commands/Correction/FixTransactionTypes.php +++ b/app/Console/Commands/Correction/FixTransactionTypes.php @@ -106,7 +106,7 @@ class FixTransactionTypes extends Command return false; } - $expectedType = (string)config(sprintf('firefly.account_to_transaction.%s.%s', $source->accountType->type, $destination->accountType->type)); + $expectedType = (string) config(sprintf('firefly.account_to_transaction.%s.%s', $source->accountType->type, $destination->accountType->type)); if ($expectedType !== $type) { $this->line(sprintf('Transaction journal #%d was of type "%s" but is corrected to "%s"', $journal->id, $type, $expectedType)); $this->changeJournal($journal, $expectedType); diff --git a/app/Console/Commands/Correction/FixUnevenAmount.php b/app/Console/Commands/Correction/FixUnevenAmount.php index 73deae867c..f02cb4e445 100644 --- a/app/Console/Commands/Correction/FixUnevenAmount.php +++ b/app/Console/Commands/Correction/FixUnevenAmount.php @@ -65,11 +65,11 @@ class FixUnevenAmount extends Command ->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]); /** @var stdClass $entry */ foreach ($journals as $entry) { - if (0 !== bccomp((string)$entry->the_sum, '0')) { + if (0 !== bccomp((string) $entry->the_sum, '0')) { $message = sprintf('Sum of journal #%d is %s instead of zero.', $entry->transaction_journal_id, $entry->the_sum); $this->warn($message); Log::warning($message); - $this->fixJournal((int)$entry->transaction_journal_id); + $this->fixJournal((int) $entry->transaction_journal_id); $count++; } } @@ -110,7 +110,7 @@ class FixUnevenAmount extends Command return; } - $amount = bcmul('-1', (string)$source->amount); + $amount = bcmul('-1', (string) $source->amount); // fix amount of destination: /** @var Transaction $destination */ diff --git a/app/Console/Commands/DecryptDatabase.php b/app/Console/Commands/DecryptDatabase.php index 60897032f4..d61198110f 100644 --- a/app/Console/Commands/DecryptDatabase.php +++ b/app/Console/Commands/DecryptDatabase.php @@ -120,7 +120,7 @@ class DecryptDatabase extends Command Log::error($e->getMessage()); } if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -150,7 +150,7 @@ class DecryptDatabase extends Command if (null === $original) { return; } - $id = (int)$row->id; + $id = (int) $row->id; $value = ''; try { @@ -215,7 +215,7 @@ class DecryptDatabase extends Command } /** @var Preference $object */ - $object = Preference::find((int)$id); + $object = Preference::find((int) $id); if (null !== $object) { $object->data = $newValue; $object->save(); diff --git a/app/Console/Commands/Export/ExportData.php b/app/Console/Commands/Export/ExportData.php index c4786d67d0..7aea9a3df4 100644 --- a/app/Console/Commands/Export/ExportData.php +++ b/app/Console/Commands/Export/ExportData.php @@ -202,7 +202,7 @@ class ExportData extends Command $error = true; } } - if(null === $this->option($field)) { + if (null === $this->option($field)) { Log::info(sprintf('No date given in field "%s"', $field)); $error = true; } @@ -234,7 +234,7 @@ class ExportData extends Command $accounts = new Collection; $accountList = $this->option('accounts'); $types = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]; - if (null !== $accountList && '' !== (string)$accountList) { + if (null !== $accountList && '' !== (string) $accountList) { $accountIds = explode(',', $accountList); $accounts = $this->accountRepository->getAccountsById($accountIds); } @@ -262,7 +262,7 @@ class ExportData extends Command */ private function getExportDirectory(): string { - $directory = (string)$this->option('export_directory'); + $directory = (string) $this->option('export_directory'); if (null === $directory) { $directory = './'; } diff --git a/app/Console/Commands/Integrity/ReportSum.php b/app/Console/Commands/Integrity/ReportSum.php index a9b6054269..f88fe087d1 100644 --- a/app/Console/Commands/Integrity/ReportSum.php +++ b/app/Console/Commands/Integrity/ReportSum.php @@ -68,7 +68,7 @@ class ReportSum extends Command /** @var User $user */ foreach ($userRepository->all() as $user) { - $sum = (string)$user->transactions()->sum('amount'); + $sum = (string) $user->transactions()->sum('amount'); if (0 !== bccomp($sum, '0')) { $message = sprintf('Error: Transactions for user #%d (%s) are off by %s!', $user->id, $user->email, $sum); $this->error($message); diff --git a/app/Console/Commands/Integrity/RestoreOAuthKeys.php b/app/Console/Commands/Integrity/RestoreOAuthKeys.php index a9bc0f1e78..3e50f177e3 100644 --- a/app/Console/Commands/Integrity/RestoreOAuthKeys.php +++ b/app/Console/Commands/Integrity/RestoreOAuthKeys.php @@ -75,7 +75,7 @@ class RestoreOAuthKeys extends Command if ($this->keysInDatabase() && !$this->keysOnDrive()) { Log::debug('Keys are in DB and keys are not on the drive. Restore.'); $result = $this->restoreKeysFromDB(); - if(true === $result) { + if (true === $result) { $this->line('Restored OAuth keys from database.'); return; diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php index 5ad5c240c2..0e4cf33cfb 100644 --- a/app/Console/Commands/Tools/ApplyRules.php +++ b/app/Console/Commands/Tools/ApplyRules.php @@ -212,7 +212,7 @@ class ApplyRules extends Command $accountRepository = app(AccountRepositoryInterface::class); $accountRepository->setUser($this->getUser()); foreach ($accountList as $accountId) { - $accountId = (int)$accountId; + $accountId = (int) $accountId; $account = $accountRepository->find($accountId); if (null !== $account && in_array($account->accountType->type, $this->acceptedAccounts, true)) { $finalList->push($account); @@ -243,7 +243,7 @@ class ApplyRules extends Command $ruleGroupList = explode(',', $ruleGroupString); foreach ($ruleGroupList as $ruleGroupId) { - $ruleGroup = $this->ruleGroupRepository->find((int)$ruleGroupId); + $ruleGroup = $this->ruleGroupRepository->find((int) $ruleGroupId); if ($ruleGroup->active) { $this->ruleGroupSelection[] = $ruleGroup->id; } @@ -268,7 +268,7 @@ class ApplyRules extends Command $ruleList = explode(',', $ruleString); foreach ($ruleList as $ruleId) { - $rule = $this->ruleRepository->find((int)$ruleId); + $rule = $this->ruleRepository->find((int) $ruleId); if (null !== $rule && $rule->active) { $this->ruleSelection[] = $rule->id; } diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php index f838791e51..7c0744a36f 100644 --- a/app/Console/Commands/Tools/Cron.php +++ b/app/Console/Commands/Tools/Cron.php @@ -27,8 +27,8 @@ namespace FireflyIII\Console\Commands\Tools; use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Support\Cronjobs\AutoBudgetCronjob; -use FireflyIII\Support\Cronjobs\RecurringCronjob; use FireflyIII\Support\Cronjobs\BillWarningCronjob; +use FireflyIII\Support\Cronjobs\RecurringCronjob; use Illuminate\Console\Command; use InvalidArgumentException; use Log; diff --git a/app/Console/Commands/Upgrade/AccountCurrencies.php b/app/Console/Commands/Upgrade/AccountCurrencies.php index 4cad1423e6..aee591a266 100644 --- a/app/Console/Commands/Upgrade/AccountCurrencies.php +++ b/app/Console/Commands/Upgrade/AccountCurrencies.php @@ -114,7 +114,7 @@ class AccountCurrencies extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -127,7 +127,7 @@ class AccountCurrencies extends Command { Log::debug('Now in updateAccountCurrencies()'); $users = $this->userRepos->all(); - $defaultCurrencyCode = (string)config('firefly.default_currency', 'EUR'); + $defaultCurrencyCode = (string) config('firefly.default_currency', 'EUR'); Log::debug(sprintf('Default currency is %s', $defaultCurrencyCode)); foreach ($users as $user) { $this->updateCurrenciesForUser($user, $defaultCurrencyCode); @@ -178,13 +178,13 @@ class AccountCurrencies extends Command Log::debug(sprintf('Now in updateAccount(%d, %s)', $account->id, $currency->code)); $this->accountRepos->setUser($account->user); - $accountCurrency = (int)$this->accountRepos->getMetaValue($account, 'currency_id'); + $accountCurrency = (int) $this->accountRepos->getMetaValue($account, 'currency_id'); Log::debug(sprintf('Account currency is #%d', $accountCurrency)); $openingBalance = $this->accountRepos->getOpeningBalance($account); $obCurrency = 0; if (null !== $openingBalance) { - $obCurrency = (int)$openingBalance->transaction_currency_id; + $obCurrency = (int) $openingBalance->transaction_currency_id; Log::debug('Account has opening balance.'); } Log::debug(sprintf('Account OB currency is #%d.', $obCurrency)); diff --git a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php index e4e15ac63a..be4064112c 100644 --- a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php +++ b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php @@ -77,7 +77,7 @@ class AppendBudgetLimitPeriods extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); - return (bool)$configVar->data; + return (bool) $configVar->data; } /** diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.php index ab66fda7b7..72e02734c3 100644 --- a/app/Console/Commands/Upgrade/BackToJournals.php +++ b/app/Console/Commands/Upgrade/BackToJournals.php @@ -91,7 +91,7 @@ class BackToJournals extends Command { $configVar = app('fireflyconfig')->get(MigrateToGroups::CONFIG_NAME, false); - return (bool)$configVar->data; + return (bool) $configVar->data; } /** @@ -102,7 +102,7 @@ class BackToJournals extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); - return (bool)$configVar->data; + return (bool) $configVar->data; } /** @@ -179,7 +179,7 @@ class BackToJournals extends Command // both have a budget, but they don't match. if (null !== $budget && null !== $journalBudget && $budget->id !== $journalBudget->id) { // sync to journal: - $journal->budgets()->sync([(int)$budget->id]); + $journal->budgets()->sync([(int) $budget->id]); return; } @@ -187,7 +187,7 @@ class BackToJournals extends Command // transaction has a budget, but the journal doesn't. if (null !== $budget && null === $journalBudget) { // sync to journal: - $journal->budgets()->sync([(int)$budget->id]); + $journal->budgets()->sync([(int) $budget->id]); } } @@ -258,12 +258,12 @@ class BackToJournals extends Command // both have a category, but they don't match. if (null !== $category && null !== $journalCategory && $category->id !== $journalCategory->id) { // sync to journal: - $journal->categories()->sync([(int)$category->id]); + $journal->categories()->sync([(int) $category->id]); } // transaction has a category, but the journal doesn't. if (null !== $category && null === $journalCategory) { - $journal->categories()->sync([(int)$category->id]); + $journal->categories()->sync([(int) $category->id]); } } diff --git a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php index af7aa203c8..de1ae16a88 100644 --- a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php +++ b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php @@ -104,7 +104,7 @@ class BudgetLimitCurrency extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/CCLiabilities.php b/app/Console/Commands/Upgrade/CCLiabilities.php index 0f9f365de6..b991ab7645 100644 --- a/app/Console/Commands/Upgrade/CCLiabilities.php +++ b/app/Console/Commands/Upgrade/CCLiabilities.php @@ -101,7 +101,7 @@ class CCLiabilities extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/CreateGroupMemberships.php b/app/Console/Commands/Upgrade/CreateGroupMemberships.php index 43cbc71429..46df59312f 100644 --- a/app/Console/Commands/Upgrade/CreateGroupMemberships.php +++ b/app/Console/Commands/Upgrade/CreateGroupMemberships.php @@ -82,7 +82,7 @@ class CreateGroupMemberships extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/MigrateAttachments.php b/app/Console/Commands/Upgrade/MigrateAttachments.php index 6d210b95e1..b6528fdd39 100644 --- a/app/Console/Commands/Upgrade/MigrateAttachments.php +++ b/app/Console/Commands/Upgrade/MigrateAttachments.php @@ -72,7 +72,7 @@ class MigrateAttachments extends Command foreach ($attachments as $att) { // move description: - $attDescription = (string)$att->description; + $attDescription = (string) $att->description; if ('' !== $attDescription) { // find or create note: @@ -113,7 +113,7 @@ class MigrateAttachments extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.php index 698b696f28..3a66032342 100644 --- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php +++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php @@ -111,7 +111,7 @@ class MigrateJournalNotes extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php index a4c74d1731..3207539056 100644 --- a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php +++ b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php @@ -89,7 +89,7 @@ class MigrateRecurrenceMeta extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php index ad99981512..794e03ffe0 100644 --- a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php +++ b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php @@ -82,7 +82,7 @@ class MigrateRecurrenceType extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -104,7 +104,7 @@ class MigrateRecurrenceType extends Command private function migrateRecurrence(Recurrence $recurrence): void { - $originalType = (int)$recurrence->transaction_type_id; + $originalType = (int) $recurrence->transaction_type_id; $newType = $this->getInvalidType(); $recurrence->transaction_type_id = $newType->id; $recurrence->save(); diff --git a/app/Console/Commands/Upgrade/MigrateTagLocations.php b/app/Console/Commands/Upgrade/MigrateTagLocations.php index e5162cdbf6..07a615effb 100644 --- a/app/Console/Commands/Upgrade/MigrateTagLocations.php +++ b/app/Console/Commands/Upgrade/MigrateTagLocations.php @@ -80,7 +80,7 @@ class MigrateTagLocations extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/MigrateToGroups.php b/app/Console/Commands/Upgrade/MigrateToGroups.php index dcf11e2cca..d033b2c25e 100644 --- a/app/Console/Commands/Upgrade/MigrateToGroups.php +++ b/app/Console/Commands/Upgrade/MigrateToGroups.php @@ -134,7 +134,7 @@ class MigrateToGroups extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -328,7 +328,7 @@ class MigrateToGroups extends Command { $set = $journal->transactions->filter( static function (Transaction $subject) use ($transaction) { - $amount = (float)$transaction->amount * -1 === (float)$subject->amount; + $amount = (float) $transaction->amount * -1 === (float) $subject->amount; $identifier = $transaction->identifier === $subject->identifier; Log::debug(sprintf('Amount the same? %s', var_export($amount, true))); Log::debug(sprintf('ID the same? %s', var_export($identifier, true))); @@ -356,7 +356,7 @@ class MigrateToGroups extends Command if (null !== $budget) { Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id)); - return (int)$budget->id; + return (int) $budget->id; } // try to get a budget ID from the right transaction: @@ -365,7 +365,7 @@ class MigrateToGroups extends Command if (null !== $budget) { Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id)); - return (int)$budget->id; + return (int) $budget->id; } Log::debug('Neither left or right have a budget, return NULL'); @@ -389,7 +389,7 @@ class MigrateToGroups extends Command if (null !== $category) { Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id)); - return (int)$category->id; + return (int) $category->id; } // try to get a category ID from the left transaction: @@ -398,7 +398,7 @@ class MigrateToGroups extends Command if (null !== $category) { Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id)); - return (int)$category->id; + return (int) $category->id; } Log::debug('Neither left or right have a category, return NULL'); diff --git a/app/Console/Commands/Upgrade/MigrateToRules.php b/app/Console/Commands/Upgrade/MigrateToRules.php index 25f96d8c6e..c7327c20c3 100644 --- a/app/Console/Commands/Upgrade/MigrateToRules.php +++ b/app/Console/Commands/Upgrade/MigrateToRules.php @@ -125,7 +125,7 @@ class MigrateToRules extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -146,14 +146,14 @@ class MigrateToRules extends Command /** @var Preference $lang */ $lang = app('preferences')->getForUser($user, 'language', 'en_US'); - $groupTitle = (string)trans('firefly.rulegroup_for_bills_title', [], $lang->data); + $groupTitle = (string) trans('firefly.rulegroup_for_bills_title', [], $lang->data); $ruleGroup = $this->ruleGroupRepository->findByTitle($groupTitle); if (null === $ruleGroup) { $ruleGroup = $this->ruleGroupRepository->store( [ - 'title' => (string)trans('firefly.rulegroup_for_bills_title', [], $lang->data), - 'description' => (string)trans('firefly.rulegroup_for_bills_description', [], $lang->data), + 'title' => (string) trans('firefly.rulegroup_for_bills_title', [], $lang->data), + 'description' => (string) trans('firefly.rulegroup_for_bills_description', [], $lang->data), 'active' => true, ] ); @@ -185,8 +185,8 @@ class MigrateToRules extends Command 'active' => true, 'strict' => false, 'stop_processing' => false, // field is no longer used. - 'title' => (string)trans('firefly.rule_for_bill_title', ['name' => $bill->name], $language->data), - 'description' => (string)trans('firefly.rule_for_bill_description', ['name' => $bill->name], $language->data), + 'title' => (string) trans('firefly.rule_for_bill_title', ['name' => $bill->name], $language->data), + 'description' => (string) trans('firefly.rule_for_bill_description', ['name' => $bill->name], $language->data), 'trigger' => 'store-journal', 'triggers' => [ [ diff --git a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php index e0f86f27fe..ae12f18ca7 100644 --- a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php +++ b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php @@ -120,7 +120,7 @@ class OtherCurrenciesCorrections extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -187,8 +187,8 @@ class OtherCurrenciesCorrections extends Command } // when mismatch in transaction: - if ((int)$transaction->transaction_currency_id !== (int)$currency->id) { - $transaction->foreign_currency_id = (int)$transaction->transaction_currency_id; + if ((int) $transaction->transaction_currency_id !== (int) $currency->id) { + $transaction->foreign_currency_id = (int) $transaction->transaction_currency_id; $transaction->foreign_amount = $transaction->amount; $transaction->transaction_currency_id = $currency->id; $transaction->save(); diff --git a/app/Console/Commands/Upgrade/RenameAccountMeta.php b/app/Console/Commands/Upgrade/RenameAccountMeta.php index 24340ff75c..ee8ba18ddc 100644 --- a/app/Console/Commands/Upgrade/RenameAccountMeta.php +++ b/app/Console/Commands/Upgrade/RenameAccountMeta.php @@ -104,7 +104,7 @@ class RenameAccountMeta extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.php index 5ec7c1a576..a9e1e0d307 100644 --- a/app/Console/Commands/Upgrade/TransactionIdentifier.php +++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php @@ -128,7 +128,7 @@ class TransactionIdentifier extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -173,7 +173,7 @@ class TransactionIdentifier extends Command private function findOpposing(Transaction $transaction, array $exclude): ?Transaction { // find opposing: - $amount = bcmul((string)$transaction->amount, '-1'); + $amount = bcmul((string) $transaction->amount, '-1'); try { /** @var Transaction $opposing */ diff --git a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php index 52c9316f3f..00e3bb5561 100644 --- a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php +++ b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php @@ -139,7 +139,7 @@ class TransferCurrenciesCorrections extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -368,7 +368,7 @@ class TransferCurrenciesCorrections extends Command if (null === $this->sourceTransaction->transaction_currency_id && null !== $this->sourceCurrency) { $this->sourceTransaction ->transaction_currency_id - = (int)$this->sourceCurrency->id; + = (int) $this->sourceCurrency->id; $message = sprintf( 'Transaction #%d has no currency setting, now set to %s.', $this->sourceTransaction->id, @@ -389,7 +389,7 @@ class TransferCurrenciesCorrections extends Command { if (null !== $this->sourceCurrency && null === $this->sourceTransaction->foreign_amount - && (int)$this->sourceTransaction->transaction_currency_id !== (int)$this->sourceCurrency->id + && (int) $this->sourceTransaction->transaction_currency_id !== (int) $this->sourceCurrency->id ) { $message = sprintf( 'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.', @@ -401,7 +401,7 @@ class TransferCurrenciesCorrections extends Command Log::debug($message); $this->line($message); $this->count++; - $this->sourceTransaction->transaction_currency_id = (int)$this->sourceCurrency->id; + $this->sourceTransaction->transaction_currency_id = (int) $this->sourceCurrency->id; $this->sourceTransaction->save(); } } @@ -415,7 +415,7 @@ class TransferCurrenciesCorrections extends Command if (null === $this->destinationTransaction->transaction_currency_id && null !== $this->destinationCurrency) { $this->destinationTransaction ->transaction_currency_id - = (int)$this->destinationCurrency->id; + = (int) $this->destinationCurrency->id; $message = sprintf( 'Transaction #%d has no currency setting, now set to %s.', $this->destinationTransaction->id, @@ -436,7 +436,7 @@ class TransferCurrenciesCorrections extends Command { if (null !== $this->destinationCurrency && null === $this->destinationTransaction->foreign_amount - && (int)$this->destinationTransaction->transaction_currency_id !== (int)$this->destinationCurrency->id + && (int) $this->destinationTransaction->transaction_currency_id !== (int) $this->destinationCurrency->id ) { $message = sprintf( 'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.', @@ -448,7 +448,7 @@ class TransferCurrenciesCorrections extends Command Log::debug($message); $this->line($message); $this->count++; - $this->destinationTransaction->transaction_currency_id = (int)$this->destinationCurrency->id; + $this->destinationTransaction->transaction_currency_id = (int) $this->destinationCurrency->id; $this->destinationTransaction->save(); } } @@ -460,7 +460,7 @@ class TransferCurrenciesCorrections extends Command */ private function fixInvalidForeignCurrency(): void { - if ((int)$this->destinationCurrency->id === (int)$this->sourceCurrency->id) { + if ((int) $this->destinationCurrency->id === (int) $this->sourceCurrency->id) { // update both transactions to match: $this->sourceTransaction->foreign_amount = null; $this->sourceTransaction->foreign_currency_id = null; @@ -494,7 +494,7 @@ class TransferCurrenciesCorrections extends Command */ private function fixMismatchedForeignCurrency(): void { - if ((int)$this->sourceCurrency->id !== (int)$this->destinationCurrency->id) { + if ((int) $this->sourceCurrency->id !== (int) $this->destinationCurrency->id) { $this->sourceTransaction->transaction_currency_id = $this->sourceCurrency->id; $this->sourceTransaction->foreign_currency_id = $this->destinationCurrency->id; $this->destinationTransaction->transaction_currency_id = $this->sourceCurrency->id; @@ -514,7 +514,7 @@ class TransferCurrenciesCorrections extends Command private function fixSourceNullForeignAmount(): void { if (null === $this->sourceTransaction->foreign_amount && null !== $this->destinationTransaction->foreign_amount) { - $this->sourceTransaction->foreign_amount = bcmul((string)$this->destinationTransaction->foreign_amount, '-1'); + $this->sourceTransaction->foreign_amount = bcmul((string) $this->destinationTransaction->foreign_amount, '-1'); $this->sourceTransaction->save(); $this->count++; Log::debug( @@ -534,7 +534,7 @@ class TransferCurrenciesCorrections extends Command private function fixDestNullForeignAmount(): void { if (null === $this->destinationTransaction->foreign_amount && null !== $this->sourceTransaction->foreign_amount) { - $this->destinationTransaction->foreign_amount = bcmul((string)$this->sourceTransaction->foreign_amount, '-1'); + $this->destinationTransaction->foreign_amount = bcmul((string) $this->sourceTransaction->foreign_amount, '-1'); $this->destinationTransaction->save(); $this->count++; Log::debug( @@ -554,7 +554,7 @@ class TransferCurrenciesCorrections extends Command */ private function fixTransactionJournalCurrency(TransactionJournal $journal): void { - if ((int)$journal->transaction_currency_id !== (int)$this->sourceCurrency->id) { + if ((int) $journal->transaction_currency_id !== (int) $this->sourceCurrency->id) { $oldCurrencyCode = $journal->transactionCurrency->code ?? '(nothing)'; $journal->transaction_currency_id = $this->sourceCurrency->id; $message = sprintf( diff --git a/app/Console/Commands/Upgrade/UpgradeDatabase.php b/app/Console/Commands/Upgrade/UpgradeDatabase.php index d0fee361ef..0f4b60f08f 100644 --- a/app/Console/Commands/Upgrade/UpgradeDatabase.php +++ b/app/Console/Commands/Upgrade/UpgradeDatabase.php @@ -120,9 +120,9 @@ class UpgradeDatabase extends Command echo $result; } // set new DB version. - app('fireflyconfig')->set('db_version', (int)config('firefly.db_version')); + app('fireflyconfig')->set('db_version', (int) config('firefly.db_version')); // index will set FF3 version. - app('fireflyconfig')->set('ff3_version', (string)config('firefly.version')); + app('fireflyconfig')->set('ff3_version', (string) config('firefly.version')); return 0; } diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilities.php b/app/Console/Commands/Upgrade/UpgradeLiabilities.php index d8780ddf9e..558db391f9 100644 --- a/app/Console/Commands/Upgrade/UpgradeLiabilities.php +++ b/app/Console/Commands/Upgrade/UpgradeLiabilities.php @@ -86,7 +86,7 @@ class UpgradeLiabilities extends Command { $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); if (null !== $configVar) { - return (bool)$configVar->data; + return (bool) $configVar->data; } return false; @@ -159,10 +159,10 @@ class UpgradeLiabilities extends Command return; } // source MUST be the liability. - if ((int)$destination->account_id === (int)$account->id) { + if ((int) $destination->account_id === (int) $account->id) { Log::debug(sprintf('Must switch around, because account #%d is the destination.', $destination->account_id)); // so if not, switch things around: - $sourceAccountId = (int)$source->account_id; + $sourceAccountId = (int) $source->account_id; $source->account_id = $destination->account_id; $destination->account_id = $sourceAccountId; $source->save(); diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.php index 2257339e50..63b19a6315 100644 --- a/app/Console/Commands/UpgradeFireflyInstructions.php +++ b/app/Console/Commands/UpgradeFireflyInstructions.php @@ -54,10 +54,10 @@ class UpgradeFireflyInstructions extends Command public function handle(): int { $this->generateInstallationId(); - if ('update' === (string)$this->argument('task')) { + if ('update' === (string) $this->argument('task')) { $this->updateInstructions(); } - if ('install' === (string)$this->argument('task')) { + if ('install' === (string) $this->argument('task')) { $this->installInstructions(); } diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.php index ecca77971d..7a8c06e076 100644 --- a/app/Console/Commands/VerifiesAccessToken.php +++ b/app/Console/Commands/VerifiesAccessToken.php @@ -43,7 +43,7 @@ trait VerifiesAccessToken */ public function getUser(): User { - $userId = (int)$this->option('user'); + $userId = (int) $this->option('user'); /** @var UserRepositoryInterface $repository */ $repository = app(UserRepositoryInterface::class); $user = $repository->find($userId); @@ -71,8 +71,8 @@ trait VerifiesAccessToken */ protected function verifyAccessToken(): bool { - $userId = (int)$this->option('user'); - $token = (string)$this->option('token'); + $userId = (int) $this->option('user'); + $token = (string) $this->option('token'); /** @var UserRepositoryInterface $repository */ $repository = app(UserRepositoryInterface::class); $user = $repository->find($userId);