Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Reformat various code.
James Cole29bed2547c4e
diff --git a/app/Enums/ClauseType.php b/app/Enums/ClauseType.phpindex 1897aee173..6b78943a0e 100644--- a/app/Enums/ClauseType.php+++ b/app/Enums/ClauseType.php@@ -30,6 +30,6 @@ namespace FireflyIII\Enums;class ClauseType{public const TRANSACTION = 'transaction';- public const WHERE = 'where';public const UPDATE = 'update';+ public const WHERE = 'where';}diff --git a/app/Events/AdminRequestedTestMessage.php b/app/Events/AdminRequestedTestMessage.phpindex 4494bcd098..97836998c4 100644--- a/app/Events/AdminRequestedTestMessage.php+++ b/app/Events/AdminRequestedTestMessage.php@@ -42,11 +42,11 @@ class AdminRequestedTestMessage extends Event/*** Create a new event instance.*- * @param User $user+ * @param User $user*/public function __construct(User $user){Log::debug(sprintf('Triggered AdminRequestedTestMessage for user #%d (%s)', $user->id, $user->email));- $this->user = $user;+ $this->user = $user;}}diff --git a/app/Events/RequestedReportOnJournals.php b/app/Events/RequestedReportOnJournals.phpindex abbaf01a6e..ac59c8f3a7 100644--- a/app/Events/RequestedReportOnJournals.php+++ b/app/Events/RequestedReportOnJournals.php@@ -41,7 +41,7 @@ class RequestedReportOnJournalsuse Dispatchable, InteractsWithSockets, SerializesModels;public Collection $groups;- public int $userId;+ public int $userId;/*** Create a new event instance.diff --git a/app/Events/UserChangedEmail.php b/app/Events/UserChangedEmail.phpindex 6b6f3f9859..31777767a2 100644--- a/app/Events/UserChangedEmail.php+++ b/app/Events/UserChangedEmail.php@@ -38,7 +38,7 @@ class UserChangedEmail extends Eventpublic string $newEmail;public string $oldEmail;- public User $user;+ public User $user;/*** UserChangedEmail constructor.@@ -49,8 +49,8 @@ class UserChangedEmail extends Event*/public function __construct(User $user, string $newEmail, string $oldEmail){- $this->user = $user;- $this->oldEmail = $oldEmail;- $this->newEmail = $newEmail;+ $this->user = $user;+ $this->oldEmail = $oldEmail;+ $this->newEmail = $newEmail;}}diff --git a/app/Events/WarnUserAboutBill.php b/app/Events/WarnUserAboutBill.phpindex d2819ffad3..de6ae49021 100644--- a/app/Events/WarnUserAboutBill.php+++ b/app/Events/WarnUserAboutBill.php@@ -37,8 +37,8 @@ class WarnUserAboutBill extends Eventuse SerializesModels;public Bill $bill;- public string $field;public int $diff;+ public string $field;/*** @param Bill $billdiff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.phpindex f8a6fc1335..db46d527b8 100644--- a/app/Exceptions/GracefulNotFoundHandler.php+++ b/app/Exceptions/GracefulNotFoundHandler.php@@ -148,7 +148,7 @@ class GracefulNotFoundHandler extends ExceptionHandler/** @var User $user */$user = auth()->user();$route = $request->route();- $accountId = (int)$route->parameter('account');+ $accountId = (int) $route->parameter('account');/** @var Account $account */$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);if (null === $account) {@@ -176,7 +176,7 @@ class GracefulNotFoundHandler extends ExceptionHandler/** @var User $user */$user = auth()->user();$route = $request->route();- $groupId = (int)$route->parameter('transactionGroup');+ $groupId = (int) $route->parameter('transactionGroup');/** @var TransactionGroup $group */$group = $user->transactionGroups()->withTrashed()->find($groupId);@@ -216,7 +216,7 @@ class GracefulNotFoundHandler extends ExceptionHandler/** @var User $user */$user = auth()->user();$route = $request->route();- $attachmentId = (int)$route->parameter('attachment');+ $attachmentId = (int) $route->parameter('attachment');/** @var Attachment $attachment */$attachment = $user->attachments()->withTrashed()->find($attachmentId);if (null === $attachment) {diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.phpindex 0bd843e5a1..44b639561f 100644--- a/app/Factory/AccountFactory.php+++ b/app/Factory/AccountFactory.php@@ -137,7 +137,7 @@ class AccountFactory*/protected function getAccountType(array $data): ?AccountType{- $accountTypeId = array_key_exists('account_type_id', $data) ? (int)$data['account_type_id'] : 0;+ $accountTypeId = array_key_exists('account_type_id', $data) ? (int) $data['account_type_id'] : 0;$accountTypeName = array_key_exists('account_type_name', $data) ? $data['account_type_name'] : null;$result = null;// find by name or ID@@ -200,7 +200,7 @@ class AccountFactory'iban' => $data['iban'],];// fix virtual balance when it's empty- if ('' === (string)$databaseData['virtual_balance']) {+ if ('' === (string) $databaseData['virtual_balance']) {$databaseData['virtual_balance'] = null;}// remove virtual balance when not an asset account or a liability@@ -252,9 +252,9 @@ class AccountFactory*/private function cleanMetaDataArray(Account $account, array $data): array{- $currencyId = array_key_exists('currency_id', $data) ? (int)$data['currency_id'] : 0;- $currencyCode = array_key_exists('currency_code', $data) ? (string)$data['currency_code'] : '';- $accountRole = array_key_exists('account_role', $data) ? (string)$data['account_role'] : null;+ $currencyId = array_key_exists('currency_id', $data) ? (int) $data['currency_id'] : 0;+ $currencyCode = array_key_exists('currency_code', $data) ? (string) $data['currency_code'] : '';+ $accountRole = array_key_exists('account_role', $data) ? (string) $data['account_role'] : null;$currency = $this->getCurrency($currencyId, $currencyCode);// only asset account may have a role:@@ -301,7 +301,7 @@ class AccountFactory$data[$field] = 1;}- $factory->crud($account, $field, (string)$data[$field]);+ $factory->crud($account, $field, (string) $data[$field]);}}}@@ -372,7 +372,7 @@ class AccountFactory$order = $maxOrder + 1;}if (array_key_exists('order', $data)) {- $order = (int)($data['order'] > $maxOrder ? $maxOrder + 1 : $data['order']);+ $order = (int) ($data['order'] > $maxOrder ? $maxOrder + 1 : $data['order']);$order = 0 === $order ? $maxOrder + 1 : $order;}diff --git a/app/Factory/AttachmentFactory.php b/app/Factory/AttachmentFactory.phpindex 771aa695fb..96bbd1d55d 100644--- a/app/Factory/AttachmentFactory.php+++ b/app/Factory/AttachmentFactory.php@@ -52,7 +52,7 @@ class AttachmentFactory// get journal instead of transaction.if (Transaction::class === $model) {/** @var Transaction $transaction */- $transaction = $this->user->transactions()->find((int)$data['attachable_id']);+ $transaction = $this->user->transactions()->find((int) $data['attachable_id']);if (null === $transaction) {throw new FireflyException('Unexpectedly could not find transaction');}@@ -75,7 +75,7 @@ class AttachmentFactory'uploaded' => 0,]);- $notes = (string)($data['notes'] ?? '');+ $notes = (string) ($data['notes'] ?? '');if ('' !== $notes) {$note = new Note;$note->noteable()->associate($attachment);diff --git a/app/Factory/BudgetFactory.php b/app/Factory/BudgetFactory.phpindex f3ea839f9e..69a25e6b92 100644--- a/app/Factory/BudgetFactory.php+++ b/app/Factory/BudgetFactory.php@@ -41,8 +41,8 @@ class BudgetFactory*/public function find(?int $budgetId, ?string $budgetName): ?Budget{- $budgetId = (int)$budgetId;- $budgetName = (string)$budgetName;+ $budgetId = (int) $budgetId;+ $budgetName = (string) $budgetName;if (0 === $budgetId && '' === $budgetName) {return null;diff --git a/app/Factory/CategoryFactory.php b/app/Factory/CategoryFactory.phpindex 6adc1800a0..8979d5068b 100644--- a/app/Factory/CategoryFactory.php+++ b/app/Factory/CategoryFactory.php@@ -45,8 +45,8 @@ class CategoryFactory*/public function findOrCreate(?int $categoryId, ?string $categoryName): ?Category{- $categoryId = (int)$categoryId;- $categoryName = (string)$categoryName;+ $categoryId = (int) $categoryId;+ $categoryName = (string) $categoryName;Log::debug(sprintf('Going to find category with ID %d and name "%s"', $categoryId, $categoryName));diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.phpindex 29a4fb70d9..6709c3fa64 100644--- a/app/Factory/PiggyBankFactory.php+++ b/app/Factory/PiggyBankFactory.php@@ -41,8 +41,8 @@ class PiggyBankFactory*/public function find(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank{- $piggyBankId = (int)$piggyBankId;- $piggyBankName = (string)$piggyBankName;+ $piggyBankId = (int) $piggyBankId;+ $piggyBankName = (string) $piggyBankName;if ('' === $piggyBankName && 0 === $piggyBankId) {return null;}diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.phpindex 790c432a6f..3c02765372 100644--- a/app/Factory/RecurrenceFactory.php+++ b/app/Factory/RecurrenceFactory.php@@ -84,7 +84,7 @@ class RecurrenceFactory$firstDate = $data['recurrence']['first_date'];}if (array_key_exists('nr_of_repetitions', $data['recurrence'])) {- $repetitions = (int)$data['recurrence']['nr_of_repetitions'];+ $repetitions = (int) $data['recurrence']['nr_of_repetitions'];}if (array_key_exists('repeat_until', $data['recurrence'])) {$repeatUntil = $data['recurrence']['repeat_until'];@@ -120,7 +120,7 @@ class RecurrenceFactory$recurrence->save();if (array_key_exists('notes', $data['recurrence'])) {- $this->updateNote($recurrence, (string)$data['recurrence']['notes']);+ $this->updateNote($recurrence, (string) $data['recurrence']['notes']);}diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.phpindex 406fb4e1ad..66fa91707d 100644--- a/app/Factory/TagFactory.php+++ b/app/Factory/TagFactory.php@@ -80,9 +80,9 @@ class TagFactory*/public function create(array $data): ?Tag{- $zoomLevel = 0 === (int)$data['zoom_level'] ? null : (int)$data['zoom_level'];- $latitude = 0.0 === (float)$data['latitude'] ? null : (float)$data['latitude'];- $longitude = 0.0 === (float)$data['longitude'] ? null : (float)$data['longitude'];+ $zoomLevel = 0 === (int) $data['zoom_level'] ? null : (int) $data['zoom_level'];+ $latitude = 0.0 === (float) $data['latitude'] ? null : (float) $data['latitude'];+ $longitude = 0.0 === (float) $data['longitude'] ? null : (float) $data['longitude'];$array = ['user_id' => $this->user->id,'tag' => trim($data['tag']),diff --git a/app/Factory/TransactionCurrencyFactory.php b/app/Factory/TransactionCurrencyFactory.phpindex 555f9e025f..d29e963fb4 100644--- a/app/Factory/TransactionCurrencyFactory.php+++ b/app/Factory/TransactionCurrencyFactory.php@@ -46,7 +46,7 @@ class TransactionCurrencyFactory// if the code already exists (deleted)// force delete it and then create the transaction:$count = TransactionCurrency::withTrashed()->whereCode($data['code'])->count();- if(1 === $count) {+ if (1 === $count) {$old = TransactionCurrency::withTrashed()->whereCode($data['code'])->first();$old->forceDelete();Log::warning(sprintf('Force deleted old currency with ID #%d and code "%s".', $old->id, $data['code']));@@ -80,8 +80,8 @@ class TransactionCurrencyFactory*/public function find(?int $currencyId, ?string $currencyCode): ?TransactionCurrency{- $currencyCode = (string)$currencyCode;- $currencyId = (int)$currencyId;+ $currencyCode = (string) $currencyCode;+ $currencyId = (int) $currencyId;if ('' === $currencyCode && 0 === $currencyId) {Log::debug('Cannot find anything on empty currency code and empty currency ID!');diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.phpindex 0a23e02557..47c97e7e17 100644--- a/app/Factory/TransactionJournalFactory.php+++ b/app/Factory/TransactionJournalFactory.php@@ -160,11 +160,11 @@ class TransactionJournalFactory$type = $this->typeRepository->findTransactionType(null, $row['type']);$carbon = $row['date'] ?? today(config('app.timezone'));$order = $row['order'] ?? 0;- $currency = $this->currencyRepository->findCurrency((int)$row['currency_id'], $row['currency_code']);+ $currency = $this->currencyRepository->findCurrency((int) $row['currency_id'], $row['currency_code']);$foreignCurrency = $this->currencyRepository->findCurrencyNull($row['foreign_currency_id'], $row['foreign_currency_code']);- $bill = $this->billRepository->findBill((int)$row['bill_id'], $row['bill_name']);+ $bill = $this->billRepository->findBill((int) $row['bill_id'], $row['bill_name']);$billId = TransactionType::WITHDRAWAL === $type->type && null !== $bill ? $bill->id : null;- $description = (string)$row['description'];+ $description = (string) $row['description'];/** Manipulate basic fields */$carbon->setTimezone(config('app.timezone'));@@ -237,7 +237,7 @@ class TransactionJournalFactory$transactionFactory->setForeignCurrency($foreignCurrency);$transactionFactory->setReconciled($row['reconciled'] ?? false);try {- $negative = $transactionFactory->createNegative((string)$row['amount'], (string)$row['foreign_amount']);+ $negative = $transactionFactory->createNegative((string) $row['amount'], (string) $row['foreign_amount']);} catch (FireflyException $e) {Log::error('Exception creating negative transaction.');Log::error($e->getMessage());@@ -256,7 +256,7 @@ class TransactionJournalFactory$transactionFactory->setForeignCurrency($foreignCurrency);$transactionFactory->setReconciled($row['reconciled'] ?? false);try {- $transactionFactory->createPositive((string)$row['amount'], (string)$row['foreign_amount']);+ $transactionFactory->createPositive((string) $row['amount'], (string) $row['foreign_amount']);} catch (FireflyException $e) {Log::error('Exception creating positive transaction.');Log::error($e->getMessage());@@ -307,7 +307,7 @@ class TransactionJournalFactory$json = json_encode($dataRow, JSON_THROW_ON_ERROR);if (false === $json) {- $json = json_encode((string)microtime(), JSON_THROW_ON_ERROR);+ $json = json_encode((string) microtime(), JSON_THROW_ON_ERROR);Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $dataRow);}@@ -366,10 +366,10 @@ class TransactionJournalFactory// validate source account.$array = [- 'id' => $data['source_id'] ? (int)$data['source_id'] : null,- 'name' => $data['source_name'] ? (string)$data['source_name'] : null,- 'iban' => $data['source_iban'] ? (string)$data['source_iban'] : null,- 'number' => $data['source_number'] ? (string)$data['source_number'] : null,+ 'id' => $data['source_id'] ? (int) $data['source_id'] : null,+ 'name' => $data['source_name'] ? (string) $data['source_name'] : null,+ 'iban' => $data['source_iban'] ? (string) $data['source_iban'] : null,+ 'number' => $data['source_number'] ? (string) $data['source_number'] : null,];$validSource = $this->accountValidator->validateSource($array);@@ -381,10 +381,10 @@ class TransactionJournalFactory// validate destination account$array = [- 'id' => $data['destination_id'] ? (int)$data['destination_id'] : null,- 'name' => $data['destination_name'] ? (string)$data['destination_name'] : null,- 'iban' => $data['destination_iban'] ? (string)$data['destination_iban'] : null,- 'number' => $data['destination_number'] ? (string)$data['destination_number'] : null,+ 'id' => $data['destination_id'] ? (int) $data['destination_id'] : null,+ 'name' => $data['destination_name'] ? (string) $data['destination_name'] : null,+ 'iban' => $data['destination_iban'] ? (string) $data['destination_iban'] : null,+ 'number' => $data['destination_number'] ? (string) $data['destination_number'] : null,];$validDestination = $this->accountValidator->validateDestination($array);@@ -526,7 +526,7 @@ class TransactionJournalFactoryreturn;}- $piggyBank = $this->piggyRepository->findPiggyBank((int)$data['piggy_bank_id'], $data['piggy_bank_name']);+ $piggyBank = $this->piggyRepository->findPiggyBank((int) $data['piggy_bank_id'], $data['piggy_bank_name']);if (null !== $piggyBank) {$this->piggyEventFactory->create($journal, $piggyBank);@@ -558,7 +558,7 @@ class TransactionJournalFactory$set = ['journal' => $journal,'name' => $field,- 'data' => (string)($data[$field] ?? ''),+ 'data' => (string) ($data[$field] ?? ''),];//Log::debug(sprintf('Going to store meta-field "%s", with value "%s".', $set['name'], $set['data']));diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.phpindex c734664e8f..99dc2c746c 100644--- a/app/Factory/TransactionJournalMetaFactory.php+++ b/app/Factory/TransactionJournalMetaFactory.php@@ -60,7 +60,7 @@ class TransactionJournalMetaFactory//Log::debug('Is a carbon object.');$value = $data['data']->toW3cString();}- if ('' === (string)$value) {+ if ('' === (string) $value) {// Log::debug('Is an empty string.');// don't store blank strings.if (null !== $entry) {diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.phpindex a2d9d2aea7..4aa3f0cb9c 100644--- a/app/Generator/Chart/Basic/ChartJsGenerator.php+++ b/app/Generator/Chart/Basic/ChartJsGenerator.php@@ -50,7 +50,7 @@ class ChartJsGenerator implements GeneratorInterface$amounts = array_column($data, 'amount');$next = next($amounts);$sortFlag = SORT_ASC;- if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {+ if (!is_bool($next) && 1 === bccomp((string) $next, '0')) {$sortFlag = SORT_DESC;}array_multisort($amounts, $sortFlag, $data);@@ -59,7 +59,7 @@ class ChartJsGenerator implements GeneratorInterface$index = 0;foreach ($data as $key => $valueArray) {// make larger than 0- $chartData['datasets'][0]['data'][] = (float)app('steam')->positive((string)$valueArray['amount']);+ $chartData['datasets'][0]['data'][] = (float) app('steam')->positive((string) $valueArray['amount']);$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];$chartData['labels'][] = $key;@@ -165,7 +165,7 @@ class ChartJsGenerator implements GeneratorInterface// different sort when values are positive and when they're negative.asort($data);$next = next($data);- if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {+ if (!is_bool($next) && 1 === bccomp((string) $next, '0')) {// next is positive, sort other way around.arsort($data);}@@ -174,7 +174,7 @@ class ChartJsGenerator implements GeneratorInterface$index = 0;foreach ($data as $key => $value) {// make larger than 0- $chartData['datasets'][0]['data'][] = (float)app('steam')->positive((string)$value);+ $chartData['datasets'][0]['data'][] = (float) app('steam')->positive((string) $value);$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);$chartData['labels'][] = $key;diff --git a/app/Generator/Report/Account/MonthReportGenerator.php b/app/Generator/Report/Account/MonthReportGenerator.phpindex a38d7699f2..937548f453 100644--- a/app/Generator/Report/Account/MonthReportGenerator.php+++ b/app/Generator/Report/Account/MonthReportGenerator.php@@ -64,6 +64,16 @@ class MonthReportGenerator implements ReportGeneratorInterfacereturn $result;}+ /**+ * Return the preferred period.+ *+ * @return string+ */+ protected function preferredPeriod(): string+ {+ return 'day';+ }+/*** Set accounts.*@@ -155,14 +165,4 @@ class MonthReportGenerator implements ReportGeneratorInterface{return $this;}-- /**- * Return the preferred period.- *- * @return string- */- protected function preferredPeriod(): string- {- return 'day';- }}diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.phpindex fedc65ffb7..4c49b10204 100644--- a/app/Generator/Report/Audit/MonthReportGenerator.php+++ b/app/Generator/Report/Audit/MonthReportGenerator.php@@ -90,6 +90,80 @@ class MonthReportGenerator implements ReportGeneratorInterfacereturn $result;}+ /**+ * Get the audit report.+ *+ * @param Account $account+ * @param Carbon $date+ *+ * @return array+ * @throws FireflyException+ * @throws JsonException+ */+ #[ArrayShape(['journals' => "array", 'currency' => "mixed", 'exists' => "bool", 'end' => "string", 'endBalance' => "mixed", 'dayBefore' => "string",+ 'dayBeforeBalance' => "mixed"])] public function getAuditReport(Account $account, Carbon $date): array+ {+ /** @var AccountRepositoryInterface $accountRepository */+ $accountRepository = app(AccountRepositoryInterface::class);+ $accountRepository->setUser($account->user);++ /** @var JournalRepositoryInterface $journalRepository */+ $journalRepository = app(JournalRepositoryInterface::class);+ $journalRepository->setUser($account->user);++ /** @var GroupCollectorInterface $collector */+ $collector = app(GroupCollectorInterface::class);+ $collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end)->withAccountInformation()+ ->withBudgetInformation()->withCategoryInformation()->withBillInformation();+ $journals = $collector->getExtractedJournals();+ $journals = array_reverse($journals, true);+ $dayBeforeBalance = app('steam')->balance($account, $date);+ $startBalance = $dayBeforeBalance;+ $defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);+ $currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;++ foreach ($journals as $index => $journal) {+ $journals[$index]['balance_before'] = $startBalance;+ $transactionAmount = $journal['amount'];++ // make sure amount is in the right "direction".+ if ($account->id === $journal['destination_account_id']) {+ $transactionAmount = app('steam')->positive($journal['amount']);+ }++ if ($currency->id === $journal['foreign_currency_id']) {+ $transactionAmount = $journal['foreign_amount'];+ if ($account->id === $journal['destination_account_id']) {+ $transactionAmount = app('steam')->positive($journal['foreign_amount']);+ }+ }++ $newBalance = bcadd($startBalance, $transactionAmount);+ $journals[$index]['balance_after'] = $newBalance;+ $startBalance = $newBalance;++ // add meta dates for each journal.+ $journals[$index]['interest_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'interest_date');+ $journals[$index]['book_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'book_date');+ $journals[$index]['process_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'process_date');+ $journals[$index]['due_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'due_date');+ $journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');+ $journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');++ }+ $locale = app('steam')->getLocale();++ return [+ 'journals' => $journals,+ 'currency' => $currency,+ 'exists' => !empty($journals),+ 'end' => $this->end->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),+ 'endBalance' => app('steam')->balance($account, $this->end),+ 'dayBefore' => $date->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),+ 'dayBeforeBalance' => $dayBeforeBalance,+ ];+ }+/*** Account collection setter.*@@ -187,78 +261,4 @@ class MonthReportGenerator implements ReportGeneratorInterface{return $this;}-- /**- * Get the audit report.- *- * @param Account $account- * @param Carbon $date- *- * @return array- * @throws FireflyException- * @throws JsonException- */- #[ArrayShape(['journals' => "array", 'currency' => "mixed", 'exists' => "bool", 'end' => "string", 'endBalance' => "mixed", 'dayBefore' => "string",- 'dayBeforeBalance' => "mixed"])] public function getAuditReport(Account $account, Carbon $date): array- {- /** @var AccountRepositoryInterface $accountRepository */- $accountRepository = app(AccountRepositoryInterface::class);- $accountRepository->setUser($account->user);-- /** @var JournalRepositoryInterface $journalRepository */- $journalRepository = app(JournalRepositoryInterface::class);- $journalRepository->setUser($account->user);-- /** @var GroupCollectorInterface $collector */- $collector = app(GroupCollectorInterface::class);- $collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end)->withAccountInformation()- ->withBudgetInformation()->withCategoryInformation()->withBillInformation();- $journals = $collector->getExtractedJournals();- $journals = array_reverse($journals, true);- $dayBeforeBalance = app('steam')->balance($account, $date);- $startBalance = $dayBeforeBalance;- $defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user);- $currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;-- foreach ($journals as $index => $journal) {- $journals[$index]['balance_before'] = $startBalance;- $transactionAmount = $journal['amount'];-- // make sure amount is in the right "direction".- if ($account->id === $journal['destination_account_id']) {- $transactionAmount = app('steam')->positive($journal['amount']);- }-- if ($currency->id === $journal['foreign_currency_id']) {- $transactionAmount = $journal['foreign_amount'];- if ($account->id === $journal['destination_account_id']) {- $transactionAmount = app('steam')->positive($journal['foreign_amount']);- }- }-- $newBalance = bcadd($startBalance, $transactionAmount);- $journals[$index]['balance_after'] = $newBalance;- $startBalance = $newBalance;-- // add meta dates for each journal.- $journals[$index]['interest_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'interest_date');- $journals[$index]['book_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'book_date');- $journals[$index]['process_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'process_date');- $journals[$index]['due_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'due_date');- $journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');- $journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');-- }- $locale = app('steam')->getLocale();-- return [- 'journals' => $journals,- 'currency' => $currency,- 'exists' => !empty($journals),- 'end' => $this->end->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),- 'endBalance' => app('steam')->balance($account, $this->end),- 'dayBefore' => $date->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),- 'dayBeforeBalance' => $dayBeforeBalance,- ];- }}diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.phpindex a01140490e..6fe6f10978 100644--- a/app/Generator/Webhook/StandardMessageGenerator.php+++ b/app/Generator/Webhook/StandardMessageGenerator.php@@ -66,38 +66,6 @@ class StandardMessageGenerator implements MessageGeneratorInterface$this->run();}- /**- * @inheritDoc- */- public function getVersion(): int- {- return $this->version;- }-- /**- * @param Collection $objects- */- public function setObjects(Collection $objects): void- {- $this->objects = $objects;- }-- /**- * @param int $trigger- */- public function setTrigger(int $trigger): void- {- $this->trigger = $trigger;- }-- /**- * @param User $user- */- public function setUser(User $user): void- {- $this->user = $user;- }-/*** @return Collection*/@@ -197,6 +165,14 @@ class StandardMessageGenerator implements MessageGeneratorInterface$this->storeMessage($webhook, $basicMessage);}+ /**+ * @inheritDoc+ */+ public function getVersion(): int+ {+ return $this->version;+ }+/*** @param TransactionGroup $transactionGroup*@@ -235,4 +211,28 @@ class StandardMessageGenerator implements MessageGeneratorInterfacereturn $webhookMessage;}++ /**+ * @param Collection $objects+ */+ public function setObjects(Collection $objects): void+ {+ $this->objects = $objects;+ }++ /**+ * @param int $trigger+ */+ public function setTrigger(int $trigger): void+ {+ $this->trigger = $trigger;+ }++ /**+ * @param User $user+ */+ public function setUser(User $user): void+ {+ $this->user = $user;+ }}diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.phpindex b85f5491ef..b3fdd0222c 100644--- a/app/Handlers/Events/APIEventHandler.php+++ b/app/Handlers/Events/APIEventHandler.php@@ -30,7 +30,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;use Laravel\Passport\Events\AccessTokenCreated;use Log;use Mail;-use Request;use Session;/**@@ -50,7 +49,7 @@ class APIEventHandler{/** @var UserRepositoryInterface $repository */$repository = app(UserRepositoryInterface::class);- $user = $repository->find((int)$event->userId);+ $user = $repository->find((int) $event->userId);if (null !== $user) {$email = $user->email;@@ -62,7 +61,7 @@ class APIEventHandler// see if user has alternative email address:$pref = app('preferences')->getForUser($user, 'remote_guard_alt_email');if (null !== $pref) {- $email = (string)(is_array($pref->data) ? $email : $pref->data);+ $email = (string) (is_array($pref->data) ? $email : $pref->data);}Log::debug(sprintf('Now in APIEventHandler::accessTokenCreated. Email is %s', $email));diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.phpindex 7636491e4e..d35ab1c2c4 100644--- a/app/Handlers/Events/AdminEventHandler.php+++ b/app/Handlers/Events/AdminEventHandler.php@@ -51,7 +51,7 @@ class AdminEventHandler// is user even admin?if ($repository->hasRole($event->user, 'owner')) {- $email = $event->user->email;+ $email = $event->user->email;// if user is demo user, send to owner:if ($event->user->hasRole('demo')) {diff --git a/app/Handlers/Events/UpdatedGroupEventHandler.php b/app/Handlers/Events/UpdatedGroupEventHandler.phpindex 0fb4958dcf..7000166584 100644--- a/app/Handlers/Events/UpdatedGroupEventHandler.php+++ b/app/Handlers/Events/UpdatedGroupEventHandler.php@@ -132,12 +132,12 @@ class UpdatedGroupEventHandler->orderBy('transaction_journals.description', 'DESC')->first();- if(null === $first) {+ if (null === $first) {Log::warning(sprintf('Group #%d has no transaction journals.', $group->id));return;}- $all = $group->transactionJournals()->get()->pluck('id')->toArray();+ $all = $group->transactionJournals()->get()->pluck('id')->toArray();/** @var Account $sourceAccount */$sourceAccount = $first->transactions()->where('amount', '<', '0')->first()->account;/** @var Account $destAccount */diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.phpindex 3b413f6f2b..fb62f0fc6b 100644--- a/app/Handlers/Events/UserEventHandler.php+++ b/app/Handlers/Events/UserEventHandler.php@@ -125,17 +125,17 @@ class UserEventHandler// create a new group.while (true === $groupExists) {$groupExists = UserGroup::where('title', $groupTitle)->count() > 0;- if(false === $groupExists) {+ if (false === $groupExists) {$group = UserGroup::create(['title' => $groupTitle]);break;}$groupTitle = sprintf('%s-%d', $user->email, $index);$index++;- if($index > 99) {+ if ($index > 99) {throw new FireflyException('Email address can no longer be used for registrations.');}}- $role = UserRole::where('title', UserRole::OWNER)->first();+ $role = UserRole::where('title', UserRole::OWNER)->first();if (null === $role) {throw new FireflyException('The user role is unexpectedly empty. Did you run all migrations?');}@@ -226,11 +226,11 @@ class UserEventHandler*/public function sendEmailChangeConfirmMail(UserChangedEmail $event): bool{- $newEmail = $event->newEmail;- $oldEmail = $event->oldEmail;- $user = $event->user;- $token = app('preferences')->getForUser($user, 'email_change_confirm_token', 'invalid');- $uri = route('profile.confirm-email-change', [$token->data]);+ $newEmail = $event->newEmail;+ $oldEmail = $event->oldEmail;+ $user = $event->user;+ $token = app('preferences')->getForUser($user, 'email_change_confirm_token', 'invalid');+ $uri = route('profile.confirm-email-change', [$token->data]);try {Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $uri));@@ -251,12 +251,12 @@ class UserEventHandler*/public function sendEmailChangeUndoMail(UserChangedEmail $event): bool{- $newEmail = $event->newEmail;- $oldEmail = $event->oldEmail;- $user = $event->user;- $token = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid');- $hashed = hash('sha256', sprintf('%s%s', (string)config('app.key'), $oldEmail));- $uri = route('profile.undo-email-change', [$token->data, $hashed]);+ $newEmail = $event->newEmail;+ $oldEmail = $event->oldEmail;+ $user = $event->user;+ $token = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid');+ $hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $oldEmail));+ $uri = route('profile.undo-email-change', [$token->data, $hashed]);try {Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri));diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.phpindex f3295ae8bd..e7f4e0c9bf 100644--- a/app/Handlers/Events/VersionCheckEventHandler.php+++ b/app/Handlers/Events/VersionCheckEventHandler.php@@ -51,7 +51,7 @@ class VersionCheckEventHandler// should not check for updates:$permission = app('fireflyconfig')->get('permission_update_check', -1);- $value = (int)$permission->data;+ $value = (int) $permission->data;if (1 !== $value) {Log::info('Update check is not enabled.');$this->warnToCheckForUpdates($event);@@ -115,7 +115,7 @@ class VersionCheckEventHandler// last check time was more than a week ago.Log::debug('Have warned about a new version in four weeks!');- session()->flash('info', (string)trans('firefly.disabled_but_check'));+ session()->flash('info', (string) trans('firefly.disabled_but_check'));app('fireflyconfig')->set('last_update_warning', time());}}diff --git a/app/Helpers/Fiscal/FiscalHelper.php b/app/Helpers/Fiscal/FiscalHelper.phpindex 1298557deb..90f56c79d0 100644--- a/app/Helpers/Fiscal/FiscalHelper.php+++ b/app/Helpers/Fiscal/FiscalHelper.php@@ -77,7 +77,7 @@ class FiscalHelper implements FiscalHelperInterfaceif (true === $this->useCustomFiscalYear) {$prefStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data;[$mth, $day] = explode('-', $prefStartStr);- $startDate->day((int)$day)->month((int)$mth);+ $startDate->day((int) $day)->month((int) $mth);// if start date is after passed date, sub 1 year.if ($startDate > $date) {diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.phpindex c0e5318f1d..380770988f 100644--- a/app/Helpers/Report/NetWorth.php+++ b/app/Helpers/Report/NetWorth.php@@ -31,7 +31,6 @@ use FireflyIII\Support\CacheProperties;use FireflyIII\User;use Illuminate\Support\Collection;use JsonException;-use Log;/***@@ -91,7 +90,7 @@ class NetWorth implements NetWorthInterface/** @var Account $account */foreach ($accounts as $account) {//Log::debug(sprintf('Now at account #%d: "%s"', $account->id, $account->name));- $currencyId = (int)$this->accountRepository->getMetaValue($account, 'currency_id');+ $currencyId = (int) $this->accountRepository->getMetaValue($account, 'currency_id');$currencyId = 0 === $currencyId ? $default->id : $currencyId;//Log::debug(sprintf('Currency ID is #%d', $currencyId));@@ -102,7 +101,7 @@ class NetWorth implements NetWorthInterface//Log::debug(sprintf('Balance is %s', $balance));// always subtract virtual balance.- $virtualBalance = (string)$account->virtual_balance;+ $virtualBalance = (string) $account->virtual_balance;if ('' !== $virtualBalance) {$balance = bcsub($balance, $virtualBalance);}diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.phpindex d2b36349fe..66bbdd5228 100644--- a/app/Helpers/Report/PopupReport.php+++ b/app/Helpers/Report/PopupReport.php@@ -77,7 +77,7 @@ class PopupReport implements PopupReportInterfaceif (null !== $currencyId) {/** @var CurrencyRepositoryInterface $repos */$repos = app(CurrencyRepositoryInterface::class);- $currency = $repos->find((int)$currencyId);+ $currency = $repos->find((int) $currencyId);}/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);@@ -112,7 +112,7 @@ class PopupReport implements PopupReportInterfaceif (null !== $currencyId) {/** @var CurrencyRepositoryInterface $repos */$repos = app(CurrencyRepositoryInterface::class);- $currency = $repos->find((int)$currencyId);+ $currency = $repos->find((int) $currencyId);}/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);@@ -152,7 +152,7 @@ class PopupReport implements PopupReportInterfaceif (null !== $currencyId) {/** @var CurrencyRepositoryInterface $repos */$repos = app(CurrencyRepositoryInterface::class);- $currency = $repos->find((int)$currencyId);+ $currency = $repos->find((int) $currencyId);}/** @var GroupCollectorInterface $collector */@@ -195,7 +195,7 @@ class PopupReport implements PopupReportInterfaceif (null !== $currencyId) {/** @var CurrencyRepositoryInterface $repos */$repos = app(CurrencyRepositoryInterface::class);- $currency = $repos->find((int)$currencyId);+ $currency = $repos->find((int) $currencyId);}/** @var JournalRepositoryInterface $repository */diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex ddbe302068..d2f9d8c3d9 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -141,7 +141,7 @@ class ReportHelper implements ReportHelperInterface$currentEnd = clone $start;$currentEnd->endOfMonth();$months[$year]['months'][] = [- 'formatted' => $start->isoFormat((string)trans('config.month_js')),+ 'formatted' => $start->isoFormat((string) trans('config.month_js')),'start' => $start->format('Y-m-d'),'end' => $currentEnd->format('Y-m-d'),'month' => $start->month,diff --git a/app/Http/Controllers/Account/CreateController.php b/app/Http/Controllers/Account/CreateController.phpindex 4ec43f9159..fd922b6a86 100644--- a/app/Http/Controllers/Account/CreateController.php+++ b/app/Http/Controllers/Account/CreateController.php@@ -61,7 +61,7 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');- app('view')->share('title', (string)trans('firefly.accounts'));+ app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(AccountRepositoryInterface::class);$this->attachments = app(AttachmentHelperInterface::class);@@ -84,7 +84,7 @@ class CreateController extends Controller$objectType = $objectType ?? 'asset';$defaultCurrency = app('amount')->getDefaultCurrency();$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));- $subTitle = (string)trans(sprintf('firefly.make_new_%s_account', $objectType));+ $subTitle = (string) trans(sprintf('firefly.make_new_%s_account', $objectType));$roles = $this->getRoles();$liabilityTypes = $this->getLiabilityTypes();$hasOldInput = null !== $request->old('_token');@@ -103,9 +103,9 @@ class CreateController extends Controller// interest calculation periods:$interestPeriods = [- 'daily' => (string)trans('firefly.interest_calc_daily'),- 'monthly' => (string)trans('firefly.interest_calc_monthly'),- 'yearly' => (string)trans('firefly.interest_calc_yearly'),+ 'daily' => (string) trans('firefly.interest_calc_daily'),+ 'monthly' => (string) trans('firefly.interest_calc_monthly'),+ 'yearly' => (string) trans('firefly.interest_calc_yearly'),];// pre fill some data@@ -113,7 +113,7 @@ class CreateController extends Controller'preFilled',['currency_id' => $defaultCurrency->id,- 'include_net_worth' => $hasOldInput ? (bool)$request->old('include_net_worth') : true,+ 'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : true,]);@@ -142,7 +142,7 @@ class CreateController extends Controller{$data = $request->getAccountData();$account = $this->repository->store($data);- $request->session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name]));+ $request->session()->flash('success', (string) trans('firefly.stored_new_account', ['name' => $account->name]));app('preferences')->mark();Log::channel('audit')->info('Stored new account.', $data);@@ -161,7 +161,7 @@ class CreateController extends Controller$this->attachments->saveAttachmentsForModel($account, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -170,7 +170,7 @@ class CreateController extends Controller// redirect to previous URL.$redirect = redirect($this->getPreviousUri('accounts.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {// set value so create routine will not overwrite URL:$request->session()->put('accounts.create.fromStore', true);diff --git a/app/Http/Controllers/Account/DeleteController.php b/app/Http/Controllers/Account/DeleteController.phpindex cedf296bd8..7ea322e34b 100644--- a/app/Http/Controllers/Account/DeleteController.php+++ b/app/Http/Controllers/Account/DeleteController.php@@ -53,7 +53,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');- app('view')->share('title', (string)trans('firefly.accounts'));+ app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(AccountRepositoryInterface::class);@@ -76,7 +76,7 @@ class DeleteController extends Controller}$typeName = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));- $subTitle = (string)trans(sprintf('firefly.delete_%s_account', $typeName), ['name' => $account->name]);+ $subTitle = (string) trans(sprintf('firefly.delete_%s_account', $typeName), ['name' => $account->name]);$accountList = app('expandedform')->makeSelectListWithEmpty($this->repository->getAccountsByType([$account->accountType->type]));$objectType = $typeName;unset($accountList[$account->id]);@@ -104,11 +104,11 @@ class DeleteController extends Controller$type = $account->accountType->type;$typeName = config(sprintf('firefly.shortNamesByFullName.%s', $type));$name = $account->name;- $moveTo = $this->repository->find((int)$request->get('move_account_before_delete'));+ $moveTo = $this->repository->find((int) $request->get('move_account_before_delete'));$this->repository->destroy($account, $moveTo);- $request->session()->flash('success', (string)trans(sprintf('firefly.%s_deleted', $typeName), ['name' => $name]));+ $request->session()->flash('success', (string) trans(sprintf('firefly.%s_deleted', $typeName), ['name' => $name]));app('preferences')->mark();return redirect($this->getPreviousUri('accounts.delete.uri'));diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.phpindex b0b5f5ee21..c3975a210c 100644--- a/app/Http/Controllers/Account/EditController.php+++ b/app/Http/Controllers/Account/EditController.php@@ -59,7 +59,7 @@ class EditController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');- app('view')->share('title', (string)trans('firefly.accounts'));+ app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(AccountRepositoryInterface::class);$this->currencyRepos = app(CurrencyRepositoryInterface::class);@@ -86,7 +86,7 @@ class EditController extends Controller}$objectType = config('firefly.shortNamesByFullName')[$account->accountType->type];- $subTitle = (string)trans(sprintf('firefly.edit_%s_account', $objectType), ['name' => $account->name]);+ $subTitle = (string) trans(sprintf('firefly.edit_%s_account', $objectType), ['name' => $account->name]);$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));$roles = $this->getRoles();$liabilityTypes = $this->getLiabilityTypes();@@ -111,9 +111,9 @@ class EditController extends Controller// interest calculation periods:$interestPeriods = [- 'daily' => (string)trans('firefly.interest_calc_daily'),- 'monthly' => (string)trans('firefly.interest_calc_monthly'),- 'yearly' => (string)trans('firefly.interest_calc_yearly'),+ 'daily' => (string) trans('firefly.interest_calc_daily'),+ 'monthly' => (string) trans('firefly.interest_calc_monthly'),+ 'yearly' => (string) trans('firefly.interest_calc_yearly'),];// put previous url in session if not redirect from store (not "return_to_edit").@@ -122,7 +122,7 @@ class EditController extends Controller}$request->session()->forget('accounts.edit.fromUpdate');- $openingBalanceAmount = (string)$repository->getOpeningBalanceAmount($account);+ $openingBalanceAmount = (string) $repository->getOpeningBalanceAmount($account);if ('0' === $openingBalanceAmount) {$openingBalanceAmount = '';}@@ -143,17 +143,17 @@ class EditController extends Controller'BIC' => $repository->getMetaValue($account, 'BIC'),'opening_balance_date' => $openingBalanceDate,'liability_type_id' => $account->account_type_id,- 'opening_balance' => number_format((float)$openingBalanceAmount, $currency->decimal_places,'.',''),+ 'opening_balance' => number_format((float) $openingBalanceAmount, $currency->decimal_places, '.', ''),'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'),- 'virtual_balance' => number_format((float)$account->virtual_balance, $currency->decimal_places,'.',''),+ 'virtual_balance' => number_format((float) $account->virtual_balance, $currency->decimal_places, '.', ''),'currency_id' => $currency->id,'include_net_worth' => $includeNetWorth,'interest' => $repository->getMetaValue($account, 'interest'),'interest_period' => $repository->getMetaValue($account, 'interest_period'),'notes' => $this->repository->getNoteText($account),- 'active' => $hasOldInput ? (bool)$request->old('active') : $account->active,+ 'active' => $hasOldInput ? (bool) $request->old('active') : $account->active,];- if('' === $openingBalanceAmount) {+ if ('' === $openingBalanceAmount) {$preFilled['opening_balance'] = '';}@@ -194,7 +194,7 @@ class EditController extends Controller$data = $request->getAccountData();$this->repository->update($account, $data);- $request->session()->flash('success', (string)trans('firefly.updated_account', ['name' => $account->name]));+ $request->session()->flash('success', (string) trans('firefly.updated_account', ['name' => $account->name]));// store new attachment(s):@@ -203,7 +203,7 @@ class EditController extends Controller$this->attachments->saveAttachmentsForModel($account, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -212,7 +212,7 @@ class EditController extends Controller// redirect$redirect = redirect($this->getPreviousUri('accounts.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {// set value so edit routine will not overwrite URL:$request->session()->put('accounts.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.phpindex bbb561c956..bba0a3e2b0 100644--- a/app/Http/Controllers/Account/IndexController.php+++ b/app/Http/Controllers/Account/IndexController.php@@ -59,7 +59,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');- app('view')->share('title', (string)trans('firefly.accounts'));+ app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(AccountRepositoryInterface::class);@@ -79,13 +79,13 @@ class IndexController extends Controller{$objectType = $objectType ?? 'asset';$inactivePage = true;- $subTitle = (string)trans(sprintf('firefly.%s_accounts_inactive', $objectType));+ $subTitle = (string) trans(sprintf('firefly.%s_accounts_inactive', $objectType));$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));$types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));$collection = $this->repository->getInactiveAccountsByType($types);$total = $collection->count();- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);unset($collection);/** @var Carbon $start */@@ -105,11 +105,11 @@ class IndexController extends Controller$account->startBalance = $this->isInArray($startBalances, $account->id);$account->endBalance = $this->isInArray($endBalances, $account->id);$account->difference = bcsub($account->endBalance, $account->startBalance);- $account->interest = number_format((float)$this->repository->getMetaValue($account, 'interest'), 4, '.', '');- $account->interestPeriod = (string)trans(sprintf('firefly.interest_calc_%s', $this->repository->getMetaValue($account, 'interest_period')));- $account->accountTypeString = (string)trans(sprintf('firefly.account_type_%s', $account->accountType->type));+ $account->interest = number_format((float) $this->repository->getMetaValue($account, 'interest'), 4, '.', '');+ $account->interestPeriod = (string) trans(sprintf('firefly.interest_calc_%s', $this->repository->getMetaValue($account, 'interest_period')));+ $account->accountTypeString = (string) trans(sprintf('firefly.account_type_%s', $account->accountType->type));$account->current_debt = '0';- $account->iban = implode(' ', str_split((string)$account->iban, 4));+ $account->iban = implode(' ', str_split((string) $account->iban, 4));});@@ -134,7 +134,7 @@ class IndexController extends Controller{Log::debug(sprintf('Now at %s', __METHOD__));$objectType = $objectType ?? 'asset';- $subTitle = (string)trans(sprintf('firefly.%s_accounts', $objectType));+ $subTitle = (string) trans(sprintf('firefly.%s_accounts', $objectType));$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));$types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));@@ -142,8 +142,8 @@ class IndexController extends Controller$collection = $this->repository->getActiveAccountsByType($types);$total = $collection->count();- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);$inactiveCount = $this->repository->getInactiveAccountsByType($types)->count();@@ -168,15 +168,15 @@ class IndexController extends Controller$account->startBalance = $this->isInArray($startBalances, $account->id);$account->endBalance = $this->isInArray($endBalances, $account->id);$account->difference = bcsub($account->endBalance, $account->startBalance);- $account->interest = number_format((float)$this->repository->getMetaValue($account, 'interest'), 4, '.', '');- $account->interestPeriod = (string)trans(+ $account->interest = number_format((float) $this->repository->getMetaValue($account, 'interest'), 4, '.', '');+ $account->interestPeriod = (string) trans(sprintf('firefly.interest_calc_%s', $this->repository->getMetaValue($account, 'interest_period')));- $account->accountTypeString = (string)trans(sprintf('firefly.account_type_%s', $account->accountType->type));+ $account->accountTypeString = (string) trans(sprintf('firefly.account_type_%s', $account->accountType->type));$account->location = $this->repository->getLocation($account);$account->liability_direction = $this->repository->getMetaValue($account, 'liability_direction');$account->current_debt = $this->repository->getMetaValue($account, 'current_debt') ?? '-';- $account->iban = implode(' ', str_split((string)$account->iban, 4));+ $account->iban = implode(' ', str_split((string) $account->iban, 4));});// make paginator:diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.phpindex 22dc2e5b1a..0d7a096d47 100644--- a/app/Http/Controllers/Account/ReconcileController.php+++ b/app/Http/Controllers/Account/ReconcileController.php@@ -68,7 +68,7 @@ class ReconcileController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');- app('view')->share('title', (string)trans('firefly.accounts'));+ app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(JournalRepositoryInterface::class);$this->accountRepos = app(AccountRepositoryInterface::class);$this->currencyRepos = app(CurrencyRepositoryInterface::class);@@ -95,7 +95,7 @@ class ReconcileController extends Controller}if (AccountType::ASSET !== $account->accountType->type) {- session()->flash('error', (string)trans('firefly.must_be_asset_account'));+ session()->flash('error', (string) trans('firefly.must_be_asset_account'));return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))]));@@ -125,10 +125,10 @@ class ReconcileController extends Controller$startDate = clone $start;$startDate->subDay();- $startBalance = number_format((float)app('steam')->balance($account, $startDate), $currency->decimal_places, '.', '');- $endBalance = number_format((float)app('steam')->balance($account, $end), $currency->decimal_places, '.', '');+ $startBalance = number_format((float) app('steam')->balance($account, $startDate), $currency->decimal_places, '.', '');+ $endBalance = number_format((float) app('steam')->balance($account, $end), $currency->decimal_places, '.', '');$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $account->accountType->type));- $subTitle = (string)trans('firefly.reconcile_account', ['account' => $account->name]);+ $subTitle = (string) trans('firefly.reconcile_account', ['account' => $account->name]);// various links$transactionsUri = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']);@@ -177,7 +177,7 @@ class ReconcileController extends Controller/** @var string $journalId */foreach ($data['journals'] as $journalId) {- $this->repository->reconcileById((int)$journalId);+ $this->repository->reconcileById((int) $journalId);}Log::debug('Reconciled all transactions.');@@ -194,10 +194,10 @@ class ReconcileController extends ControllerLog::debug('End of routine.');app('preferences')->mark();if ('' === $result) {- session()->flash('success', (string)trans('firefly.reconciliation_stored'));+ session()->flash('success', (string) trans('firefly.reconciliation_stored'));}if ('' !== $result) {- session()->flash('error', (string)trans('firefly.reconciliation_error', ['error' => $result]));+ session()->flash('error', (string) trans('firefly.reconciliation_error', ['error' => $result]));}return redirect(route('accounts.show', [$account->id]));@@ -238,7 +238,7 @@ class ReconcileController extends Controller$description = trans('firefly.reconciliation_transaction_title',['from' => $start->isoFormat($this->monthAndDayFormat),- 'to' => $end->isoFormat($this->monthAndDayFormat)]+ 'to' => $end->isoFormat($this->monthAndDayFormat)]);$submission = ['user' => auth()->user()->id,diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.phpindex 2fef4f3f1b..5058c9965f 100644--- a/app/Http/Controllers/Account/ShowController.php+++ b/app/Http/Controllers/Account/ShowController.php@@ -64,7 +64,7 @@ class ShowController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');- app('view')->share('title', (string)trans('firefly.accounts'));+ app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(AccountRepositoryInterface::class);$this->currencyRepos = app(CurrencyRepositoryInterface::class);@@ -106,19 +106,19 @@ class ShowController extends Controller$attachments = $this->repository->getAttachments($account);$today = today(config('app.timezone'));$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $account->accountType->type));- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();$fStart = $start->isoFormat($this->monthAndDayFormat);$fEnd = $end->isoFormat($this->monthAndDayFormat);- $subTitle = (string)trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);+ $subTitle = (string) trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);$firstTransaction = $this->repository->oldestJournalDate($account) ?? $start;$periods = $this->getAccountPeriodOverview($account, $firstTransaction, $end);// if layout = v2, overrule the page title.- if('v1'!==config('firefly.layout')) {- $subTitle = (string)trans('firefly.all_journals_for_account', ['name' => $account->name]);+ if ('v1' !== config('firefly.layout')) {+ $subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]);}@@ -180,10 +180,10 @@ class ShowController extends Controller$today = today(config('app.timezone'));$start = $this->repository->oldestJournalDate($account) ?? Carbon::now()->startOfMonth();$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();- $subTitle = (string)trans('firefly.all_journals_for_account', ['name' => $account->name]);+ $subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]);$periods = new Collection;/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.phpindex 775b20fd21..e2853e3416 100644--- a/app/Http/Controllers/Admin/ConfigurationController.php+++ b/app/Http/Controllers/Admin/ConfigurationController.php@@ -47,7 +47,7 @@ class ConfigurationController extends Controller$this->middleware(static function ($request, $next) {- app('view')->share('title', (string)trans('firefly.administration'));+ app('view')->share('title', (string) trans('firefly.administration'));app('view')->share('mainTitleIcon', 'fa-hand-spock-o');return $next($request);@@ -64,7 +64,7 @@ class ConfigurationController extends Controller*/public function index(){- $subTitle = (string)trans('firefly.instance_configuration');+ $subTitle = (string) trans('firefly.instance_configuration');$subTitleIcon = 'fa-wrench';Log::channel('audit')->info('User visits admin config index.');@@ -100,7 +100,7 @@ class ConfigurationController extends Controllerapp('fireflyconfig')->set('is_demo_site', $data['is_demo_site']);// flash message- session()->flash('success', (string)trans('firefly.configuration_updated'));+ session()->flash('success', (string) trans('firefly.configuration_updated'));app('preferences')->mark();return redirect()->route('admin.configuration.index');diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.phpindex 8c414119e9..664a12e4bb 100644--- a/app/Http/Controllers/Admin/HomeController.php+++ b/app/Http/Controllers/Admin/HomeController.php@@ -59,7 +59,7 @@ class HomeController extends Controllerpublic function index(){Log::channel('audit')->info('User visits admin index.');- $title = (string)trans('firefly.administration');+ $title = (string) trans('firefly.administration');$mainTitleIcon = 'fa-hand-spock-o';$email = auth()->user()->email;$pref = app('preferences')->get('remote_guard_alt_email');@@ -82,10 +82,10 @@ class HomeController extends Controller{Log::channel('audit')->info('User sends test message.');/** @var User $user */- $user = auth()->user();+ $user = auth()->user();Log::debug('Now in testMessage() controller.');event(new AdminRequestedTestMessage($user));- session()->flash('info', (string)trans('firefly.send_test_triggered'));+ session()->flash('info', (string) trans('firefly.send_test_triggered'));return redirect(route('admin.index'));}diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.phpindex 0fe0d5be0e..fcb7815f2f 100644--- a/app/Http/Controllers/Admin/LinkController.php+++ b/app/Http/Controllers/Admin/LinkController.php@@ -52,7 +52,7 @@ class LinkController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.administration'));+ app('view')->share('title', (string) trans('firefly.administration'));app('view')->share('mainTitleIcon', 'fa-hand-spock-o');$this->repository = app(LinkTypeRepositoryInterface::class);@@ -71,7 +71,7 @@ class LinkController extends Controller{Log::channel('audit')->info('User visits link index.');- $subTitle = (string)trans('firefly.create_new_link_type');+ $subTitle = (string) trans('firefly.create_new_link_type');$subTitleIcon = 'fa-link';// put previous url in session if not redirect from store (not "create another").@@ -93,17 +93,17 @@ class LinkController extends Controllerpublic function delete(Request $request, LinkType $linkType){if (!$linkType->editable) {- $request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));+ $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));return redirect(route('admin.links.index'));}Log::channel('audit')->info(sprintf('User wants to delete link type #%d', $linkType->id));- $subTitle = (string)trans('firefly.delete_link_type', ['name' => $linkType->name]);+ $subTitle = (string) trans('firefly.delete_link_type', ['name' => $linkType->name]);$otherTypes = $this->repository->get();$count = $this->repository->countJournals($linkType);$moveTo = [];- $moveTo[0] = (string)trans('firefly.do_not_save_connection');+ $moveTo[0] = (string) trans('firefly.do_not_save_connection');/** @var LinkType $otherType */foreach ($otherTypes as $otherType) {@@ -130,10 +130,10 @@ class LinkController extends Controller{Log::channel('audit')->info(sprintf('User destroyed link type #%d', $linkType->id));$name = $linkType->name;- $moveTo = $this->repository->find((int)$request->get('move_link_type_before_delete'));+ $moveTo = $this->repository->find((int) $request->get('move_link_type_before_delete'));$this->repository->destroy($linkType, $moveTo);- $request->session()->flash('success', (string)trans('firefly.deleted_link_type', ['name' => $name]));+ $request->session()->flash('success', (string) trans('firefly.deleted_link_type', ['name' => $name]));app('preferences')->mark();return redirect($this->getPreviousUri('link-types.delete.uri'));@@ -150,11 +150,11 @@ class LinkController extends Controllerpublic function edit(Request $request, LinkType $linkType){if (!$linkType->editable) {- $request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));+ $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));return redirect(route('admin.links.index'));}- $subTitle = (string)trans('firefly.edit_link_type', ['name' => $linkType->name]);+ $subTitle = (string) trans('firefly.edit_link_type', ['name' => $linkType->name]);$subTitleIcon = 'fa-link';Log::channel('audit')->info(sprintf('User wants to edit link type #%d', $linkType->id));@@ -175,7 +175,7 @@ class LinkController extends Controller*/public function index(){- $subTitle = (string)trans('firefly.journal_link_configuration');+ $subTitle = (string) trans('firefly.journal_link_configuration');$subTitleIcon = 'fa-link';$linkTypes = $this->repository->get();@@ -198,7 +198,7 @@ class LinkController extends Controller*/public function show(LinkType $linkType){- $subTitle = (string)trans('firefly.overview_for_link', ['name' => $linkType->name]);+ $subTitle = (string) trans('firefly.overview_for_link', ['name' => $linkType->name]);$subTitleIcon = 'fa-link';$links = $this->repository->getJournalLinks($linkType);@@ -225,9 +225,9 @@ class LinkController extends ControllerLog::channel('audit')->info('User stored new link type.', $linkType->toArray());- $request->session()->flash('success', (string)trans('firefly.stored_new_link_type', ['name' => $linkType->name]));+ $request->session()->flash('success', (string) trans('firefly.stored_new_link_type', ['name' => $linkType->name]));$redirect = redirect($this->getPreviousUri('link-types.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {// set value so create routine will not overwrite URL:$request->session()->put('link-types.create.fromStore', true);@@ -249,7 +249,7 @@ class LinkController extends Controllerpublic function update(LinkTypeFormRequest $request, LinkType $linkType){if (!$linkType->editable) {- $request->session()->flash('error', (string)trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));+ $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));return redirect(route('admin.links.index'));}@@ -263,10 +263,10 @@ class LinkController extends ControllerLog::channel('audit')->info(sprintf('User update link type #%d.', $linkType->id), $data);- $request->session()->flash('success', (string)trans('firefly.updated_link_type', ['name' => $linkType->name]));+ $request->session()->flash('success', (string) trans('firefly.updated_link_type', ['name' => $linkType->name]));app('preferences')->mark();$redirect = redirect($this->getPreviousUri('link-types.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {// set value so edit routine will not overwrite URL:$request->session()->put('link-types.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.phpindex 1e9b494c45..82f5cde8c7 100644--- a/app/Http/Controllers/Admin/UpdateController.php+++ b/app/Http/Controllers/Admin/UpdateController.php@@ -47,7 +47,7 @@ class UpdateController extends Controllerparent::__construct();$this->middleware(static function ($request, $next) {- app('view')->share('title', (string)trans('firefly.administration'));+ app('view')->share('title', (string) trans('firefly.administration'));app('view')->share('mainTitleIcon', 'fa-hand-spock-o');return $next($request);@@ -64,22 +64,22 @@ class UpdateController extends Controller*/public function index(){- $subTitle = (string)trans('firefly.update_check_title');+ $subTitle = (string) trans('firefly.update_check_title');$subTitleIcon = 'fa-star';$permission = app('fireflyconfig')->get('permission_update_check', -1);$channel = app('fireflyconfig')->get('update_channel', 'stable');$selected = $permission->data;$channelSelected = $channel->data;$options = [- -1 => (string)trans('firefly.updates_ask_me_later'),- 0 => (string)trans('firefly.updates_do_not_check'),- 1 => (string)trans('firefly.updates_enable_check'),+ -1 => (string) trans('firefly.updates_ask_me_later'),+ 0 => (string) trans('firefly.updates_do_not_check'),+ 1 => (string) trans('firefly.updates_enable_check'),];$channelOptions = [- 'stable' => (string)trans('firefly.update_channel_stable'),- 'beta' => (string)trans('firefly.update_channel_beta'),- 'alpha' => (string)trans('firefly.update_channel_alpha'),+ 'stable' => (string) trans('firefly.update_channel_stable'),+ 'beta' => (string) trans('firefly.update_channel_beta'),+ 'alpha' => (string) trans('firefly.update_channel_alpha'),];return view('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options', 'channelSelected', 'channelOptions'));@@ -94,14 +94,14 @@ class UpdateController extends Controller*/public function post(Request $request){- $checkForUpdates = (int)$request->get('check_for_updates');+ $checkForUpdates = (int) $request->get('check_for_updates');$channel = $request->get('update_channel');$channel = in_array($channel, ['stable', 'beta', 'alpha'], true) ? $channel : 'stable';app('fireflyconfig')->set('permission_update_check', $checkForUpdates);app('fireflyconfig')->set('last_update_check', time());app('fireflyconfig')->set('update_channel', $channel);- session()->flash('success', (string)trans('firefly.configuration_updated'));+ session()->flash('success', (string) trans('firefly.configuration_updated'));return redirect(route('admin.update-check'));}diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.phpindex 1b67554e90..b2f265e0dd 100644--- a/app/Http/Controllers/Admin/UserController.php+++ b/app/Http/Controllers/Admin/UserController.php@@ -51,7 +51,7 @@ class UserController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.administration'));+ app('view')->share('title', (string) trans('firefly.administration'));app('view')->share('mainTitleIcon', 'fa-hand-spock-o');$this->repository = app(UserRepositoryInterface::class);@@ -77,7 +77,7 @@ class UserController extends Controllerreturn redirect(route('admin.users'));}- $subTitle = (string)trans('firefly.delete_user', ['email' => $user->email]);+ $subTitle = (string) trans('firefly.delete_user', ['email' => $user->email]);return view('admin.users.delete', compact('user', 'subTitle'));}@@ -97,7 +97,7 @@ class UserController extends Controllerreturn redirect(route('admin.users'));}$this->repository->destroy($user);- session()->flash('success', (string)trans('firefly.user_deleted'));+ session()->flash('success', (string) trans('firefly.user_deleted'));return redirect(route('admin.users'));}@@ -121,15 +121,15 @@ class UserController extends Controller}session()->forget('users.edit.fromUpdate');- $subTitle = (string)trans('firefly.edit_user', ['email' => $user->email]);+ $subTitle = (string) trans('firefly.edit_user', ['email' => $user->email]);$subTitleIcon = 'fa-user-o';$currentUser = auth()->user();$isAdmin = $this->repository->hasRole($user, 'owner');$codes = [- '' => (string)trans('firefly.no_block_code'),- 'bounced' => (string)trans('firefly.block_code_bounced'),- 'expired' => (string)trans('firefly.block_code_expired'),- 'email_changed' => (string)trans('firefly.block_code_email_changed'),+ '' => (string) trans('firefly.no_block_code'),+ 'bounced' => (string) trans('firefly.block_code_bounced'),+ 'expired' => (string) trans('firefly.block_code_expired'),+ 'email_changed' => (string) trans('firefly.block_code_email_changed'),];return view('admin.users.edit', compact('user', 'canEditDetails', 'subTitle', 'subTitleIcon', 'codes', 'currentUser', 'isAdmin'));@@ -142,7 +142,7 @@ class UserController extends Controller*/public function index(){- $subTitle = (string)trans('firefly.user_administration');+ $subTitle = (string) trans('firefly.user_administration');$subTitleIcon = 'fa-users';$users = $this->repository->all();@@ -166,9 +166,9 @@ class UserController extends Controller*/public function show(User $user){- $title = (string)trans('firefly.administration');+ $title = (string) trans('firefly.administration');$mainTitleIcon = 'fa-hand-spock-o';- $subTitle = (string)trans('firefly.single_user_administration', ['email' => $user->email]);+ $subTitle = (string) trans('firefly.single_user_administration', ['email' => $user->email]);$subTitleIcon = 'fa-user';$information = $this->repository->getUserData($user);@@ -215,10 +215,10 @@ class UserController extends Controller$this->repository->changeStatus($user, $data['blocked'], $data['blocked_code']);$this->repository->updateEmail($user, $data['email']);- session()->flash('success', (string)trans('firefly.updated_user', ['email' => $user->email]));+ session()->flash('success', (string) trans('firefly.updated_user', ['email' => $user->email]));app('preferences')->mark();$redirect = redirect($this->getPreviousUri('users.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {session()->put('users.edit.fromUpdate', true);diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.phpindex 0baccde090..15cb83e236 100644--- a/app/Http/Controllers/AttachmentController.php+++ b/app/Http/Controllers/AttachmentController.php@@ -57,7 +57,7 @@ class AttachmentController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-paperclip');- app('view')->share('title', (string)trans('firefly.attachments'));+ app('view')->share('title', (string) trans('firefly.attachments'));$this->repository = app(AttachmentRepositoryInterface::class);return $next($request);@@ -74,7 +74,7 @@ class AttachmentController extends Controller*/public function delete(Attachment $attachment){- $subTitle = (string)trans('firefly.delete_attachment', ['name' => $attachment->filename]);+ $subTitle = (string) trans('firefly.delete_attachment', ['name' => $attachment->filename]);// put previous url in session$this->rememberPreviousUri('attachments.delete.uri');@@ -96,7 +96,7 @@ class AttachmentController extends Controller$this->repository->destroy($attachment);- $request->session()->flash('success', (string)trans('firefly.attachment_deleted', ['name' => $name]));+ $request->session()->flash('success', (string) trans('firefly.attachment_deleted', ['name' => $name]));app('preferences')->mark();return redirect($this->getPreviousUri('attachments.delete.uri'));@@ -146,7 +146,7 @@ class AttachmentController extends Controllerpublic function edit(Request $request, Attachment $attachment){$subTitleIcon = 'fa-pencil';- $subTitle = (string)trans('firefly.edit_attachment', ['name' => $attachment->filename]);+ $subTitle = (string) trans('firefly.edit_attachment', ['name' => $attachment->filename]);// put previous url in session if not redirect from store (not "return_to_edit").if (true !== session('attachments.edit.fromUpdate')) {@@ -193,11 +193,11 @@ class AttachmentController extends Controller$data = $request->getAttachmentData();$this->repository->update($attachment, $data);- $request->session()->flash('success', (string)trans('firefly.attachment_updated', ['name' => $attachment->filename]));+ $request->session()->flash('success', (string) trans('firefly.attachment_updated', ['name' => $attachment->filename]));app('preferences')->mark();$redirect = redirect($this->getPreviousUri('attachments.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {$request->session()->put('attachments.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.phpindex bf960ddd66..73575412c9 100644--- a/app/Http/Controllers/Auth/ForgotPasswordController.php+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php@@ -86,14 +86,14 @@ class ForgotPasswordController extends Controller$user = User::where('email', $request->get('email'))->first();if (null !== $user && $repository->hasRole($user, 'demo')) {- return back()->withErrors(['email' => (string)trans('firefly.cannot_reset_demo_user')]);+ return back()->withErrors(['email' => (string) trans('firefly.cannot_reset_demo_user')]);}// We will send the password reset link to this user. Once we have attempted// to send the link, we will examine the response then see the message we// need to show to the user. Finally, we'll send out a proper response.$result = $this->broker()->sendResetLink($request->only('email'));- if('passwords.throttled' === $result) {+ if ('passwords.throttled' === $result) {Log::error(sprintf('Cowardly refuse to send a password reset message to user #%d because the reset button has been throttled.', $user->id));}@@ -124,7 +124,7 @@ class ForgotPasswordController extends Controller$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;$userCount = User::count();$allowRegistration = true;- $pageTitle = (string)trans('firefly.forgot_pw_page_title');+ $pageTitle = (string) trans('firefly.forgot_pw_page_title');if (true === $singleUserMode && $userCount > 0) {$allowRegistration = false;}diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.phpindex 5302526e5b..446a0b83ae 100644--- a/app/Http/Controllers/Auth/LoginController.php+++ b/app/Http/Controllers/Auth/LoginController.php@@ -128,6 +128,37 @@ class LoginController extends Controller$this->sendFailedLoginResponse($request);}+ /**+ * Get the login username to be used by the controller.+ *+ * @return string+ */+ public function username()+ {+ return $this->username;+ }++ /**+ * Get the failed login response instance.+ *+ * @param Request $request+ *+ * @return void+ *+ * @throws ValidationException+ */+ protected function sendFailedLoginResponse(Request $request)+ {+ $exception = ValidationException::withMessages(+ [+ $this->username() => [trans('auth.failed')],+ ]+ );+ $exception->redirectTo = route('login');++ throw $exception;+ }+/*** Log the user out of the application.*@@ -165,27 +196,6 @@ class LoginController extends Controller: redirect('/');}- /**- * Get the failed login response instance.- *- * @param Request $request- *- * @return void- *- * @throws ValidationException- */- protected function sendFailedLoginResponse(Request $request)- {- $exception = ValidationException::withMessages(- [- $this->username() => [trans('auth.failed')],- ]- );- $exception->redirectTo = route('login');-- throw $exception;- }-/*** Show the application's login form.*@@ -200,7 +210,7 @@ class LoginController extends Controller$count = DB::table('users')->count();$guard = config('auth.defaults.guard');- $title = (string)trans('firefly.login_page_title');+ $title = (string) trans('firefly.login_page_title');if (0 === $count && 'web' === $guard) {return redirect(route('register'));@@ -232,14 +242,4 @@ class LoginController extends Controllerreturn view('auth.login', compact('allowRegistration', 'email', 'remember', 'allowReset', 'title', 'usernameField'));}-- /**- * Get the login username to be used by the controller.- *- * @return string- */- public function username()- {- return $this->username;- }}diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.phpindex c61888412f..5356343be8 100644--- a/app/Http/Controllers/Auth/RegisterController.php+++ b/app/Http/Controllers/Auth/RegisterController.php@@ -100,13 +100,36 @@ class RegisterController extends Controller$this->guard()->login($user);- session()->flash('success', (string)trans('firefly.registered'));+ session()->flash('success', (string) trans('firefly.registered'));$this->registered($request, $user);return redirect($this->redirectPath());}+ /**+ * @return bool+ */+ protected function allowedToRegister(): bool+ {+ // is allowed to register?+ $allowRegistration = true;+ try {+ $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;+ } catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {+ $singleUserMode = true;+ }+ $userCount = User::count();+ $guard = config('auth.defaults.guard');+ if (true === $singleUserMode && $userCount > 0 && 'web' === $guard) {+ $allowRegistration = false;+ }+ if ('web' !== $guard) {+ $allowRegistration = false;+ }+ return $allowRegistration;+ }+/*** Show the application registration form.*@@ -118,7 +141,7 @@ class RegisterController extends Controllerpublic function showRegistrationForm(Request $request){$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;- $pageTitle = (string)trans('firefly.register_page_title');+ $pageTitle = (string) trans('firefly.register_page_title');$allowRegistration = $this->allowedToRegister();if (false === $allowRegistration) {@@ -131,26 +154,4 @@ class RegisterController extends Controllerreturn view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));}-- /**- * @return bool- */- protected function allowedToRegister(): bool {- // is allowed to register?- $allowRegistration = true;- try {- $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;- } catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {- $singleUserMode = true;- }- $userCount = User::count();- $guard = config('auth.defaults.guard');- if (true === $singleUserMode && $userCount > 0 && 'web' === $guard) {- $allowRegistration = false;- }- if('web' !== $guard) {- $allowRegistration = false;- }- return $allowRegistration;- }}diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.phpindex 03095fdbd6..13a338d177 100644--- a/app/Http/Controllers/Auth/ResetPasswordController.php+++ b/app/Http/Controllers/Auth/ResetPasswordController.php@@ -137,7 +137,7 @@ class ResetPasswordController extends Controller$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;$userCount = User::count();$allowRegistration = true;- $pageTitle = (string)trans('firefly.reset_pw_page_title');+ $pageTitle = (string) trans('firefly.reset_pw_page_title');if (true === $singleUserMode && $userCount > 0) {$allowRegistration = false;}diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.phpindex c9fdb334f6..bec3852b4a 100644--- a/app/Http/Controllers/Auth/TwoFactorController.php+++ b/app/Http/Controllers/Auth/TwoFactorController.php@@ -47,7 +47,7 @@ class TwoFactorController extends Controller/** @var User $user */$user = auth()->user();$siteOwner = config('firefly.site_owner');- $title = (string)trans('firefly.two_factor_forgot_title');+ $title = (string) trans('firefly.two_factor_forgot_title');return view('auth.lost-two-factor', compact('user', 'siteOwner', 'title'));}@@ -61,7 +61,7 @@ class TwoFactorController extends Controller{/** @var array $mfaHistory */$mfaHistory = Preferences::get('mfa_history', [])->data;- $mfaCode = (string)$request->get('one_time_password');+ $mfaCode = (string) $request->get('one_time_password');// is in history? then refuse to use it.if ($this->inMFAHistory($mfaCode, $mfaHistory)) {diff --git a/app/Http/Controllers/Bill/CreateController.php b/app/Http/Controllers/Bill/CreateController.phpindex 0d19198c05..123f9d2b62 100644--- a/app/Http/Controllers/Bill/CreateController.php+++ b/app/Http/Controllers/Bill/CreateController.php@@ -54,7 +54,7 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.bills'));+ app('view')->share('title', (string) trans('firefly.bills'));app('view')->share('mainTitleIcon', 'fa-calendar-o');$this->attachments = app(AttachmentHelperInterface::class);$this->repository = app(BillRepositoryInterface::class);@@ -77,9 +77,9 @@ class CreateController extends Controller/** @var array $billPeriods */$billPeriods = config('firefly.bill_periods');foreach ($billPeriods as $current) {- $periods[$current] = (string)trans('firefly.repeat_freq_' . $current);+ $periods[$current] = (string) trans('firefly.repeat_freq_' . $current);}- $subTitle = (string)trans('firefly.create_new_bill');+ $subTitle = (string) trans('firefly.create_new_bill');$defaultCurrency = app('amount')->getDefaultCurrency();// put previous url in session if not redirect from store (not "create another").@@ -101,18 +101,18 @@ class CreateController extends Controller*/public function store(BillStoreRequest $request): RedirectResponse{- $billData = $request->getBillData();+ $billData = $request->getBillData();$billData['active'] = true;try {$bill = $this->repository->store($billData);} catch (FireflyException $e) {Log::error($e->getMessage());- $request->session()->flash('error', (string)trans('firefly.bill_store_error'));+ $request->session()->flash('error', (string) trans('firefly.bill_store_error'));return redirect(route('bills.create'))->withInput();}- $request->session()->flash('success', (string)trans('firefly.stored_new_bill', ['name' => $bill->name]));+ $request->session()->flash('success', (string) trans('firefly.stored_new_bill', ['name' => $bill->name]));app('preferences')->mark();/** @var array $files */@@ -121,7 +121,7 @@ class CreateController extends Controller$this->attachments->saveAttachmentsForModel($bill, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {diff --git a/app/Http/Controllers/Bill/DeleteController.php b/app/Http/Controllers/Bill/DeleteController.phpindex 071420027d..cc5c3155f8 100644--- a/app/Http/Controllers/Bill/DeleteController.php+++ b/app/Http/Controllers/Bill/DeleteController.php@@ -53,7 +53,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.bills'));+ app('view')->share('title', (string) trans('firefly.bills'));app('view')->share('mainTitleIcon', 'fa-calendar-o');$this->repository = app(BillRepositoryInterface::class);@@ -73,7 +73,7 @@ class DeleteController extends Controller{// put previous url in session$this->rememberPreviousUri('bills.delete.uri');- $subTitle = (string)trans('firefly.delete_bill', ['name' => $bill->name]);+ $subTitle = (string) trans('firefly.delete_bill', ['name' => $bill->name]);return view('bills.delete', compact('bill', 'subTitle'));}@@ -91,7 +91,7 @@ class DeleteController extends Controller$name = $bill->name;$this->repository->destroy($bill);- $request->session()->flash('success', (string)trans('firefly.deleted_bill', ['name' => $name]));+ $request->session()->flash('success', (string) trans('firefly.deleted_bill', ['name' => $name]));app('preferences')->mark();return redirect($this->getPreviousUri('bills.delete.uri'));diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.phpindex 399938a81d..ac098e7625 100644--- a/app/Http/Controllers/Bill/IndexController.php+++ b/app/Http/Controllers/Bill/IndexController.php@@ -55,7 +55,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.bills'));+ app('view')->share('title', (string) trans('firefly.bills'));app('view')->share('mainTitleIcon', 'fa-calendar-o');$this->repository = app(BillRepositoryInterface::class);@@ -92,14 +92,14 @@ class IndexController extends Controller$bills = [0 => [ // the index is the order, not the ID.'object_group_id' => 0,- 'object_group_title' => (string)trans('firefly.default_group_title_name'),+ 'object_group_title' => (string) trans('firefly.default_group_title_name'),'bills' => [],],];/** @var Bill $bill */foreach ($collection as $bill) {$array = $transformer->transform($bill);- $groupOrder = (int)$array['object_group_order'];+ $groupOrder = (int) $array['object_group_order'];// make group array if necessary:$bills[$groupOrder] = $bills[$groupOrder] ?? ['object_group_id' => $array['object_group_id'],@@ -136,9 +136,9 @@ class IndexController extends Controller// summarise per currency / per group.$sums = $this->getSums($bills);$totals = $this->getTotals($sums);- $today = now()->startOfDay();+ $today = now()->startOfDay();- return view('bills.index', compact('bills', 'sums', 'total', 'totals','today'));+ return view('bills.index', compact('bills', 'sums', 'total', 'totals', 'today'));}/**@@ -173,8 +173,8 @@ class IndexController extends Controller];// only fill in avg when bill is active.if (count($bill['pay_dates']) > 0) {- $avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');- $avg = bcmul($avg, (string)count($bill['pay_dates']));+ $avg = bcdiv(bcadd((string) $bill['amount_min'], (string) $bill['amount_max']), '2');+ $avg = bcmul($avg, (string) count($bill['pay_dates']));$sums[$groupOrder][$currencyId]['avg'] = bcadd($sums[$groupOrder][$currencyId]['avg'], $avg);}// fill in per period regardless:@@ -193,7 +193,7 @@ class IndexController extends Controller*/private function amountPerPeriod(array $bill, string $range): string{- $avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');+ $avg = bcdiv(bcadd((string) $bill['amount_min'], (string) $bill['amount_max']), '2');Log::debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));Log::debug(sprintf('Average is %s', $avg));@@ -204,10 +204,10 @@ class IndexController extends Controller'quarterly' => '4','monthly' => '12','weekly' => '52.17',- 'daily' => '365.24',+ 'daily' => '365.24',];- $yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));- Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));+ $yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string) ($bill['skip'] + 1)));+ Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string) ($bill['skip'] + 1)));// per period:$division = [@@ -273,8 +273,8 @@ class IndexController extends Controller*/public function setOrder(Request $request, Bill $bill): JsonResponse{- $objectGroupTitle = (string)$request->get('objectGroupTitle');- $newOrder = (int)$request->get('order');+ $objectGroupTitle = (string) $request->get('objectGroupTitle');+ $newOrder = (int) $request->get('order');$this->repository->setOrder($bill, $newOrder);if ('' !== $objectGroupTitle) {$this->repository->setObjectGroup($bill, $objectGroupTitle);diff --git a/app/Http/Controllers/Bill/ShowController.php b/app/Http/Controllers/Bill/ShowController.phpindex 3a42d484ce..a26e6051bf 100644--- a/app/Http/Controllers/Bill/ShowController.php+++ b/app/Http/Controllers/Bill/ShowController.php@@ -63,7 +63,7 @@ class ShowController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.bills'));+ app('view')->share('title', (string) trans('firefly.bills'));app('view')->share('mainTitleIcon', 'fa-calendar-o');$this->repository = app(BillRepositoryInterface::class);@@ -84,7 +84,7 @@ class ShowController extends Controller{$total = 0;if (false === $bill->active) {- $request->session()->flash('warning', (string)trans('firefly.cannot_scan_inactive_bill'));+ $request->session()->flash('warning', (string) trans('firefly.cannot_scan_inactive_bill'));return redirect(route('bills.show', [$bill->id]));}@@ -94,7 +94,7 @@ class ShowController extends Controller$total = 0;}if (0 === $set->count()) {- $request->session()->flash('error', (string)trans('firefly.no_rules_for_bill'));+ $request->session()->flash('error', (string) trans('firefly.no_rules_for_bill'));return redirect(route('bills.show', [$bill->id]));}@@ -110,7 +110,7 @@ class ShowController extends Controller// file the rule(s)$ruleEngine->fire();- $request->session()->flash('success', (string)trans_choice('firefly.rescanned_bill', $total));+ $request->session()->flash('success', (string) trans_choice('firefly.rescanned_bill', $total));app('preferences')->mark();return redirect(route('bills.show', [$bill->id]));@@ -135,8 +135,8 @@ class ShowController extends Controller/** @var Carbon $end */$end = session('end');$year = $start->year;- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$yearAverage = $this->repository->getYearAverage($bill, $start);$overallAverage = $this->repository->getOverallAverage($bill);$manager = new Manager();diff --git a/app/Http/Controllers/Budget/AvailableBudgetController.php b/app/Http/Controllers/Budget/AvailableBudgetController.phpindex 397f87f3c5..0052bbaa48 100644--- a/app/Http/Controllers/Budget/AvailableBudgetController.php+++ b/app/Http/Controllers/Budget/AvailableBudgetController.php@@ -59,7 +59,7 @@ class AvailableBudgetController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->abRepository = app(AvailableBudgetRepositoryInterface::class);$this->currencyRepos = app(CurrencyRepositoryInterface::class);@@ -96,7 +96,7 @@ class AvailableBudgetController extends Controllerreturn redirect(route('available-budgets.edit', [$first->id]));}- $page = (int)($request->get('page') ?? 1);+ $page = (int) ($request->get('page') ?? 1);return view('budgets.available-budgets.create', compact('start', 'end', 'page', 'currency'));}@@ -128,7 +128,7 @@ class AvailableBudgetController extends Controllerreturn true;});- $page = (int)($request->get('page') ?? 1);+ $page = (int) ($request->get('page') ?? 1);return view('budgets.available-budgets.create-alternative', compact('start', 'end', 'page', 'currencies'));}@@ -140,7 +140,7 @@ class AvailableBudgetController extends Controller*/public function delete(Request $request){- $id = (int)$request->get('id');+ $id = (int) $request->get('id');if (0 !== $id) {$availableBudget = $this->abRepository->findById($id);if (null !== $availableBudget) {@@ -162,7 +162,7 @@ class AvailableBudgetController extends Controller*/public function edit(AvailableBudget $availableBudget, Carbon $start, Carbon $end){- $availableBudget->amount = number_format((float)$availableBudget->amount, $availableBudget->transactionCurrency->decimal_places, '.', '');+ $availableBudget->amount = number_format((float) $availableBudget->amount, $availableBudget->transactionCurrency->decimal_places, '.', '');return view('budgets.available-budgets.edit', compact('availableBudget', 'start', 'end'));}@@ -185,7 +185,7 @@ class AvailableBudgetController extends Controller}// validate amount- $amount = (string)$request->get('amount');+ $amount = (string) $request->get('amount');if ('' === $amount) {session()->flash('error', trans('firefly.invalid_amount'));@@ -198,7 +198,7 @@ class AvailableBudgetController extends Controller}// find currency- $currency = $this->currencyRepos->find((int)$request->get('currency_id'));+ $currency = $this->currencyRepos->find((int) $request->get('currency_id'));if (null === $currency) {session()->flash('error', trans('firefly.invalid_currency'));@@ -239,7 +239,7 @@ class AvailableBudgetController extends Controllerpublic function update(Request $request, AvailableBudget $availableBudget, Carbon $start, Carbon $end){// validate amount- $amount = (string)$request->get('amount');+ $amount = (string) $request->get('amount');if ('' === $amount) {session()->flash('error', trans('firefly.invalid_amount'));diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.phpindex edf13e6fbf..71b918fa86 100644--- a/app/Http/Controllers/Budget/BudgetLimitController.php+++ b/app/Http/Controllers/Budget/BudgetLimitController.php@@ -65,7 +65,7 @@ class BudgetLimitController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->repository = app(BudgetRepositoryInterface::class);$this->opsRepository = app(OperationsRepositoryInterface::class);@@ -130,14 +130,14 @@ class BudgetLimitController extends Controller{Log::debug('Going to store new budget-limit.', $request->all());// first search for existing one and update it if necessary.- $currency = $this->currencyRepos->find((int)$request->get('transaction_currency_id'));- $budget = $this->repository->find((int)$request->get('budget_id'));+ $currency = $this->currencyRepos->find((int) $request->get('transaction_currency_id'));+ $budget = $this->repository->find((int) $request->get('budget_id'));if (null === $currency || null === $budget) {throw new FireflyException('No valid currency or budget.');}$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));- $amount = (string)$request->get('amount');+ $amount = (string) $request->get('amount');$start->startOfDay();$end->startOfDay();@@ -156,7 +156,7 @@ class BudgetLimitController extends Controller$limit = $this->blRepository->store(['budget_id' => $request->get('budget_id'),- 'currency_id' => (int)$request->get('transaction_currency_id'),+ 'currency_id' => (int) $request->get('transaction_currency_id'),'start_date' => $start,'end_date' => $end,'amount' => $amount,@@ -171,7 +171,7 @@ class BudgetLimitController extends Controller$array['spent'] = $spentArr[$currency->id]['sum'] ?? '0';$array['left_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, bcadd($array['spent'], $array['amount']));$array['amount_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $limit['amount']);- $array['days_left'] = (string)$this->activeDaysLeft($start, $end);+ $array['days_left'] = (string) $this->activeDaysLeft($start, $end);// left per day:$array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']);@@ -192,7 +192,7 @@ class BudgetLimitController extends Controller*/public function update(Request $request, BudgetLimit $budgetLimit): JsonResponse{- $amount = (string)$request->get('amount');+ $amount = (string) $request->get('amount');if ('' === $amount) {$amount = '0';}@@ -210,12 +210,12 @@ class BudgetLimitController extends Controller$array['spent'] = $spentArr[$budgetLimit->transactionCurrency->id]['sum'] ?? '0';$array['left_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, bcadd($array['spent'], $array['amount']));$array['amount_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $limit['amount']);- $array['days_left'] = (string)$this->activeDaysLeft($limit->start_date, $limit->end_date);+ $array['days_left'] = (string) $this->activeDaysLeft($limit->start_date, $limit->end_date);// left per day:$array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']);// left per day formatted.- $array['amount'] = number_format((float)$limit['amount'], $limit->transactionCurrency->decimal_places, '.', '');+ $array['amount'] = number_format((float) $limit['amount'], $limit->transactionCurrency->decimal_places, '.', '');$array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']);return response()->json($array);diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.phpindex a7e898f77a..63aaa7db44 100644--- a/app/Http/Controllers/Budget/CreateController.php+++ b/app/Http/Controllers/Budget/CreateController.php@@ -52,7 +52,7 @@ class CreateController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->repository = app(BudgetRepositoryInterface::class);$this->attachments = app(AttachmentHelperInterface::class);@@ -75,23 +75,23 @@ class CreateController extends Controller// auto budget types$autoBudgetTypes = [- 0 => (string)trans('firefly.auto_budget_none'),- AutoBudget::AUTO_BUDGET_RESET => (string)trans('firefly.auto_budget_reset'),- AutoBudget::AUTO_BUDGET_ROLLOVER => (string)trans('firefly.auto_budget_rollover'),+ 0 => (string) trans('firefly.auto_budget_none'),+ AutoBudget::AUTO_BUDGET_RESET => (string) trans('firefly.auto_budget_reset'),+ AutoBudget::AUTO_BUDGET_ROLLOVER => (string) trans('firefly.auto_budget_rollover'),];$autoBudgetPeriods = [- 'daily' => (string)trans('firefly.auto_budget_period_daily'),- 'weekly' => (string)trans('firefly.auto_budget_period_weekly'),- 'monthly' => (string)trans('firefly.auto_budget_period_monthly'),- 'quarterly' => (string)trans('firefly.auto_budget_period_quarterly'),- 'half_year' => (string)trans('firefly.auto_budget_period_half_year'),- 'yearly' => (string)trans('firefly.auto_budget_period_yearly'),+ 'daily' => (string) trans('firefly.auto_budget_period_daily'),+ 'weekly' => (string) trans('firefly.auto_budget_period_weekly'),+ 'monthly' => (string) trans('firefly.auto_budget_period_monthly'),+ 'quarterly' => (string) trans('firefly.auto_budget_period_quarterly'),+ 'half_year' => (string) trans('firefly.auto_budget_period_half_year'),+ 'yearly' => (string) trans('firefly.auto_budget_period_yearly'),];$currency = app('amount')->getDefaultCurrency();$preFilled = [- 'auto_budget_period' => $hasOldInput ? (bool)$request->old('auto_budget_period') : 'monthly',- 'auto_budget_currency_id' => $hasOldInput ? (int)$request->old('auto_budget_currency_id') : $currency->id,+ 'auto_budget_period' => $hasOldInput ? (bool) $request->old('auto_budget_period') : 'monthly',+ 'auto_budget_currency_id' => $hasOldInput ? (int) $request->old('auto_budget_currency_id') : $currency->id,];$request->session()->flash('preFilled', $preFilled);@@ -101,7 +101,7 @@ class CreateController extends Controller$this->rememberPreviousUri('budgets.create.uri');}$request->session()->forget('budgets.create.fromStore');- $subTitle = (string)trans('firefly.create_new_budget');+ $subTitle = (string) trans('firefly.create_new_budget');return view('budgets.create', compact('subTitle', 'autoBudgetTypes', 'autoBudgetPeriods'));}@@ -120,7 +120,7 @@ class CreateController extends Controller$budget = $this->repository->store($data);$this->repository->cleanupBudgets();- $request->session()->flash('success', (string)trans('firefly.stored_new_budget', ['name' => $budget->name]));+ $request->session()->flash('success', (string) trans('firefly.stored_new_budget', ['name' => $budget->name]));app('preferences')->mark();// store attachment(s):@@ -129,7 +129,7 @@ class CreateController extends Controller$this->attachments->saveAttachmentsForModel($budget, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -138,7 +138,7 @@ class CreateController extends Controller$redirect = redirect($this->getPreviousUri('budgets.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {$request->session()->put('budgets.create.fromStore', true);diff --git a/app/Http/Controllers/Budget/DeleteController.php b/app/Http/Controllers/Budget/DeleteController.phpindex 43d23a49cb..56a2ad3da7 100644--- a/app/Http/Controllers/Budget/DeleteController.php+++ b/app/Http/Controllers/Budget/DeleteController.php@@ -52,7 +52,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->repository = app(BudgetRepositoryInterface::class);@@ -70,7 +70,7 @@ class DeleteController extends Controller*/public function delete(Budget $budget){- $subTitle = (string)trans('firefly.delete_budget', ['name' => $budget->name]);+ $subTitle = (string) trans('firefly.delete_budget', ['name' => $budget->name]);// put previous url in session$this->rememberPreviousUri('budgets.delete.uri');@@ -90,7 +90,7 @@ class DeleteController extends Controller{$name = $budget->name;$this->repository->destroy($budget);- $request->session()->flash('success', (string)trans('firefly.deleted_budget', ['name' => $name]));+ $request->session()->flash('success', (string) trans('firefly.deleted_budget', ['name' => $name]));app('preferences')->mark();return redirect($this->getPreviousUri('budgets.delete.uri'));diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.phpindex 1a5c7441b7..d2c77668ea 100644--- a/app/Http/Controllers/Budget/EditController.php+++ b/app/Http/Controllers/Budget/EditController.php@@ -56,7 +56,7 @@ class EditController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->repository = app(BudgetRepositoryInterface::class);$this->attachments = app(AttachmentHelperInterface::class);@@ -76,34 +76,34 @@ class EditController extends Controller*/public function edit(Request $request, Budget $budget){- $subTitle = (string)trans('firefly.edit_budget', ['name' => $budget->name]);+ $subTitle = (string) trans('firefly.edit_budget', ['name' => $budget->name]);$autoBudget = $this->repository->getAutoBudget($budget);// auto budget types$autoBudgetTypes = [- 0 => (string)trans('firefly.auto_budget_none'),- AutoBudget::AUTO_BUDGET_RESET => (string)trans('firefly.auto_budget_reset'),- AutoBudget::AUTO_BUDGET_ROLLOVER => (string)trans('firefly.auto_budget_rollover'),+ 0 => (string) trans('firefly.auto_budget_none'),+ AutoBudget::AUTO_BUDGET_RESET => (string) trans('firefly.auto_budget_reset'),+ AutoBudget::AUTO_BUDGET_ROLLOVER => (string) trans('firefly.auto_budget_rollover'),];$autoBudgetPeriods = [- 'daily' => (string)trans('firefly.auto_budget_period_daily'),- 'weekly' => (string)trans('firefly.auto_budget_period_weekly'),- 'monthly' => (string)trans('firefly.auto_budget_period_monthly'),- 'quarterly' => (string)trans('firefly.auto_budget_period_quarterly'),- 'half_year' => (string)trans('firefly.auto_budget_period_half_year'),- 'yearly' => (string)trans('firefly.auto_budget_period_yearly'),+ 'daily' => (string) trans('firefly.auto_budget_period_daily'),+ 'weekly' => (string) trans('firefly.auto_budget_period_weekly'),+ 'monthly' => (string) trans('firefly.auto_budget_period_monthly'),+ 'quarterly' => (string) trans('firefly.auto_budget_period_quarterly'),+ 'half_year' => (string) trans('firefly.auto_budget_period_half_year'),+ 'yearly' => (string) trans('firefly.auto_budget_period_yearly'),];// code to handle active-checkboxes$hasOldInput = null !== $request->old('_token');$currency = app('amount')->getDefaultCurrency();$preFilled = [- 'active' => $hasOldInput ? (bool)$request->old('active') : $budget->active,- 'auto_budget_currency_id' => $hasOldInput ? (int)$request->old('auto_budget_currency_id') : $currency->id,+ 'active' => $hasOldInput ? (bool) $request->old('active') : $budget->active,+ 'auto_budget_currency_id' => $hasOldInput ? (int) $request->old('auto_budget_currency_id') : $currency->id,];if ($autoBudget) {$amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;- $preFilled['auto_budget_amount'] = number_format((float)$amount, $autoBudget->transactionCurrency->decimal_places, '.', '');+ $preFilled['auto_budget_amount'] = number_format((float) $amount, $autoBudget->transactionCurrency->decimal_places, '.', '');}// put previous url in session if not redirect from store (not "return_to_edit").@@ -129,7 +129,7 @@ class EditController extends Controller$data = $request->getBudgetData();$this->repository->update($budget, $data);- $request->session()->flash('success', (string)trans('firefly.updated_budget', ['name' => $budget->name]));+ $request->session()->flash('success', (string) trans('firefly.updated_budget', ['name' => $budget->name]));$this->repository->cleanupBudgets();app('preferences')->mark();@@ -141,14 +141,14 @@ class EditController extends Controller$this->attachments->saveAttachmentsForModel($budget, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));}- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {$request->session()->put('budgets.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.phpindex abc9a52e46..ed681e5565 100644--- a/app/Http/Controllers/Budget/IndexController.php+++ b/app/Http/Controllers/Budget/IndexController.php@@ -68,7 +68,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->repository = app(BudgetRepositoryInterface::class);$this->opsRepository = app(OperationsRepositoryInterface::class);@@ -98,7 +98,7 @@ class IndexController extends ControllerLog::debug('Start of IndexController::index()');// collect some basic vars:- $range = (string)app('preferences')->get('viewRange', '1M')->data;+ $range = (string) app('preferences')->get('viewRange', '1M')->data;$start = $start ?? session('start', Carbon::now()->startOfMonth());$end = $end ?? app('navigation')->endOfPeriod($start, $range);$defaultCurrency = app('amount')->getDefaultCurrency();@@ -131,7 +131,7 @@ class IndexController extends Controller// number of days for consistent budgeting.$activeDaysPassed = $this->activeDaysPassed($start, $end); // see method description.- $activeDaysLeft = $this->activeDaysLeft($start, $end); // see method description.+ $activeDaysLeft = $this->activeDaysLeft($start, $end); // see method description.// get all inactive budgets, and simply list them:$inactive = $this->repository->getInactiveBudgets();@@ -207,7 +207,7 @@ class IndexController extends Controller$currency = $limit->transactionCurrency ?? $defaultCurrency;$array['budgeted'][] = ['id' => $limit->id,- 'amount' => number_format((float)$limit->amount, $currency->decimal_places, '.', ''),+ 'amount' => number_format((float) $limit->amount, $currency->decimal_places, '.', ''),'start_date' => $limit->start_date->isoFormat($this->monthAndDayFormat),'end_date' => $limit->end_date->isoFormat($this->monthAndDayFormat),'in_range' => $limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end),@@ -307,7 +307,7 @@ class IndexController extends Controller$budgetIds = $request->get('budgetIds');foreach ($budgetIds as $index => $budgetId) {- $budgetId = (int)$budgetId;+ $budgetId = (int) $budgetId;$budget = $repository->find($budgetId);if (null !== $budget) {Log::debug(sprintf('Set budget #%d ("%s") to position %d', $budget->id, $budget->name, $index + 1));diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.phpindex 10b4e4093b..82e26a4590 100644--- a/app/Http/Controllers/Budget/ShowController.php+++ b/app/Http/Controllers/Budget/ShowController.php@@ -60,7 +60,7 @@ class ShowController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->journalRepos = app(JournalRepositoryInterface::class);$this->repository = app(BudgetRepositoryInterface::class);@@ -95,8 +95,8 @@ class ShowController extends Controller$first = $this->journalRepos->firstNull();$firstDate = null !== $first ? $first->date : $start;$periods = $this->getNoBudgetPeriodOverview($firstDate, $end);- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);@@ -119,12 +119,12 @@ class ShowController extends Controllerpublic function noBudgetAll(Request $request){- $subTitle = (string)trans('firefly.all_journals_without_budget');+ $subTitle = (string) trans('firefly.all_journals_without_budget');$first = $this->journalRepos->firstNull();$start = null === $first ? new Carbon : $first->date;$end = today(config('app.timezone'));- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);@@ -150,8 +150,8 @@ class ShowController extends Controller/** @var Carbon $allStart */$allStart = session('first', Carbon::now()->startOfYear());$allEnd = today();- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$limits = $this->getLimits($budget, $allStart, $allEnd);$repetition = null;$attachments = $this->repository->getAttachments($budget);@@ -165,7 +165,7 @@ class ShowController extends Controller$groups = $collector->getPaginatedGroups();$groups->setPath(route('budgets.show', [$budget->id]));- $subTitle = (string)trans('firefly.all_journals_for_budget', ['name' => $budget->name]);+ $subTitle = (string) trans('firefly.all_journals_for_budget', ['name' => $budget->name]);return view('budgets.show', compact('limits', 'attachments', 'budget', 'repetition', 'groups', 'subTitle'));}@@ -186,8 +186,8 @@ class ShowController extends Controllerthrow new FireflyException('This budget limit is not part of this budget.');}- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$subTitle = trans('firefly.budget_in_period',[diff --git a/app/Http/Controllers/Category/CreateController.php b/app/Http/Controllers/Category/CreateController.phpindex c81dc9df32..3ebd4b6c10 100644--- a/app/Http/Controllers/Category/CreateController.php+++ b/app/Http/Controllers/Category/CreateController.php@@ -53,7 +53,7 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.categories'));+ app('view')->share('title', (string) trans('firefly.categories'));app('view')->share('mainTitleIcon', 'fa-bookmark');$this->repository = app(CategoryRepositoryInterface::class);$this->attachments = app(AttachmentHelperInterface::class);@@ -76,7 +76,7 @@ class CreateController extends Controller$this->rememberPreviousUri('categories.create.uri');}$request->session()->forget('categories.create.fromStore');- $subTitle = (string)trans('firefly.create_new_category');+ $subTitle = (string) trans('firefly.create_new_category');return view('categories.create', compact('subTitle'));}@@ -94,7 +94,7 @@ class CreateController extends Controller$data = $request->getCategoryData();$category = $this->repository->store($data);- $request->session()->flash('success', (string)trans('firefly.stored_category', ['name' => $category->name]));+ $request->session()->flash('success', (string) trans('firefly.stored_category', ['name' => $category->name]));app('preferences')->mark();// store attachment(s):@@ -103,7 +103,7 @@ class CreateController extends Controller$this->attachments->saveAttachmentsForModel($category, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -111,7 +111,7 @@ class CreateController extends Controller}$redirect = redirect(route('categories.index'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {$request->session()->put('categories.create.fromStore', true);diff --git a/app/Http/Controllers/Category/DeleteController.php b/app/Http/Controllers/Category/DeleteController.phpindex 75e3b4b77c..5648f90e81 100644--- a/app/Http/Controllers/Category/DeleteController.php+++ b/app/Http/Controllers/Category/DeleteController.php@@ -51,7 +51,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.categories'));+ app('view')->share('title', (string) trans('firefly.categories'));app('view')->share('mainTitleIcon', 'fa-bookmark');$this->repository = app(CategoryRepositoryInterface::class);@@ -69,7 +69,7 @@ class DeleteController extends Controller*/public function delete(Category $category){- $subTitle = (string)trans('firefly.delete_category', ['name' => $category->name]);+ $subTitle = (string) trans('firefly.delete_category', ['name' => $category->name]);// put previous url in session$this->rememberPreviousUri('categories.delete.uri');@@ -80,7 +80,7 @@ class DeleteController extends Controller/*** Destroy a category.*- * @param Request $request+ * @param Request $request* @param Category $category** @return RedirectResponse|Redirector@@ -90,7 +90,7 @@ class DeleteController extends Controller$name = $category->name;$this->repository->destroy($category);- $request->session()->flash('success', (string)trans('firefly.deleted_category', ['name' => $name]));+ $request->session()->flash('success', (string) trans('firefly.deleted_category', ['name' => $name]));app('preferences')->mark();return redirect($this->getPreviousUri('categories.delete.uri'));diff --git a/app/Http/Controllers/Category/EditController.php b/app/Http/Controllers/Category/EditController.phpindex ab92c207cb..420c7c4974 100644--- a/app/Http/Controllers/Category/EditController.php+++ b/app/Http/Controllers/Category/EditController.php@@ -54,7 +54,7 @@ class EditController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.categories'));+ app('view')->share('title', (string) trans('firefly.categories'));app('view')->share('mainTitleIcon', 'fa-bookmark');$this->repository = app(CategoryRepositoryInterface::class);$this->attachments = app(AttachmentHelperInterface::class);@@ -74,7 +74,7 @@ class EditController extends Controller*/public function edit(Request $request, Category $category){- $subTitle = (string)trans('firefly.edit_category', ['name' => $category->name]);+ $subTitle = (string) trans('firefly.edit_category', ['name' => $category->name]);// put previous url in session if not redirect from store (not "return_to_edit").if (true !== session('categories.edit.fromUpdate')) {@@ -102,7 +102,7 @@ class EditController extends Controller$data = $request->getCategoryData();$this->repository->update($category, $data);- $request->session()->flash('success', (string)trans('firefly.updated_category', ['name' => $category->name]));+ $request->session()->flash('success', (string) trans('firefly.updated_category', ['name' => $category->name]));app('preferences')->mark();// store new attachment(s):@@ -111,7 +111,7 @@ class EditController extends Controller$this->attachments->saveAttachmentsForModel($category, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -119,7 +119,7 @@ class EditController extends Controller}$redirect = redirect($this->getPreviousUri('categories.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {$request->session()->put('categories.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Category/IndexController.php b/app/Http/Controllers/Category/IndexController.phpindex a0bbfd6b00..aa56512388 100644--- a/app/Http/Controllers/Category/IndexController.php+++ b/app/Http/Controllers/Category/IndexController.php@@ -52,7 +52,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.categories'));+ app('view')->share('title', (string) trans('firefly.categories'));app('view')->share('mainTitleIcon', 'fa-bookmark');$this->repository = app(CategoryRepositoryInterface::class);@@ -71,8 +71,8 @@ class IndexController extends Controller*/public function index(Request $request){- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$collection = $this->repository->getCategories();$total = $collection->count();$collection = $collection->slice(($page - 1) * $pageSize, $pageSize);diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.phpindex 669c740520..a2cf0dd97a 100644--- a/app/Http/Controllers/Category/NoCategoryController.php+++ b/app/Http/Controllers/Category/NoCategoryController.php@@ -58,7 +58,7 @@ class NoCategoryController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.categories'));+ app('view')->share('title', (string) trans('firefly.categories'));app('view')->share('mainTitleIcon', 'fa-bookmark');$this->journalRepos = app(JournalRepositoryInterface::class);@@ -84,8 +84,8 @@ class NoCategoryController extends Controller$start = $start ?? session('start');/** @var Carbon $end */$end = $end ?? session('end');- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$subTitle = trans('firefly.without_category_between',['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]@@ -121,10 +121,10 @@ class NoCategoryController extends Controller$start = null;$end = null;$periods = new Collection;- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;Log::debug('Start of noCategory()');- $subTitle = (string)trans('firefly.all_journals_without_category');+ $subTitle = (string) trans('firefly.all_journals_without_category');$first = $this->journalRepos->firstNull();$start = null === $first ? new Carbon : $first->date;$end = today(config('app.timezone'));diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.phpindex b8d82118f0..9fb0b8b391 100644--- a/app/Http/Controllers/Category/ShowController.php+++ b/app/Http/Controllers/Category/ShowController.php@@ -59,7 +59,7 @@ class ShowController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.categories'));+ app('view')->share('title', (string) trans('firefly.categories'));app('view')->share('mainTitleIcon', 'fa-bookmark');$this->repository = app(CategoryRepositoryInterface::class);@@ -86,9 +86,9 @@ class ShowController extends Controller/** @var Carbon $end */$end = $end ?? session('end', Carbon::now()->endOfMonth());$subTitleIcon = 'fa-bookmark';- $page = (int)$request->get('page');+ $page = (int) $request->get('page');$attachments = $this->repository->getAttachments($category);- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$oldest = $this->repository->firstUseDate($category) ?? Carbon::now()->startOfYear();$periods = $this->getCategoryPeriodOverview($category, $oldest, $end);$path = route('categories.show', [$category->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);@@ -123,13 +123,13 @@ class ShowController extends Controller{// default values:$subTitleIcon = 'fa-bookmark';- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$start = null;$end = null;$periods = new Collection;- $subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]);+ $subTitle = (string) trans('firefly.all_journals_for_category', ['name' => $category->name]);$first = $this->repository->firstUseDate($category);/** @var Carbon $start */$start = $first ?? today(config('app.timezone'));diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.phpindex 04ac829d35..f47d748b71 100644--- a/app/Http/Controllers/Chart/BillController.php+++ b/app/Http/Controllers/Chart/BillController.php@@ -76,18 +76,18 @@ class BillController extends Controller$chartData = [];$currencies = [];- $paid = $repository->getBillsPaidInRangePerCurrency($start, $end); // will be a negative amount.+ $paid = $repository->getBillsPaidInRangePerCurrency($start, $end); // will be a negative amount.$unpaid = $repository->getBillsUnpaidInRangePerCurrency($start, $end); // will be a positive amount.foreach ($paid as $currencyId => $amount) {$currencies[$currencyId] = $currencies[$currencyId] ?? $currencyRepository->find($currencyId);- $label = (string)trans('firefly.paid_in_currency', ['currency' => $currencies[$currencyId]->name]);+ $label = (string) trans('firefly.paid_in_currency', ['currency' => $currencies[$currencyId]->name]);$chartData[$label] = ['amount' => $amount, 'currency_symbol' => $currencies[$currencyId]->symbol,'currency_code' => $currencies[$currencyId]->code];}foreach ($unpaid as $currencyId => $amount) {$currencies[$currencyId] = $currencies[$currencyId] ?? $currencyRepository->find($currencyId);- $label = (string)trans('firefly.unpaid_in_currency', ['currency' => $currencies[$currencyId]->name]);+ $label = (string) trans('firefly.unpaid_in_currency', ['currency' => $currencies[$currencyId]->name]);$chartData[$label] = ['amount' => $amount, 'currency_symbol' => $currencies[$currencyId]->symbol,'currency_code' => $currencies[$currencyId]->code];}@@ -136,16 +136,16 @@ class BillController extends Controller);$chartData = [- ['type' => 'line', 'label' => (string)trans('firefly.min-amount'), 'currency_symbol' => $bill->transactionCurrency->symbol,+ ['type' => 'line', 'label' => (string) trans('firefly.min-amount'), 'currency_symbol' => $bill->transactionCurrency->symbol,'currency_code' => $bill->transactionCurrency->code, 'entries' => []],- ['type' => 'line', 'label' => (string)trans('firefly.max-amount'), 'currency_symbol' => $bill->transactionCurrency->symbol,+ ['type' => 'line', 'label' => (string) trans('firefly.max-amount'), 'currency_symbol' => $bill->transactionCurrency->symbol,'currency_code' => $bill->transactionCurrency->code, 'entries' => []],- ['type' => 'bar', 'label' => (string)trans('firefly.journal-amount'), 'currency_symbol' => $bill->transactionCurrency->symbol,+ ['type' => 'bar', 'label' => (string) trans('firefly.journal-amount'), 'currency_symbol' => $bill->transactionCurrency->symbol,'currency_code' => $bill->transactionCurrency->code, 'entries' => []],];foreach ($journals as $journal) {- $date = $journal['date']->isoFormat((string)trans('config.month_and_day_js', [], $locale));+ $date = $journal['date']->isoFormat((string) trans('config.month_and_day_js', [], $locale));$chartData[0]['entries'][$date] = $bill->amount_min; // minimum amount of bill$chartData[1]['entries'][$date] = $bill->amount_max; // maximum amount of billdiff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.phpindex bff5b7848f..ba849883d0 100644--- a/app/Http/Controllers/Chart/BudgetController.php+++ b/app/Http/Controllers/Chart/BudgetController.php@@ -182,14 +182,14 @@ class BudgetController extends Controllerwhile ($start <= $end) {$current = clone $start;$expenses = $this->opsRepository->sumExpenses($current, $current, null, $budgetCollection, $currency);- $spent = $expenses[(int)$currency->id]['sum'] ?? '0';+ $spent = $expenses[(int) $currency->id]['sum'] ?? '0';$amount = bcadd($amount, $spent);- $format = $start->isoFormat((string)trans('config.month_and_day_js', [], $locale));+ $format = $start->isoFormat((string) trans('config.month_and_day_js', [], $locale));$entries[$format] = $amount;$start->addDay();}- $data = $this->generator->singleSet((string)trans('firefly.left'), $entries);+ $data = $this->generator->singleSet((string) trans('firefly.left'), $entries);// add currency symbol from budget limit:$data['datasets'][0]['currency_symbol'] = $budgetLimit->transactionCurrency->symbol;$data['datasets'][0]['currency_code'] = $budgetLimit->transactionCurrency->code;@@ -238,7 +238,7 @@ class BudgetController extends Controller// group by asset account ID:foreach ($journals as $journal) {- $key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);+ $key = sprintf('%d-%d', (int) $journal['source_account_id'], $journal['currency_id']);$result[$key] = $result[$key] ?? ['amount' => '0','currency_symbol' => $journal['currency_symbol'],@@ -251,7 +251,7 @@ class BudgetController extends Controller$names = $this->getAccountNames(array_keys($result));foreach ($result as $combinedId => $info) {$parts = explode('-', $combinedId);- $assetId = (int)$parts[0];+ $assetId = (int) $parts[0];$title = sprintf('%s (%s)', $names[$assetId] ?? '(empty)', $info['currency_name']);$chartData[$title]= [@@ -317,7 +317,7 @@ class BudgetController extends Controller$names = $this->getCategoryNames(array_keys($result));foreach ($result as $combinedId => $info) {$parts = explode('-', $combinedId);- $categoryId = (int)$parts[0];+ $categoryId = (int) $parts[0];$title = sprintf('%s (%s)', $names[$categoryId] ?? '(empty)', $info['currency_name']);$chartData[$title] = ['amount' => $info['amount'],@@ -383,7 +383,7 @@ class BudgetController extends Controller$names = $this->getAccountNames(array_keys($result));foreach ($result as $combinedId => $info) {$parts = explode('-', $combinedId);- $opposingId = (int)$parts[0];+ $opposingId = (int) $parts[0];$name = $names[$opposingId] ?? 'no name';$title = sprintf('%s (%s)', $name, $info['currency_name']);$chartData[$title] = [@@ -460,14 +460,14 @@ class BudgetController extends Controller$preferredRange = app('navigation')->preferredRangeFormat($start, $end);$chartData = [[- 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency->name]),+ 'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency->name]),'type' => 'bar','entries' => [],'currency_symbol' => $currency->symbol,'currency_code' => $currency->code,],[- 'label' => (string)trans('firefly.box_budgeted_in_currency', ['currency' => $currency->name]),+ 'label' => (string) trans('firefly.box_budgeted_in_currency', ['currency' => $currency->name]),'type' => 'bar','currency_symbol' => $currency->symbol,'currency_code' => $currency->code,@@ -490,13 +490,13 @@ class BudgetController extends Controller// get budget limit in this period for this currency.$limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd);if (null !== $limit) {- $chartData[1]['entries'][$title] = round((float)$limit->amount, $currency->decimal_places);+ $chartData[1]['entries'][$title] = round((float) $limit->amount, $currency->decimal_places);}// get spent amount in this period for this currency.$sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection([$budget]), $currency);$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');- $chartData[0]['entries'][$title] = round((float)$amount, $currency->decimal_places);+ $chartData[0]['entries'][$title] = round((float) $amount, $currency->decimal_places);$currentStart = clone $currentEnd;$currentStart->addDay()->startOfDay();@@ -542,11 +542,11 @@ class BudgetController extends Controller$title = $currentStart->isoFormat($titleFormat);$sum = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency);$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');- $chartData[$title] = round((float)$amount, $currency->decimal_places);+ $chartData[$title] = round((float) $amount, $currency->decimal_places);$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);}- $data = $this->generator->singleSet((string)trans('firefly.spent'), $chartData);+ $data = $this->generator->singleSet((string) trans('firefly.spent'), $chartData);$cache->store($data);return response()->json($data);diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.phpindex a015cd1153..da0bf7db31 100644--- a/app/Http/Controllers/Chart/BudgetReportController.php+++ b/app/Http/Controllers/Chart/BudgetReportController.php@@ -1,4 +1,5 @@-<?php /**+<?php+/*** BudgetReportController.php* Copyright (c) 2020 [email protected]*@@ -200,7 +201,7 @@ class BudgetReportController extends Controller$chartData[$spentKey] = $chartData[$spentKey] ?? ['label' => sprintf('%s (%s)',- (string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),+ (string) trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),$currency['currency_name']),'type' => 'bar',diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.phpindex 2aee37c520..e6c44cba9f 100644--- a/app/Http/Controllers/Chart/CategoryController.php+++ b/app/Http/Controllers/Chart/CategoryController.php@@ -198,7 +198,7 @@ class CategoryController extends Controllerif (null !== $category) {/** @var OperationsRepositoryInterface $opsRepository */$opsRepository = app(OperationsRepositoryInterface::class);- $categoryId = (int)$category->id;+ $categoryId = (int) $category->id;// this gives us all currencies$collection = new Collection([$category]);$expenses = $opsRepository->listExpenses($start, $end, null, $collection);@@ -217,7 +217,7 @@ class CategoryController extends Controller$inKey = sprintf('%d-in', $currencyId);$chartData[$outKey]= [- 'label' => sprintf('%s (%s)', (string)trans('firefly.spent'), $currencyInfo['currency_name']),+ 'label' => sprintf('%s (%s)', (string) trans('firefly.spent'), $currencyInfo['currency_name']),'entries' => [],'type' => 'bar','backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red@@ -225,7 +225,7 @@ class CategoryController extends Controller$chartData[$inKey]= [- 'label' => sprintf('%s (%s)', (string)trans('firefly.earned'), $currencyInfo['currency_name']),+ 'label' => sprintf('%s (%s)', (string) trans('firefly.earned'), $currencyInfo['currency_name']),'entries' => [],'type' => 'bar','backgroundColor' => 'rgba(0, 141, 76, 0.5)', // greendiff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.phpindex 57be9d9205..84a73c343d 100644--- a/app/Http/Controllers/Chart/CategoryReportController.php+++ b/app/Http/Controllers/Chart/CategoryReportController.php@@ -265,7 +265,7 @@ class CategoryReportController extends Controller$chartData[$spentKey] = $chartData[$spentKey] ?? ['label' => sprintf('%s (%s)',- (string)trans('firefly.spent_in_specific_category', ['category' => $category->name]),+ (string) trans('firefly.spent_in_specific_category', ['category' => $category->name]),$currency['currency_name']),'type' => 'bar',@@ -292,7 +292,7 @@ class CategoryReportController extends Controller$chartData[$spentKey] = $chartData[$spentKey] ?? ['label' => sprintf('%s (%s)',- (string)trans('firefly.earned_in_specific_category', ['category' => $category->name]),+ (string) trans('firefly.earned_in_specific_category', ['category' => $category->name]),$currency['currency_name']),'type' => 'bar',diff --git a/app/Http/Controllers/Chart/DoubleReportController.php b/app/Http/Controllers/Chart/DoubleReportController.phpindex 9e4e317f7f..b1f7fa6a08 100644--- a/app/Http/Controllers/Chart/DoubleReportController.php+++ b/app/Http/Controllers/Chart/DoubleReportController.php@@ -199,7 +199,7 @@ class DoubleReportController extends Controller$chartData[$spentKey] = $chartData[$spentKey] ?? ['label' => sprintf('%s (%s)',- (string)trans('firefly.spent_in_specific_double', ['account' => $name]),+ (string) trans('firefly.spent_in_specific_double', ['account' => $name]),$currency['currency_name']),'type' => 'bar',@@ -225,7 +225,7 @@ class DoubleReportController extends Controller$chartData[$earnedKey] = $chartData[$earnedKey] ?? ['label' => sprintf('%s (%s)',- (string)trans('firefly.earned_in_specific_double', ['account' => $name]),+ (string) trans('firefly.earned_in_specific_double', ['account' => $name]),$currency['currency_name']),'type' => 'bar',diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.phpindex 3fbac308c7..3a30860805 100644--- a/app/Http/Controllers/Chart/ExpenseReportController.php+++ b/app/Http/Controllers/Chart/ExpenseReportController.php@@ -113,27 +113,27 @@ class ExpenseReportController extends Controller/** @var Account $exp */$exp = $combination->first();$chartData[$exp->id . '-in'] = [- 'label' => sprintf('%s (%s)', $name, (string)trans('firefly.income')),+ 'label' => sprintf('%s (%s)', $name, (string) trans('firefly.income')),'type' => 'bar','yAxisID' => 'y-axis-0','entries' => [],];$chartData[$exp->id . '-out'] = [- 'label' => sprintf('%s (%s)', $name, (string)trans('firefly.expenses')),+ 'label' => sprintf('%s (%s)', $name, (string) trans('firefly.expenses')),'type' => 'bar','yAxisID' => 'y-axis-0','entries' => [],];// total in, total out:$chartData[$exp->id . '-total-in'] = [- 'label' => sprintf('%s (%s)', $name, (string)trans('firefly.sum_of_income')),+ 'label' => sprintf('%s (%s)', $name, (string) trans('firefly.sum_of_income')),'type' => 'line','fill' => false,'yAxisID' => 'y-axis-1','entries' => [],];$chartData[$exp->id . '-total-out'] = [- 'label' => sprintf('%s (%s)', $name, (string)trans('firefly.sum_of_expenses')),+ 'label' => sprintf('%s (%s)', $name, (string) trans('firefly.sum_of_expenses')),'type' => 'line','fill' => false,'yAxisID' => 'y-axis-1',diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.phpindex e126d4eefc..e69b24dd5a 100644--- a/app/Http/Controllers/Chart/PiggyBankController.php+++ b/app/Http/Controllers/Chart/PiggyBankController.php@@ -100,7 +100,7 @@ class PiggyBankController extends Controller});$currentSum = $filtered->sum('amount');- $label = $oldest->isoFormat((string)trans('config.month_and_day_js', [], $locale));+ $label = $oldest->isoFormat((string) trans('config.month_and_day_js', [], $locale));$chartData[$label] = $currentSum;$oldest = app('navigation')->addPeriod($oldest, $step, 0);}@@ -110,7 +110,7 @@ class PiggyBankController extends Controller});$finalSum = $finalFiltered->sum('amount');- $finalLabel = $today->isoFormat((string)trans('config.month_and_day_js', [], $locale));+ $finalLabel = $today->isoFormat((string) trans('config.month_and_day_js', [], $locale));$chartData[$finalLabel] = $finalSum;$data = $this->generator->singleSet($piggyBank->name, $chartData);diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.phpindex f3ec2a6229..7726766f1d 100644--- a/app/Http/Controllers/Chart/ReportController.php+++ b/app/Http/Controllers/Chart/ReportController.php@@ -114,7 +114,7 @@ class ReportController extends Controller/** @var array $netWorthItem */foreach ($result as $netWorthItem) {$currencyId = $netWorthItem['currency']->id;- $label = $current->isoFormat((string)trans('config.month_and_day_js', [], $locale));+ $label = $current->isoFormat((string) trans('config.month_and_day_js', [], $locale));if (!array_key_exists($currencyId, $chartData)) {$chartData[$currencyId] = ['label' => 'Net worth in ' . $netWorthItem['currency']->name,@@ -179,13 +179,13 @@ class ReportController extends Controller/** @var array $journal */foreach ($journals as $journal) {$period = $journal['date']->format($format);- $currencyId = (int)$journal['currency_id'];+ $currencyId = (int) $journal['currency_id'];$data[$currencyId] = $data[$currencyId] ?? ['currency_id' => $currencyId,'currency_symbol' => $journal['currency_symbol'],'currency_code' => $journal['currency_code'],'currency_name' => $journal['currency_name'],- 'currency_decimal_places' => (int)$journal['currency_decimal_places'],+ 'currency_decimal_places' => (int) $journal['currency_decimal_places'],];$data[$currencyId][$period] = $data[$currencyId][$period] ?? ['period' => $period,@@ -217,7 +217,7 @@ class ReportController extends Controller/** @var array $currency */foreach ($data as $currency) {$income = [- 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),+ 'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),'type' => 'bar','backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green'currency_id' => $currency['currency_id'],@@ -226,7 +226,7 @@ class ReportController extends Controller'entries' => [],];$expense = [- 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),+ 'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),'type' => 'bar','backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red'currency_id' => $currency['currency_id'],@@ -240,8 +240,8 @@ class ReportController extends Controllerwhile ($currentStart <= $end) {$key = $currentStart->format($format);$title = $currentStart->isoFormat($titleFormat);- $income['entries'][$title] = round((float)($currency[$key]['earned'] ?? '0'), $currency['currency_decimal_places']);- $expense['entries'][$title] = round((float)($currency[$key]['spent'] ?? '0'), $currency['currency_decimal_places']);+ $income['entries'][$title] = round((float) ($currency[$key]['earned'] ?? '0'), $currency['currency_decimal_places']);+ $expense['entries'][$title] = round((float) ($currency[$key]['spent'] ?? '0'), $currency['currency_decimal_places']);$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);}diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.phpindex 389ff39420..75a452165a 100644--- a/app/Http/Controllers/Chart/TagReportController.php+++ b/app/Http/Controllers/Chart/TagReportController.php@@ -270,7 +270,7 @@ class TagReportController extends Controller$chartData[$spentKey] = $chartData[$spentKey] ?? ['label' => sprintf('%s (%s)',- (string)trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]),+ (string) trans('firefly.spent_in_specific_tag', ['tag' => $tag->tag]),$currency['currency_name']),'type' => 'bar',@@ -297,7 +297,7 @@ class TagReportController extends Controller$chartData[$spentKey] = $chartData[$spentKey] ?? ['label' => sprintf('%s (%s)',- (string)trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]),+ (string) trans('firefly.earned_in_specific_tag', ['tag' => $tag->tag]),$currency['currency_name']),'type' => 'bar',diff --git a/app/Http/Controllers/Chart/TransactionController.php b/app/Http/Controllers/Chart/TransactionController.phpindex c7c7dac871..5fc3ac925f 100644--- a/app/Http/Controllers/Chart/TransactionController.php+++ b/app/Http/Controllers/Chart/TransactionController.php@@ -80,7 +80,7 @@ class TransactionController extends Controller// group by category./** @var array $journal */foreach ($result as $journal) {- $budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');+ $budget = $journal['budget_name'] ?? (string) trans('firefly.no_budget');$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);$data[$title] = $data[$title] ?? ['amount' => '0',@@ -138,7 +138,7 @@ class TransactionController extends Controller// group by category./** @var array $journal */foreach ($result as $journal) {- $category = $journal['category_name'] ?? (string)trans('firefly.no_category');+ $category = $journal['category_name'] ?? (string) trans('firefly.no_category');$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);$data[$title] = $data[$title] ?? ['amount' => '0',diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.phpindex 22751a9377..2fd0eb6eeb 100644--- a/app/Http/Controllers/Controller.php+++ b/app/Http/Controllers/Controller.php@@ -92,9 +92,9 @@ abstract class Controller extends BaseControllerfunction ($request, $next): mixed {$locale = app('steam')->getLocale();// translations for specific strings:- $this->monthFormat = (string)trans('config.month_js', [], $locale);- $this->monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale);- $this->dateTimeFormat = (string)trans('config.date_time_js', [], $locale);+ $this->monthFormat = (string) trans('config.month_js', [], $locale);+ $this->monthAndDayFormat = (string) trans('config.month_and_day_js', [], $locale);+ $this->dateTimeFormat = (string) trans('config.date_time_js', [], $locale);// get shown-intro-preference:if (auth()->check()) {diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.phpindex f8e59c9f8e..0f60617e8e 100644--- a/app/Http/Controllers/CurrencyController.php+++ b/app/Http/Controllers/CurrencyController.php@@ -56,7 +56,7 @@ class CurrencyController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.currencies'));+ app('view')->share('title', (string) trans('firefly.currencies'));app('view')->share('mainTitleIcon', 'fa-usd');$this->repository = app(CurrencyRepositoryInterface::class);$this->userRepository = app(UserRepositoryInterface::class);@@ -78,13 +78,13 @@ class CurrencyController extends Controller/** @var User $user */$user = auth()->user();if (!$this->userRepository->hasRole($user, 'owner')) {- $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));+ $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));return redirect(route('currencies.index'));}$subTitleIcon = 'fa-plus';- $subTitle = (string)trans('firefly.create_currency');+ $subTitle = (string) trans('firefly.create_currency');// put previous url in session if not redirect from store (not "create another").if (true !== session('currencies.create.fromStore')) {@@ -107,7 +107,7 @@ class CurrencyController extends Controller*/public function defaultCurrency(Request $request){- $currencyId = (int)$request->get('id');+ $currencyId = (int) $request->get('id');if ($currencyId > 0) {// valid currency?$currency = $this->repository->find($currencyId);@@ -117,7 +117,7 @@ class CurrencyController extends ControllerLog::channel('audit')->info(sprintf('Make %s the default currency.', $currency->code));$this->repository->enable($currency);- $request->session()->flash('success', (string)trans('firefly.new_default_currency', ['name' => $currency->name]));+ $request->session()->flash('success', (string) trans('firefly.new_default_currency', ['name' => $currency->name]));return redirect(route('currencies.index'));}@@ -140,7 +140,7 @@ class CurrencyController extends Controller$user = auth()->user();if (!$this->userRepository->hasRole($user, 'owner')) {- $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));+ $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code));return redirect(route('currencies.index'));@@ -149,7 +149,7 @@ class CurrencyController extends Controllerif ($this->repository->currencyInUse($currency)) {$location = $this->repository->currencyInUseAt($currency);- $message = (string)trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]);+ $message = (string) trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]);$request->session()->flash('error', $message);Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but currency is in use.', $currency->code));@@ -158,7 +158,7 @@ class CurrencyController extends Controller// put previous url in session$this->rememberPreviousUri('currencies.delete.uri');- $subTitle = (string)trans('form.delete_currency', ['name' => $currency->name]);+ $subTitle = (string) trans('form.delete_currency', ['name' => $currency->name]);Log::channel('audit')->info(sprintf('Visit page to delete currency %s.', $currency->code));return view('currencies.delete', compact('currency', 'subTitle'));@@ -178,7 +178,7 @@ class CurrencyController extends Controller$user = auth()->user();if (!$this->userRepository->hasRole($user, 'owner')) {- $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));+ $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code));return redirect(route('currencies.index'));@@ -186,14 +186,14 @@ class CurrencyController extends Controller}if ($this->repository->currencyInUse($currency)) {- $request->session()->flash('error', (string)trans('firefly.cannot_delete_currency', ['name' => e($currency->name)]));+ $request->session()->flash('error', (string) trans('firefly.cannot_delete_currency', ['name' => e($currency->name)]));Log::channel('audit')->info(sprintf('Tried to delete currency %s but is in use.', $currency->code));return redirect(route('currencies.index'));}if ($this->repository->isFallbackCurrency($currency)) {- $request->session()->flash('error', (string)trans('firefly.cannot_delete_fallback_currency', ['name' => e($currency->name)]));+ $request->session()->flash('error', (string) trans('firefly.cannot_delete_fallback_currency', ['name' => e($currency->name)]));Log::channel('audit')->info(sprintf('Tried to delete currency %s but is FALLBACK.', $currency->code));return redirect(route('currencies.index'));@@ -202,7 +202,7 @@ class CurrencyController extends ControllerLog::channel('audit')->info(sprintf('Deleted currency %s.', $currency->code));$this->repository->destroy($currency);- $request->session()->flash('success', (string)trans('firefly.deleted_currency', ['name' => $currency->name]));+ $request->session()->flash('success', (string) trans('firefly.deleted_currency', ['name' => $currency->name]));return redirect($this->getPreviousUri('currencies.delete.uri'));}@@ -215,7 +215,7 @@ class CurrencyController extends Controller*/public function disableCurrency(Request $request): JsonResponse{- $currencyId = (int)$request->get('id');+ $currencyId = (int) $request->get('id');if ($currencyId > 0) {// valid currency?$currency = $this->repository->find($currencyId);@@ -226,7 +226,7 @@ class CurrencyController extends Controller$user = auth()->user();if (!$this->userRepository->hasRole($user, 'owner')) {- $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));+ $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));Log::channel('audit')->info(sprintf('Tried to disable currency %s but is not site owner.', $currency->code));return response()->json([]);@@ -235,7 +235,7 @@ class CurrencyController extends Controllerif ($this->repository->currencyInUse($currency)) {$location = $this->repository->currencyInUseAt($currency);- $message = (string)trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]);+ $message = (string) trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]);$request->session()->flash('error', $message);Log::channel('audit')->info(sprintf('Tried to disable currency %s but is in use.', $currency->code));@@ -258,10 +258,10 @@ class CurrencyController extends Controller}if ('EUR' === $currency->code) {- session()->flash('warning', (string)trans('firefly.disable_EUR_side_effects'));+ session()->flash('warning', (string) trans('firefly.disable_EUR_side_effects'));}- session()->flash('success', (string)trans('firefly.currency_is_now_disabled', ['name' => $currency->name]));+ session()->flash('success', (string) trans('firefly.currency_is_now_disabled', ['name' => $currency->name]));}}@@ -282,7 +282,7 @@ class CurrencyController extends Controller$user = auth()->user();if (!$this->userRepository->hasRole($user, 'owner')) {- $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));+ $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code));return redirect(route('currencies.index'));@@ -290,13 +290,13 @@ class CurrencyController extends Controller}$subTitleIcon = 'fa-pencil';- $subTitle = (string)trans('breadcrumbs.edit_currency', ['name' => $currency->name]);+ $subTitle = (string) trans('breadcrumbs.edit_currency', ['name' => $currency->name]);$currency->symbol = htmlentities($currency->symbol);// code to handle active-checkboxes$hasOldInput = null !== $request->old('_token');$preFilled = [- 'enabled' => $hasOldInput ? (bool)$request->old('enabled') : $currency->enabled,+ 'enabled' => $hasOldInput ? (bool) $request->old('enabled') : $currency->enabled,];$request->session()->flash('preFilled', $preFilled);@@ -318,7 +318,7 @@ class CurrencyController extends Controller*/public function enableCurrency(Request $request){- $currencyId = (int)$request->get('id');+ $currencyId = (int) $request->get('id');if ($currencyId > 0) {// valid currency?$currency = $this->repository->find($currencyId);@@ -326,7 +326,7 @@ class CurrencyController extends Controllerapp('preferences')->mark();$this->repository->enable($currency);- session()->flash('success', (string)trans('firefly.currency_is_now_enabled', ['name' => $currency->name]));+ session()->flash('success', (string) trans('firefly.currency_is_now_enabled', ['name' => $currency->name]));Log::channel('audit')->info(sprintf('Enabled currency %s.', $currency->code));}}@@ -346,8 +346,8 @@ class CurrencyController extends Controller{/** @var User $user */$user = auth()->user();- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$collection = $this->repository->getAll();$total = $collection->count();$collection = $collection->slice(($page - 1) * $pageSize, $pageSize);@@ -357,7 +357,7 @@ class CurrencyController extends Controller$defaultCurrency = $this->repository->getCurrencyByPreference(app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR')));$isOwner = true;if (!$this->userRepository->hasRole($user, 'owner')) {- $request->session()->flash('info', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));+ $request->session()->flash('info', (string) trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));$isOwner = false;}@@ -391,15 +391,15 @@ class CurrencyController extends Controller} catch (FireflyException $e) {Log::error($e->getMessage());Log::channel('audit')->info('Could not store (POST) currency without admin rights.', $data);- $request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));+ $request->session()->flash('error', (string) trans('firefly.could_not_store_currency'));$currency = null;}$redirect = redirect($this->getPreviousUri('currencies.create.uri'));if (null !== $currency) {- $request->session()->flash('success', (string)trans('firefly.created_currency', ['name' => $currency->name]));+ $request->session()->flash('success', (string) trans('firefly.created_currency', ['name' => $currency->name]));Log::channel('audit')->info('Created (POST) currency.', $data);- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {$request->session()->put('currencies.create.fromStore', true);@@ -430,7 +430,7 @@ class CurrencyController extends Controller}if (!$this->userRepository->hasRole($user, 'owner')) {- $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));+ $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));Log::channel('audit')->info('Tried to update (POST) currency without admin rights.', $data);return redirect(route('currencies.index'));@@ -438,10 +438,10 @@ class CurrencyController extends Controller}$currency = $this->repository->update($currency, $data);Log::channel('audit')->info('Updated (POST) currency.', $data);- $request->session()->flash('success', (string)trans('firefly.updated_currency', ['name' => $currency->name]));+ $request->session()->flash('success', (string) trans('firefly.updated_currency', ['name' => $currency->name]));app('preferences')->mark();- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {$request->session()->put('currencies.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Export/IndexController.php b/app/Http/Controllers/Export/IndexController.phpindex 192831b30f..f21893777e 100644--- a/app/Http/Controllers/Export/IndexController.php+++ b/app/Http/Controllers/Export/IndexController.php@@ -54,7 +54,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-life-bouy');- app('view')->share('title', (string)trans('firefly.export_data_title'));+ app('view')->share('title', (string) trans('firefly.export_data_title'));$this->journalRepository = app(JournalRepositoryInterface::class);$this->middleware(IsDemoUser::class)->except(['index']);@@ -85,7 +85,7 @@ class IndexController extends Controller$generator->setStart($firstDate);$result = $generator->export();- $name = sprintf('%s_transaction_export.csv', date('Y_m_d'));+ $name = sprintf('%s_transaction_export.csv', date('Y_m_d'));$quoted = sprintf('"%s"', addcslashes($name, '"\\'));// headers for CSV file./** @var LaravelResponse $response */diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex 46a9049ced..978bc5ee64 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -27,7 +27,6 @@ use Exception;use FireflyIII\Events\RequestedVersionCheckStatus;use FireflyIII\Helpers\Collector\GroupCollectorInterface;use FireflyIII\Http\Middleware\Installer;-use FireflyIII\Mail\UndoEmailChangeMail;use FireflyIII\Models\AccountType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\Bill\BillRepositoryInterface;@@ -36,7 +35,6 @@ use Illuminate\Http\JsonResponse;use Illuminate\Http\Request;use Illuminate\Support\Collection;use Log;-use Mail;/*** Class HomeController.diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.phpindex 0e4e5bd307..15877d0b55 100644--- a/app/Http/Controllers/JavascriptController.php+++ b/app/Http/Controllers/JavascriptController.php@@ -56,14 +56,14 @@ class JavascriptController extends Controller);$preference = app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR'));/** @noinspection NullPointerExceptionInspection */- $default = $currencyRepository->findByCodeNull((string)$preference->data);+ $default = $currencyRepository->findByCodeNull((string) $preference->data);$data = ['accounts' => []];/** @var Account $account */foreach ($accounts as $account) {$accountId = $account->id;- $currency = (int)$repository->getMetaValue($account, 'currency_id');+ $currency = (int) $repository->getMetaValue($account, 'currency_id');/** @noinspection NullPointerExceptionInspection */$currency = 0 === $currency ? $default->id : $currency;$entry = ['preferredCurrency' => $currency, 'name' => $account->name];@@ -110,7 +110,7 @@ class JavascriptController extends Controller*/public function variables(Request $request, AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository): Response{- $account = $repository->find((int)$request->get('account'));+ $account = $repository->find((int) $request->get('account'));$currency = app('amount')->getDefaultCurrency();if (null !== $account) {$currency = $repository->getAccountCurrency($account) ?? $currency;@@ -122,7 +122,7 @@ class JavascriptController extends Controller/** @noinspection NullPointerExceptionInspection */$lang = $pref->data;$dateRange = $this->getDateRangeConfig();- $uid = substr(hash('sha256', sprintf('%s-%s-%s', (string)config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12);+ $uid = substr(hash('sha256', sprintf('%s-%s-%s', (string) config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12);$data = ['currencyCode' => $currency->code,diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.phpindex db99a2c402..9ad35980f5 100644--- a/app/Http/Controllers/Json/BoxController.php+++ b/app/Http/Controllers/Json/BoxController.php@@ -66,7 +66,7 @@ class BoxController extends Controller$end = session('end', Carbon::now()->endOfMonth());$today = today(config('app.timezone'));$display = 2; // see method docs.- $boxTitle = (string)trans('firefly.spent');+ $boxTitle = (string) trans('firefly.spent');$cache = new CacheProperties;$cache->addProperty($start);@@ -93,21 +93,21 @@ class BoxController extends Controller// spent in this period, in budgets, for default currency.// also calculate spent per day.$spent = $opsRepository->sumExpenses($start, $end, null, null, $currency);- $spentAmount = $spent[(int)$currency->id]['sum'] ?? '0';+ $spentAmount = $spent[(int) $currency->id]['sum'] ?? '0';$days = $today->between($start, $end) ? $today->diffInDays($start) + 1 : $end->diffInDays($start) + 1;- $spentPerDay = bcdiv($spentAmount, (string)$days);+ $spentPerDay = bcdiv($spentAmount, (string) $days);if ($availableBudgets->count() > 0) {$display = 0; // assume user overspent- $boxTitle = (string)trans('firefly.overspent');- $totalAvailableSum = (string)$availableBudgets->sum('amount');+ $boxTitle = (string) trans('firefly.overspent');+ $totalAvailableSum = (string) $availableBudgets->sum('amount');// calculate with available budget.$leftToSpendAmount = bcadd($totalAvailableSum, $spentAmount);if (1 === bccomp($leftToSpendAmount, '0')) {- $boxTitle = (string)trans('firefly.left_to_spend');+ $boxTitle = (string) trans('firefly.left_to_spend');$days = $today->diffInDays($end) + 1;$display = 1; // not overspent- $leftPerDayAmount = bcdiv($leftToSpendAmount, (string)$days);+ $leftPerDayAmount = bcdiv($leftToSpendAmount, (string) $days);}}@@ -161,7 +161,7 @@ class BoxController extends Controller$set = $collector->getExtractedJournals();/** @var array $journal */foreach ($set as $journal) {- $currencyId = (int)$journal['currency_id'];+ $currencyId = (int) $journal['currency_id'];$amount = $journal['amount'] ?? '0';$incomes[$currencyId] = $incomes[$currencyId] ?? '0';$incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount));@@ -177,7 +177,7 @@ class BoxController extends Controller$set = $collector->getExtractedJournals();/** @var array $journal */foreach ($set as $journal) {- $currencyId = (int)$journal['currency_id'];+ $currencyId = (int) $journal['currency_id'];$expenses[$currencyId] = $expenses[$currencyId] ?? '0';$expenses[$currencyId] = bcadd($expenses[$currencyId], $journal['amount'] ?? '0');$sums[$currencyId] = $sums[$currencyId] ?? '0';diff --git a/app/Http/Controllers/Json/BudgetController.php b/app/Http/Controllers/Json/BudgetController.phpindex 523463a5eb..af1ff647a1 100644--- a/app/Http/Controllers/Json/BudgetController.php+++ b/app/Http/Controllers/Json/BudgetController.php@@ -64,7 +64,7 @@ class BudgetController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.budgets'));+ app('view')->share('title', (string) trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');$this->repository = app(BudgetRepositoryInterface::class);$this->opsRepository = app(OperationsRepositoryInterface::class);diff --git a/app/Http/Controllers/Json/FrontpageController.php b/app/Http/Controllers/Json/FrontpageController.phpindex c881f2af3f..1f6a0902f8 100644--- a/app/Http/Controllers/Json/FrontpageController.php+++ b/app/Http/Controllers/Json/FrontpageController.php@@ -51,7 +51,7 @@ class FrontpageController extends Controllerif (1 === bccomp($amount, '0')) {// percentage!$pct = 0;- if(0.0 !== (float)$piggyBank->targetamount) {+ if (0.0 !== (float) $piggyBank->targetamount) {$pct = round(($amount / $piggyBank->targetamount) * 100);}diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.phpindex 7714e0d56c..1c6c796bc5 100644--- a/app/Http/Controllers/Json/IntroController.php+++ b/app/Http/Controllers/Json/IntroController.php@@ -118,7 +118,7 @@ class IntroController extends Controllerapp('preferences')->set($key, false);app('preferences')->mark();- return response()->json(['message' => (string)trans('firefly.intro_boxes_after_refresh')]);+ return response()->json(['message' => (string) trans('firefly.intro_boxes_after_refresh')]);}/**diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.phpindex 8a70872254..15947daaf9 100644--- a/app/Http/Controllers/Json/ReconcileController.php+++ b/app/Http/Controllers/Json/ReconcileController.php@@ -63,7 +63,7 @@ class ReconcileController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');- app('view')->share('title', (string)trans('firefly.accounts'));+ app('view')->share('title', (string) trans('firefly.accounts'));$this->repository = app(JournalRepositoryInterface::class);$this->accountRepos = app(AccountRepositoryInterface::class);$this->currencyRepos = app(CurrencyRepositoryInterface::class);@@ -236,8 +236,8 @@ class ReconcileController extends Controller$startDate->subDay();$currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();- $startBalance = round((float)app('steam')->balance($account, $startDate), $currency->decimal_places);- $endBalance = round((float)app('steam')->balance($account, $end), $currency->decimal_places);+ $startBalance = round((float) app('steam')->balance($account, $startDate), $currency->decimal_places);+ $endBalance = round((float) app('steam')->balance($account, $end), $currency->decimal_places);// get the transactions$selectionStart = clone $start;diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.phpindex eb313c13db..3d32f1bfb7 100644--- a/app/Http/Controllers/Json/RecurrenceController.php+++ b/app/Http/Controllers/Json/RecurrenceController.php@@ -73,10 +73,10 @@ class RecurrenceController extends Controller$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));$firstDate = Carbon::createFromFormat('Y-m-d', $request->get('first_date'));- $endDate = '' !== (string)$request->get('end_date') ? Carbon::createFromFormat('Y-m-d', $request->get('end_date')) : null;- $endsAt = (string)$request->get('ends');+ $endDate = '' !== (string) $request->get('end_date') ? Carbon::createFromFormat('Y-m-d', $request->get('end_date')) : null;+ $endsAt = (string) $request->get('ends');$repetitionType = explode(',', $request->get('type'))[0];- $repetitions = (int)$request->get('reps');+ $repetitions = (int) $request->get('reps');$repetitionMoment = '';$start->startOfDay();@@ -100,8 +100,8 @@ class RecurrenceController extends Controller$repetition = new RecurrenceRepetition;$repetition->repetition_type = $repetitionType;$repetition->repetition_moment = $repetitionMoment;- $repetition->repetition_skip = (int)$request->get('skip');- $repetition->weekend = (int)$request->get('weekend');+ $repetition->repetition_skip = (int) $request->get('skip');+ $repetition->weekend = (int) $request->get('weekend');$actualEnd = clone $end;switch ($endsAt) {@@ -149,30 +149,30 @@ class RecurrenceController extends Controller$string = $request->get('date') ?? date('Y-m-d');$today = Carbon::now()->startOfDay();$date = Carbon::createFromFormat('Y-m-d', $string)->startOfDay();- $preSelected = (string)$request->get('pre_select');+ $preSelected = (string) $request->get('pre_select');$locale = app('steam')->getLocale();Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));- Log::debug(sprintf('past = true? %s', var_export('true' === (string)$request->get('past'), true)));+ Log::debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true)));$result = [];- if ($date > $today || 'true' === (string)$request->get('past')) {+ if ($date > $today || 'true' === (string) $request->get('past')) {Log::debug('Will fill dropdown.');$weekly = sprintf('weekly,%s', $date->dayOfWeekIso);$monthly = sprintf('monthly,%s', $date->day);- $dayOfWeek = (string)trans(sprintf('config.dow_%s', $date->dayOfWeekIso));+ $dayOfWeek = (string) trans(sprintf('config.dow_%s', $date->dayOfWeekIso));$ndom = sprintf('ndom,%s,%s', $date->weekOfMonth, $date->dayOfWeekIso);$yearly = sprintf('yearly,%s', $date->format('Y-m-d'));- $yearlyDate = $date->isoFormat((string)trans('config.month_and_day_no_year_js', [], $locale));+ $yearlyDate = $date->isoFormat((string) trans('config.month_and_day_no_year_js', [], $locale));$result = [- 'daily' => ['label' => (string)trans('firefly.recurring_daily'), 'selected' => str_starts_with($preSelected, 'daily')],- $weekly => ['label' => (string)trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]),+ 'daily' => ['label' => (string) trans('firefly.recurring_daily'), 'selected' => str_starts_with($preSelected, 'daily')],+ $weekly => ['label' => (string) trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]),'selected' => str_starts_with($preSelected, 'weekly')],- $monthly => ['label' => (string)trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]),+ $monthly => ['label' => (string) trans('firefly.recurring_monthly', ['dayOfMonth' => $date->day]),'selected' => str_starts_with($preSelected, 'monthly')],- $ndom => ['label' => (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),+ $ndom => ['label' => (string) trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),'selected' => str_starts_with($preSelected, 'ndom')],- $yearly => ['label' => (string)trans('firefly.recurring_yearly', ['date' => $yearlyDate]),+ $yearly => ['label' => (string) trans('firefly.recurring_yearly', ['date' => $yearlyDate]),'selected' => str_starts_with($preSelected, 'yearly')],];}diff --git a/app/Http/Controllers/Json/RuleController.php b/app/Http/Controllers/Json/RuleController.phpindex 02febad313..63d6f5487e 100644--- a/app/Http/Controllers/Json/RuleController.php+++ b/app/Http/Controllers/Json/RuleController.php@@ -43,11 +43,11 @@ class RuleController extends Controller*/public function action(Request $request): JsonResponse{- $count = (int)$request->get('count') > 0 ? (int)$request->get('count') : 1;+ $count = (int) $request->get('count') > 0 ? (int) $request->get('count') : 1;$keys = array_keys(config('firefly.rule-actions'));$actions = [];foreach ($keys as $key) {- $actions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice');+ $actions[$key] = (string) trans('firefly.rule_action_' . $key . '_choice');}try {$view = view('rules.partials.action', compact('actions', 'count'))->render();@@ -69,13 +69,13 @@ class RuleController extends Controller*/public function trigger(Request $request): JsonResponse{- $count = (int)$request->get('count') > 0 ? (int)$request->get('count') : 1;+ $count = (int) $request->get('count') > 0 ? (int) $request->get('count') : 1;$operators = config('search.operators');$triggers = [];foreach ($operators as $key => $operator) {if ('user_action' !== $key && false === $operator['alias']) {- $triggers[$key] = (string)trans(sprintf('firefly.rule_trigger_%s_choice', $key));+ $triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));}}asort($triggers);diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.phpindex 8409172ef5..4bd8c84a9e 100644--- a/app/Http/Controllers/NewUserController.php+++ b/app/Http/Controllers/NewUserController.php@@ -66,7 +66,7 @@ class NewUserController extends Controller*/public function index(){- app('view')->share('title', (string)trans('firefly.welcome'));+ app('view')->share('title', (string) trans('firefly.welcome'));app('view')->share('mainTitleIcon', 'fa-fire');$types = config('firefly.accountTypesByIdentifier.asset');@@ -84,7 +84,7 @@ class NewUserController extends Controller/*** Store his new settings.*- * @param NewUserFormRequest $request+ * @param NewUserFormRequest $request* @param CurrencyRepositoryInterface $currencyRepository** @return RedirectResponse|Redirector@@ -101,7 +101,7 @@ class NewUserController extends Controller// set language preference:app('preferences')->set('language', $language);// Store currency preference from input:- $currency = $currencyRepository->find((int)$request->input('amount_currency_id_bank_balance'));+ $currency = $currencyRepository->find((int) $request->input('amount_currency_id_bank_balance'));// if is null, set to EUR:if (null === $currency) {@@ -109,9 +109,9 @@ class NewUserController extends Controller}$currencyRepository->enable($currency);- $this->createAssetAccount($request, $currency); // create normal asset account+ $this->createAssetAccount($request, $currency); // create normal asset account$this->createSavingsAccount($request, $currency, $language); // create savings account- $this->createCashWalletAccount($currency, $language); // create cash wallet account+ $this->createCashWalletAccount($currency, $language); // create cash wallet account// store currency preference:app('preferences')->set('currencyPreference', $currency->code);@@ -128,7 +128,7 @@ class NewUserController extends Controller'invoice_date' => false, 'internal_reference' => false, 'notes' => true, 'attachments' => true,];app('preferences')->set('transaction_journal_optional_fields', $visibleFields);- session()->flash('success', (string)trans('firefly.stored_new_accounts_new_user'));+ session()->flash('success', (string) trans('firefly.stored_new_accounts_new_user'));app('preferences')->mark();return redirect(route('index'));diff --git a/app/Http/Controllers/ObjectGroup/DeleteController.php b/app/Http/Controllers/ObjectGroup/DeleteController.phpindex fca9f77954..c2341289d8 100644--- a/app/Http/Controllers/ObjectGroup/DeleteController.php+++ b/app/Http/Controllers/ObjectGroup/DeleteController.php@@ -50,7 +50,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-envelope-o');- app('view')->share('title', (string)trans('firefly.object_groups_page_title'));+ app('view')->share('title', (string) trans('firefly.object_groups_page_title'));$this->repository = app(ObjectGroupRepositoryInterface::class);@@ -68,7 +68,7 @@ class DeleteController extends Controller*/public function delete(ObjectGroup $objectGroup){- $subTitle = (string)trans('firefly.delete_object_group', ['title' => $objectGroup->title]);+ $subTitle = (string) trans('firefly.delete_object_group', ['title' => $objectGroup->title]);$piggyBanks = $objectGroup->piggyBanks()->count();// put previous url in session@@ -86,7 +86,7 @@ class DeleteController extends Controller*/public function destroy(ObjectGroup $objectGroup): RedirectResponse{- session()->flash('success', (string)trans('firefly.deleted_object_group', ['title' => $objectGroup->title]));+ session()->flash('success', (string) trans('firefly.deleted_object_group', ['title' => $objectGroup->title]));app('preferences')->mark();$this->repository->destroy($objectGroup);diff --git a/app/Http/Controllers/ObjectGroup/EditController.php b/app/Http/Controllers/ObjectGroup/EditController.phpindex 74871f8b41..c389328adc 100644--- a/app/Http/Controllers/ObjectGroup/EditController.php+++ b/app/Http/Controllers/ObjectGroup/EditController.php@@ -53,7 +53,7 @@ class EditController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-envelope-o');- app('view')->share('title', (string)trans('firefly.object_groups_page_title'));+ app('view')->share('title', (string) trans('firefly.object_groups_page_title'));$this->repository = app(ObjectGroupRepositoryInterface::class);@@ -71,7 +71,7 @@ class EditController extends Controller*/public function edit(ObjectGroup $objectGroup){- $subTitle = (string)trans('firefly.edit_object_group', ['title' => $objectGroup->title]);+ $subTitle = (string) trans('firefly.edit_object_group', ['title' => $objectGroup->title]);$subTitleIcon = 'fa-pencil';if (true !== session('object-groups.edit.fromUpdate')) {@@ -95,12 +95,12 @@ class EditController extends Controller$data = $request->getObjectGroupData();$piggyBank = $this->repository->update($objectGroup, $data);- session()->flash('success', (string)trans('firefly.updated_object_group', ['title' => $objectGroup->title]));+ session()->flash('success', (string) trans('firefly.updated_object_group', ['title' => $objectGroup->title]));app('preferences')->mark();$redirect = redirect($this->getPreviousUri('object-groups.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {session()->put('object-groups.edit.fromUpdate', true);diff --git a/app/Http/Controllers/ObjectGroup/IndexController.php b/app/Http/Controllers/ObjectGroup/IndexController.phpindex 02039ed001..918535cd13 100644--- a/app/Http/Controllers/ObjectGroup/IndexController.php+++ b/app/Http/Controllers/ObjectGroup/IndexController.php@@ -53,7 +53,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-envelope-o');- app('view')->share('title', (string)trans('firefly.object_groups_page_title'));+ app('view')->share('title', (string) trans('firefly.object_groups_page_title'));$this->repository = app(ObjectGroupRepositoryInterface::class);return $next($request);@@ -68,7 +68,7 @@ class IndexController extends Controller{$this->repository->deleteEmpty();$this->repository->resetOrder();- $subTitle = (string)trans('firefly.object_groups_index');+ $subTitle = (string) trans('firefly.object_groups_index');$objectGroups = $this->repository->get();return view('object-groups.index', compact('subTitle', 'objectGroups'));@@ -83,7 +83,7 @@ class IndexController extends Controllerpublic function setOrder(Request $request, ObjectGroup $objectGroup){Log::debug(sprintf('Found object group #%d "%s"', $objectGroup->id, $objectGroup->title));- $newOrder = (int)$request->get('order');+ $newOrder = (int) $request->get('order');$this->repository->setOrder($objectGroup, $newOrder);return response()->json([]);diff --git a/app/Http/Controllers/PiggyBank/CreateController.php b/app/Http/Controllers/PiggyBank/CreateController.phpindex af55861808..556c7e39b3 100644--- a/app/Http/Controllers/PiggyBank/CreateController.php+++ b/app/Http/Controllers/PiggyBank/CreateController.php@@ -53,7 +53,7 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.piggyBanks'));+ app('view')->share('title', (string) trans('firefly.piggyBanks'));app('view')->share('mainTitleIcon', 'fa-bullseye');$this->attachments = app(AttachmentHelperInterface::class);@@ -71,7 +71,7 @@ class CreateController extends Controller*/public function create(){- $subTitle = (string)trans('firefly.new_piggy_bank');+ $subTitle = (string) trans('firefly.new_piggy_bank');$subTitleIcon = 'fa-plus';// put previous url in session if not redirect from store (not "create another").@@ -99,7 +99,7 @@ class CreateController extends Controller}$piggyBank = $this->piggyRepos->store($data);- session()->flash('success', (string)trans('firefly.stored_piggy_bank', ['name' => $piggyBank->name]));+ session()->flash('success', (string) trans('firefly.stored_piggy_bank', ['name' => $piggyBank->name]));app('preferences')->mark();// store attachment(s):@@ -109,7 +109,7 @@ class CreateController extends Controller$this->attachments->saveAttachmentsForModel($piggyBank, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -117,7 +117,7 @@ class CreateController extends Controller}$redirect = redirect($this->getPreviousUri('piggy-banks.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {session()->put('piggy-banks.create.fromStore', true);diff --git a/app/Http/Controllers/PiggyBank/DeleteController.php b/app/Http/Controllers/PiggyBank/DeleteController.phpindex 3782cacd4b..726b081775 100644--- a/app/Http/Controllers/PiggyBank/DeleteController.php+++ b/app/Http/Controllers/PiggyBank/DeleteController.php@@ -50,7 +50,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.piggyBanks'));+ app('view')->share('title', (string) trans('firefly.piggyBanks'));app('view')->share('mainTitleIcon', 'fa-bullseye');$this->piggyRepos = app(PiggyBankRepositoryInterface::class);@@ -69,7 +69,7 @@ class DeleteController extends Controller*/public function delete(PiggyBank $piggyBank){- $subTitle = (string)trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]);+ $subTitle = (string) trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]);// put previous url in session$this->rememberPreviousUri('piggy-banks.delete.uri');@@ -86,7 +86,7 @@ class DeleteController extends Controller*/public function destroy(PiggyBank $piggyBank): RedirectResponse{- session()->flash('success', (string)trans('firefly.deleted_piggy_bank', ['name' => $piggyBank->name]));+ session()->flash('success', (string) trans('firefly.deleted_piggy_bank', ['name' => $piggyBank->name]));app('preferences')->mark();$this->piggyRepos->destroy($piggyBank);diff --git a/app/Http/Controllers/PiggyBank/EditController.php b/app/Http/Controllers/PiggyBank/EditController.phpindex c93bc8729d..4dba83a586 100644--- a/app/Http/Controllers/PiggyBank/EditController.php+++ b/app/Http/Controllers/PiggyBank/EditController.php@@ -24,13 +24,13 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\PiggyBank;+use Amount;use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Http\Requests\PiggyBankUpdateRequest;use FireflyIII\Models\PiggyBank;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;-use Amount;use Illuminate\Contracts\View\Factory;use Illuminate\Http\RedirectResponse;use Illuminate\Routing\Redirector;@@ -41,9 +41,9 @@ use Illuminate\View\View;*/class EditController extends Controller{+ private AccountRepositoryInterface $accountRepository;private AttachmentHelperInterface $attachments;private PiggyBankRepositoryInterface $piggyRepos;- private AccountRepositoryInterface $accountRepository;/*** PiggyBankController constructor.@@ -95,7 +95,7 @@ class EditController extends Controller'object_group' => $piggyBank->objectGroups->first() ? $piggyBank->objectGroups->first()->title : '','notes' => null === $note ? '' : $note->text,];- if(0.0 === (float) $piggyBank->targetamount) {+ if (0.0 === (float) $piggyBank->targetamount) {$preFilled['targetamount'] = '';}session()->flash('preFilled', $preFilled);diff --git a/app/Http/Controllers/PiggyBank/IndexController.php b/app/Http/Controllers/PiggyBank/IndexController.phpindex 3ee182e62f..31f86b82d2 100644--- a/app/Http/Controllers/PiggyBank/IndexController.php+++ b/app/Http/Controllers/PiggyBank/IndexController.php@@ -57,7 +57,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.piggyBanks'));+ app('view')->share('title', (string) trans('firefly.piggyBanks'));app('view')->share('mainTitleIcon', 'fa-bullseye');$this->piggyRepos = app(PiggyBankRepositoryInterface::class);@@ -101,7 +101,7 @@ class IndexController extends Controller/** @var PiggyBank $piggy */foreach ($collection as $piggy) {$array = $transformer->transform($piggy);- $groupOrder = (int)$array['object_group_order'];+ $groupOrder = (int) $array['object_group_order'];// make group array if necessary:$piggyBanks[$groupOrder] = $piggyBanks[$groupOrder] ?? ['object_group_id' => $array['object_group_id'] ?? 0,@@ -110,7 +110,7 @@ class IndexController extends Controller];$account = $accountTransformer->transform($piggy->account);- $accountId = (int)$account['id'];+ $accountId = (int) $account['id'];$array['attachments'] = $this->piggyRepos->getAttachments($piggy);if (!array_key_exists($accountId, $accounts)) {// create new:@@ -165,10 +165,10 @@ class IndexController extends Controller// current_amount// left_to_save// save_per_month- $sums[$groupId][$currencyId]['target'] = bcadd($sums[$groupId][$currencyId]['target'], (string)$piggy['target_amount']);- $sums[$groupId][$currencyId]['saved'] = bcadd($sums[$groupId][$currencyId]['saved'], (string)$piggy['current_amount']);- $sums[$groupId][$currencyId]['left_to_save'] = bcadd($sums[$groupId][$currencyId]['left_to_save'], (string)$piggy['left_to_save']);- $sums[$groupId][$currencyId]['save_per_month'] = bcadd($sums[$groupId][$currencyId]['save_per_month'], (string)$piggy['save_per_month']);+ $sums[$groupId][$currencyId]['target'] = bcadd($sums[$groupId][$currencyId]['target'], (string) $piggy['target_amount']);+ $sums[$groupId][$currencyId]['saved'] = bcadd($sums[$groupId][$currencyId]['saved'], (string) $piggy['current_amount']);+ $sums[$groupId][$currencyId]['left_to_save'] = bcadd($sums[$groupId][$currencyId]['left_to_save'], (string) $piggy['left_to_save']);+ $sums[$groupId][$currencyId]['save_per_month'] = bcadd($sums[$groupId][$currencyId]['save_per_month'], (string) $piggy['save_per_month']);}}foreach ($piggyBanks as $groupOrder => $group) {@@ -189,8 +189,8 @@ class IndexController extends Controller*/public function setOrder(Request $request, PiggyBank $piggyBank): JsonResponse{- $objectGroupTitle = (string)$request->get('objectGroupTitle');- $newOrder = (int)$request->get('order');+ $objectGroupTitle = (string) $request->get('objectGroupTitle');+ $newOrder = (int) $request->get('order');$this->piggyRepos->setOrder($piggyBank, $newOrder);if ('' !== $objectGroupTitle) {$this->piggyRepos->setObjectGroup($piggyBank, $objectGroupTitle);diff --git a/app/Http/Controllers/PiggyBank/ShowController.php b/app/Http/Controllers/PiggyBank/ShowController.phpindex bb5c71482f..6aba89dfdd 100644--- a/app/Http/Controllers/PiggyBank/ShowController.php+++ b/app/Http/Controllers/PiggyBank/ShowController.php@@ -51,7 +51,7 @@ class ShowController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.piggyBanks'));+ app('view')->share('title', (string) trans('firefly.piggyBanks'));app('view')->share('mainTitleIcon', 'fa-bullseye');$this->piggyRepos = app(PiggyBankRepositoryInterface::class);diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.phpindex 58a877c01c..21d05746a7 100644--- a/app/Http/Controllers/PreferencesController.php+++ b/app/Http/Controllers/PreferencesController.php@@ -51,7 +51,7 @@ class PreferencesController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.preferences'));+ app('view')->share('title', (string) trans('firefly.preferences'));app('view')->share('mainTitleIcon', 'fa-gear');return $next($request);@@ -114,7 +114,7 @@ class PreferencesController extends ControllerLog::error($e->getMessage());$locales = [];}- $locales = ['equal' => (string)trans('firefly.equal_to_language')] + $locales;+ $locales = ['equal' => (string) trans('firefly.equal_to_language')] + $locales;// an important fallback is that the frontPageAccount array gets refilled automatically// when it turns up empty.if (empty($frontPageAccounts->data)) {@@ -154,7 +154,7 @@ class PreferencesController extends Controller$frontPageAccounts = [];if (is_array($request->get('frontPageAccounts')) && count($request->get('frontPageAccounts')) > 0) {foreach ($request->get('frontPageAccounts') as $id) {- $frontPageAccounts[] = (int)$id;+ $frontPageAccounts[] = (int) $id;}app('preferences')->set('frontPageAccounts', $frontPageAccounts);}@@ -167,8 +167,8 @@ class PreferencesController extends Controllersession()->forget('range');// custom fiscal year- $customFiscalYear = 1 === (int)$request->get('customFiscalYear');- $string = strtotime((string)$request->get('fiscalYearStart'));+ $customFiscalYear = 1 === (int) $request->get('customFiscalYear');+ $string = strtotime((string) $request->get('fiscalYearStart'));if (false !== $string) {$fiscalYearStart = date('m-d', $string);app('preferences')->set('customFiscalYear', $customFiscalYear);@@ -178,7 +178,7 @@ class PreferencesController extends Controller// save page size:app('preferences')->set('listPageSize', 50);- $listPageSize = (int)$request->get('listPageSize');+ $listPageSize = (int) $request->get('listPageSize');if ($listPageSize > 0 && $listPageSize < 1337) {app('preferences')->set('listPageSize', $listPageSize);}@@ -220,7 +220,7 @@ class PreferencesController extends Controller];app('preferences')->set('transaction_journal_optional_fields', $optionalTj);- session()->flash('success', (string)trans('firefly.saved_preferences'));+ session()->flash('success', (string) trans('firefly.saved_preferences'));app('preferences')->mark();return redirect(route('preferences.index'));diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.phpindex 239ebd607c..ea01d1bccc 100644--- a/app/Http/Controllers/ProfileController.php+++ b/app/Http/Controllers/ProfileController.php@@ -78,7 +78,7 @@ class ProfileController extends Controller$this->middleware(static function ($request, $next) {- app('view')->share('title', (string)trans('firefly.profile'));+ app('view')->share('title', (string) trans('firefly.profile'));app('view')->share('mainTitleIcon', 'fa-user');return $next($request);@@ -110,7 +110,7 @@ class ProfileController extends Controller$title = auth()->user()->email;$email = auth()->user()->email;- $subTitle = (string)trans('firefly.change_your_email');+ $subTitle = (string) trans('firefly.change_your_email');$subTitleIcon = 'fa-envelope';return view('profile.change-email', compact('title', 'subTitle', 'subTitleIcon', 'email'));@@ -132,7 +132,7 @@ class ProfileController extends Controller}$title = auth()->user()->email;- $subTitle = (string)trans('firefly.change_your_password');+ $subTitle = (string) trans('firefly.change_your_password');$subTitleIcon = 'fa-key';return view('profile.change-password', compact('title', 'subTitle', 'subTitleIcon'));@@ -229,7 +229,7 @@ class ProfileController extends Controller$repository->unblockUser($user);// return to login.- session()->flash('success', (string)trans('firefly.login_with_new_email'));+ session()->flash('success', (string) trans('firefly.login_with_new_email'));return redirect(route('login'));}@@ -249,7 +249,7 @@ class ProfileController extends Controllerreturn redirect(route('profile.index'));}$title = auth()->user()->email;- $subTitle = (string)trans('firefly.delete_account');+ $subTitle = (string) trans('firefly.delete_account');$subTitleIcon = 'fa-trash';return view('profile.delete-account', compact('title', 'subTitle', 'subTitleIcon'));@@ -274,8 +274,8 @@ class ProfileController extends Controller$user = auth()->user();$repository->setMFACode($user, null);- session()->flash('success', (string)trans('firefly.pref_two_factor_auth_disabled'));- session()->flash('info', (string)trans('firefly.pref_two_factor_auth_remove_it'));+ session()->flash('success', (string) trans('firefly.pref_two_factor_auth_disabled'));+ session()->flash('info', (string) trans('firefly.pref_two_factor_auth_remove_it'));return redirect(route('profile.index'));}@@ -304,7 +304,7 @@ class ProfileController extends Controller// If FF3 already has a secret, just set the two factor auth enabled to 1,// and let the user continue with the existing secret.- session()->flash('info', (string)trans('firefly.2fa_already_enabled'));+ session()->flash('info', (string) trans('firefly.2fa_already_enabled'));return redirect(route('profile.index'));}@@ -351,7 +351,7 @@ class ProfileController extends Controllerpublic function logoutOtherSessions(){if (!$this->internalAuth) {- session()->flash('info', (string)trans('firefly.external_auth_disabled'));+ session()->flash('info', (string) trans('firefly.external_auth_disabled'));return redirect(route('profile.index'));}@@ -409,7 +409,7 @@ class ProfileController extends Controller$newEmail = $request->string('email');$oldEmail = $user->email;if ($newEmail === $user->email) {- session()->flash('error', (string)trans('firefly.email_not_changed'));+ session()->flash('error', (string) trans('firefly.email_not_changed'));return redirect(route('profile.change-email'))->withInput();}@@ -419,7 +419,7 @@ class ProfileController extends ControllerAuth::guard()->logout();$request->session()->invalidate();- session()->flash('success', (string)trans('firefly.email_changed'));+ session()->flash('success', (string) trans('firefly.email_changed'));return redirect(route('index'));}@@ -432,7 +432,7 @@ class ProfileController extends Controller// force user logout.Auth::guard()->logout();$request->session()->invalidate();- session()->flash('success', (string)trans('firefly.email_changed'));+ session()->flash('success', (string) trans('firefly.email_changed'));return redirect(route('index'));}@@ -467,7 +467,7 @@ class ProfileController extends Controller}$repository->changePassword($user, $request->get('new_password'));- session()->flash('success', (string)trans('firefly.password_changed'));+ session()->flash('success', (string) trans('firefly.password_changed'));return redirect(route('profile.index'));}@@ -496,7 +496,7 @@ class ProfileController extends Controller$secret = session()->get('two-factor-secret');$repository->setMFACode($user, $secret);- session()->flash('success', (string)trans('firefly.saved_preferences'));+ session()->flash('success', (string) trans('firefly.saved_preferences'));app('preferences')->mark();// also save the code so replay attack is prevented.@@ -577,7 +577,7 @@ class ProfileController extends Controller}if (!Hash::check($request->get('password'), auth()->user()->password)) {- session()->flash('error', (string)trans('firefly.invalid_password'));+ session()->flash('error', (string) trans('firefly.invalid_password'));return redirect(route('profile.delete-account'));}@@ -601,7 +601,7 @@ class ProfileController extends Controllerpublic function postLogoutOtherSessions(Request $request){if (!$this->internalAuth) {- session()->flash('info', (string)trans('firefly.external_auth_disabled'));+ session()->flash('info', (string) trans('firefly.external_auth_disabled'));return redirect(route('profile.index'));}@@ -611,11 +611,11 @@ class ProfileController extends Controller];if (Auth::once($creds)) {Auth::logoutOtherDevices($request->get('password'));- session()->flash('info', (string)trans('firefly.other_sessions_logged_out'));+ session()->flash('info', (string) trans('firefly.other_sessions_logged_out'));return redirect(route('profile.index'));}- session()->flash('error', (string)trans('auth.failed'));+ session()->flash('error', (string) trans('auth.failed'));return redirect(route('profile.index'));@@ -641,7 +641,7 @@ class ProfileController extends Controller$user = auth()->user();$token = $user->generateAccessToken();app('preferences')->set('access_token', $token);- session()->flash('success', (string)trans('firefly.token_regenerated'));+ session()->flash('success', (string) trans('firefly.token_regenerated'));return redirect(route('profile.index'));}@@ -681,7 +681,7 @@ class ProfileController extends Controller/** @var string $match */$match = null;foreach ($set as $entry) {- $hashed = hash('sha256', sprintf('%s%s', (string)config('app.key'), $entry->data));+ $hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $entry->data));if ($hashed === $hash) {$match = $entry->data;break;@@ -696,7 +696,7 @@ class ProfileController extends Controller$repository->unblockUser($user);// return to login.- session()->flash('success', (string)trans('firefly.login_with_old_email'));+ session()->flash('success', (string) trans('firefly.login_with_old_email'));return redirect(route('login'));}diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.phpindex fac24c57fe..6b7b755e4d 100644--- a/app/Http/Controllers/Recurring/CreateController.php+++ b/app/Http/Controllers/Recurring/CreateController.php@@ -63,8 +63,8 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-paint-brush');- app('view')->share('title', (string)trans('firefly.recurrences'));- app('view')->share('subTitle', (string)trans('firefly.create_new_recurrence'));+ app('view')->share('title', (string) trans('firefly.recurrences'));+ app('view')->share('subTitle', (string) trans('firefly.create_new_recurrence'));$this->recurring = app(RecurringRepositoryInterface::class);$this->budgetRepos = app(BudgetRepositoryInterface::class);@@ -98,22 +98,22 @@ class CreateController extends Controller}$request->session()->forget('recurring.create.fromStore');$repetitionEnds = [- 'forever' => (string)trans('firefly.repeat_forever'),- 'until_date' => (string)trans('firefly.repeat_until_date'),- 'times' => (string)trans('firefly.repeat_times'),+ 'forever' => (string) trans('firefly.repeat_forever'),+ 'until_date' => (string) trans('firefly.repeat_until_date'),+ 'times' => (string) trans('firefly.repeat_times'),];$weekendResponses = [- RecurrenceRepetition::WEEKEND_DO_NOTHING => (string)trans('firefly.do_nothing'),- RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string)trans('firefly.skip_transaction'),- RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string)trans('firefly.jump_to_friday'),- RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'),+ RecurrenceRepetition::WEEKEND_DO_NOTHING => (string) trans('firefly.do_nothing'),+ RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string) trans('firefly.skip_transaction'),+ RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string) trans('firefly.jump_to_friday'),+ RecurrenceRepetition::WEEKEND_TO_MONDAY => (string) trans('firefly.jump_to_monday'),];$hasOldInput = null !== $request->old('_token'); // flash some data$preFilled = ['first_date' => $tomorrow->format('Y-m-d'),'transaction_type' => $hasOldInput ? $request->old('transaction_type') : 'withdrawal',- 'active' => $hasOldInput ? (bool)$request->old('active') : true,- 'apply_rules' => $hasOldInput ? (bool)$request->old('apply_rules') : true,+ 'active' => $hasOldInput ? (bool) $request->old('active') : true,+ 'apply_rules' => $hasOldInput ? (bool) $request->old('apply_rules') : true,];$request->session()->flash('preFilled', $preFilled);@@ -143,15 +143,15 @@ class CreateController extends Controller}$request->session()->forget('recurring.create.fromStore');$repetitionEnds = [- 'forever' => (string)trans('firefly.repeat_forever'),- 'until_date' => (string)trans('firefly.repeat_until_date'),- 'times' => (string)trans('firefly.repeat_times'),+ 'forever' => (string) trans('firefly.repeat_forever'),+ 'until_date' => (string) trans('firefly.repeat_until_date'),+ 'times' => (string) trans('firefly.repeat_times'),];$weekendResponses = [- RecurrenceRepetition::WEEKEND_DO_NOTHING => (string)trans('firefly.do_nothing'),- RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string)trans('firefly.skip_transaction'),- RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string)trans('firefly.jump_to_friday'),- RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'),+ RecurrenceRepetition::WEEKEND_DO_NOTHING => (string) trans('firefly.do_nothing'),+ RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string) trans('firefly.skip_transaction'),+ RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string) trans('firefly.jump_to_friday'),+ RecurrenceRepetition::WEEKEND_TO_MONDAY => (string) trans('firefly.jump_to_monday'),];@@ -184,8 +184,8 @@ class CreateController extends Controller'category' => $request->old('category'),'budget_id' => $request->old('budget_id'),'bill_id' => $request->old('bill_id'),- 'active' => (bool)$request->old('active'),- 'apply_rules' => (bool)$request->old('apply_rules'),+ 'active' => (bool) $request->old('active'),+ 'apply_rules' => (bool) $request->old('apply_rules'),];}if (false === $hasOldInput) {@@ -236,7 +236,7 @@ class CreateController extends Controllerreturn redirect(route('recurring.create'))->withInput();}- $request->session()->flash('success', (string)trans('firefly.stored_new_recurrence', ['title' => $recurrence->title]));+ $request->session()->flash('success', (string) trans('firefly.stored_new_recurrence', ['title' => $recurrence->title]));app('preferences')->mark();// store attachment(s):@@ -246,7 +246,7 @@ class CreateController extends Controller$this->attachments->saveAttachmentsForModel($recurrence, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -254,7 +254,7 @@ class CreateController extends Controller}$redirect = redirect($this->getPreviousUri('recurring.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {// set value so create routine will not overwrite URL:$request->session()->put('recurring.create.fromStore', true);diff --git a/app/Http/Controllers/Recurring/DeleteController.php b/app/Http/Controllers/Recurring/DeleteController.phpindex f40cad7007..67793ce6ef 100644--- a/app/Http/Controllers/Recurring/DeleteController.php+++ b/app/Http/Controllers/Recurring/DeleteController.php@@ -53,7 +53,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-paint-brush');- app('view')->share('title', (string)trans('firefly.recurrences'));+ app('view')->share('title', (string) trans('firefly.recurrences'));$this->recurring = app(RecurringRepositoryInterface::class);@@ -71,7 +71,7 @@ class DeleteController extends Controller*/public function delete(Recurrence $recurrence){- $subTitle = (string)trans('firefly.delete_recurring', ['title' => $recurrence->title]);+ $subTitle = (string) trans('firefly.delete_recurring', ['title' => $recurrence->title]);// put previous url in session$this->rememberPreviousUri('recurrences.delete.uri');@@ -92,7 +92,7 @@ class DeleteController extends Controllerpublic function destroy(RecurringRepositoryInterface $repository, Request $request, Recurrence $recurrence){$repository->destroy($recurrence);- $request->session()->flash('success', (string)trans('firefly.' . 'recurrence_deleted', ['title' => $recurrence->title]));+ $request->session()->flash('success', (string) trans('firefly.' . 'recurrence_deleted', ['title' => $recurrence->title]));app('preferences')->mark();return redirect($this->getPreviousUri('recurrences.delete.uri'));diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.phpindex bafbac99fb..ab4fd9d231 100644--- a/app/Http/Controllers/Recurring/EditController.php+++ b/app/Http/Controllers/Recurring/EditController.php@@ -64,8 +64,8 @@ class EditController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-paint-brush');- app('view')->share('title', (string)trans('firefly.recurrences'));- app('view')->share('subTitle', (string)trans('firefly.recurrences'));+ app('view')->share('title', (string) trans('firefly.recurrences'));+ app('view')->share('subTitle', (string) trans('firefly.recurrences'));$this->recurring = app(RecurringRepositoryInterface::class);$this->budgetRepos = app(BudgetRepositoryInterface::class);@@ -118,9 +118,9 @@ class EditController extends Controller$repetitionEnd = 'forever';$repetitionEnds = [- 'forever' => (string)trans('firefly.repeat_forever'),- 'until_date' => (string)trans('firefly.repeat_until_date'),- 'times' => (string)trans('firefly.repeat_times'),+ 'forever' => (string) trans('firefly.repeat_forever'),+ 'until_date' => (string) trans('firefly.repeat_until_date'),+ 'times' => (string) trans('firefly.repeat_times'),];if (null !== $recurrence->repeat_until) {$repetitionEnd = 'until_date';@@ -130,22 +130,22 @@ class EditController extends Controller}$weekendResponses = [- RecurrenceRepetition::WEEKEND_DO_NOTHING => (string)trans('firefly.do_nothing'),- RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string)trans('firefly.skip_transaction'),- RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string)trans('firefly.jump_to_friday'),- RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'),+ RecurrenceRepetition::WEEKEND_DO_NOTHING => (string) trans('firefly.do_nothing'),+ RecurrenceRepetition::WEEKEND_SKIP_CREATION => (string) trans('firefly.skip_transaction'),+ RecurrenceRepetition::WEEKEND_TO_FRIDAY => (string) trans('firefly.jump_to_friday'),+ RecurrenceRepetition::WEEKEND_TO_MONDAY => (string) trans('firefly.jump_to_monday'),];$hasOldInput = null !== $request->old('_token');$preFilled = ['transaction_type' => strtolower($recurrence->transactionType->type),- 'active' => $hasOldInput ? (bool)$request->old('active') : $recurrence->active,- 'apply_rules' => $hasOldInput ? (bool)$request->old('apply_rules') : $recurrence->apply_rules,+ 'active' => $hasOldInput ? (bool) $request->old('active') : $recurrence->active,+ 'apply_rules' => $hasOldInput ? (bool) $request->old('apply_rules') : $recurrence->apply_rules,'deposit_source_id' => $array['transactions'][0]['source_id'],'withdrawal_destination_id' => $array['transactions'][0]['destination_id'],];- $array['first_date'] = substr((string)$array['first_date'], 0, 10);- $array['repeat_until'] = substr((string)$array['repeat_until'], 0, 10);+ $array['first_date'] = substr((string) $array['first_date'], 0, 10);+ $array['repeat_until'] = substr((string) $array['repeat_until'], 0, 10);$array['transactions'][0]['tags'] = implode(',', $array['transactions'][0]['tags'] ?? []);return view(@@ -171,7 +171,7 @@ class EditController extends Controller$data = $request->getAll();$this->recurring->update($recurrence, $data);- $request->session()->flash('success', (string)trans('firefly.updated_recurrence', ['title' => $recurrence->title]));+ $request->session()->flash('success', (string) trans('firefly.updated_recurrence', ['title' => $recurrence->title]));// store new attachment(s):$files = $request->hasFile('attachments') ? $request->file('attachments') : null;@@ -179,7 +179,7 @@ class EditController extends Controller$this->attachments->saveAttachmentsForModel($recurrence, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachments->getMessages()->get('attachments')) > 0) {@@ -187,7 +187,7 @@ class EditController extends Controller}app('preferences')->mark();$redirect = redirect($this->getPreviousUri('recurrences.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {// set value so edit routine will not overwrite URL:$request->session()->put('recurrences.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Recurring/IndexController.php b/app/Http/Controllers/Recurring/IndexController.phpindex bf1f1e2842..6a53ff08ef 100644--- a/app/Http/Controllers/Recurring/IndexController.php+++ b/app/Http/Controllers/Recurring/IndexController.php@@ -58,7 +58,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-paint-brush');- app('view')->share('title', (string)trans('firefly.recurrences'));+ app('view')->share('title', (string) trans('firefly.recurrences'));$this->recurringRepos = app(RecurringRepositoryInterface::class);@@ -79,8 +79,8 @@ class IndexController extends Controller*/public function index(Request $request){- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$collection = $this->recurringRepos->get();$today = today(config('app.timezone'));$year = today(config('app.timezone'));diff --git a/app/Http/Controllers/Recurring/ShowController.php b/app/Http/Controllers/Recurring/ShowController.phpindex be1ed927b1..94b94afcd9 100644--- a/app/Http/Controllers/Recurring/ShowController.php+++ b/app/Http/Controllers/Recurring/ShowController.php@@ -59,7 +59,7 @@ class ShowController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-paint-brush');- app('view')->share('title', (string)trans('firefly.recurrences'));+ app('view')->share('title', (string) trans('firefly.recurrences'));$this->recurring = app(RecurringRepositoryInterface::class);@@ -94,7 +94,7 @@ class ShowController extends Controller}}- $subTitle = (string)trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);+ $subTitle = (string) trans('firefly.overview_for_recurrence', ['title' => $recurrence->title]);return view('recurring.show', compact('recurrence', 'subTitle', 'array', 'groups', 'today'));}diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.phpindex 31b5d4d0f0..331396c26d 100644--- a/app/Http/Controllers/Report/BudgetController.php+++ b/app/Http/Controllers/Report/BudgetController.php@@ -186,8 +186,8 @@ class BudgetController extends Controller];$result[$key]['transactions']++;$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);- $result[$key]['avg_float'] = (float)$result[$key]['avg'];+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);+ $result[$key]['avg_float'] = (float) $result[$key]['avg'];}}}@@ -266,7 +266,7 @@ class BudgetController extends Controller$total = $sums[$currencyId]['sum'] ?? '0';$pct = '0';if (0 !== bccomp($sum, '0') && 0 !== bccomp($total, '9')) {- $pct = round((float)bcmul(bcdiv($sum, $total), '100'));+ $pct = round((float) bcmul(bcdiv($sum, $total), '100'));}$report[$budgetId]['currencies'][$currencyId]['sum_pct'] = $pct;}@@ -348,7 +348,7 @@ class BudgetController extends Controller$report[$key]['entries'][$dateKey] = $report[$key] ['entries'][$dateKey] ?? '0';$report[$key]['entries'][$dateKey] = bcadd($journal['amount'], $report[$key] ['entries'][$dateKey]);$report[$key]['sum'] = bcadd($report[$key] ['sum'], $journal['amount']);- $report[$key]['avg'] = bcdiv($report[$key]['sum'], (string)count($periods));+ $report[$key]['avg'] = bcdiv($report[$key]['sum'], (string) count($periods));}}}@@ -383,7 +383,7 @@ class BudgetController extends Controller$result[] = ['description' => $journal['description'],'transaction_group_id' => $journal['transaction_group_id'],- 'amount_float' => (float)$journal['amount'],+ 'amount_float' => (float) $journal['amount'],'amount' => $journal['amount'],'date' => $journal['date']->isoFormat($this->monthAndDayFormat),'date_sort' => $journal['date']->format('Y-m-d'),diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.phpindex 27f56c1f0e..945b0868a7 100644--- a/app/Http/Controllers/Report/CategoryController.php+++ b/app/Http/Controllers/Report/CategoryController.php@@ -300,8 +300,8 @@ class CategoryController extends Controller];$result[$key]['transactions']++;$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);- $result[$key]['avg_float'] = (float)$result[$key]['avg'];+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);+ $result[$key]['avg_float'] = (float) $result[$key]['avg'];}}}@@ -352,8 +352,8 @@ class CategoryController extends Controller];$result[$key]['transactions']++;$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);- $result[$key]['avg_float'] = (float)$result[$key]['avg'];+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);+ $result[$key]['avg_float'] = (float) $result[$key]['avg'];}}}@@ -672,7 +672,7 @@ class CategoryController extends Controllertry {- $result = (string)view('reports.partials.categories', compact('report'))->render();+ $result = (string) view('reports.partials.categories', compact('report'))->render();$cache->store($result);} catch (Throwable $e) { // @phpstan-ignore-lineLog::error(sprintf('Could not render category::expenses: %s', $e->getMessage()));@@ -700,7 +700,7 @@ class CategoryController extends Controller$result[] = ['description' => $journal['description'],'transaction_group_id' => $journal['transaction_group_id'],- 'amount_float' => (float)$journal['amount'],+ 'amount_float' => (float) $journal['amount'],'amount' => $journal['amount'],'date' => $journal['date']->isoFormat($this->monthAndDayFormat),'date_sort' => $journal['date']->format('Y-m-d'),@@ -750,7 +750,7 @@ class CategoryController extends Controller$result[] = ['description' => $journal['description'],'transaction_group_id' => $journal['transaction_group_id'],- 'amount_float' => (float)$journal['amount'],+ 'amount_float' => (float) $journal['amount'],'amount' => $journal['amount'],'date' => $journal['date']->isoFormat($this->monthAndDayFormat),'date_sort' => $journal['date']->format('Y-m-d'),diff --git a/app/Http/Controllers/Report/DoubleController.php b/app/Http/Controllers/Report/DoubleController.phpindex 29f7cb2dce..5472e9741b 100644--- a/app/Http/Controllers/Report/DoubleController.php+++ b/app/Http/Controllers/Report/DoubleController.php@@ -100,8 +100,8 @@ class DoubleController extends Controller];$result[$key]['transactions']++;$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);- $result[$key]['avg_float'] = (float)$result[$key]['avg'];+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);+ $result[$key]['avg_float'] = (float) $result[$key]['avg'];}}// sort by amount_float@@ -152,8 +152,8 @@ class DoubleController extends Controller];$result[$key]['transactions']++;$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);- $result[$key]['avg_float'] = (float)$result[$key]['avg'];+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);+ $result[$key]['avg_float'] = (float) $result[$key]['avg'];}}// sort by amount_float@@ -435,7 +435,7 @@ class DoubleController extends Controller$result[] = ['description' => $journal['description'],'transaction_group_id' => $journal['transaction_group_id'],- 'amount_float' => (float)$journal['amount'],+ 'amount_float' => (float) $journal['amount'],'amount' => $journal['amount'],'date' => $journal['date']->isoFormat($this->monthAndDayFormat),'date_sort' => $journal['date']->format('Y-m-d'),@@ -485,7 +485,7 @@ class DoubleController extends Controller$result[] = ['description' => $journal['description'],'transaction_group_id' => $journal['transaction_group_id'],- 'amount_float' => (float)$journal['amount'],+ 'amount_float' => (float) $journal['amount'],'amount' => $journal['amount'],'date' => $journal['date']->isoFormat($this->monthAndDayFormat),'date_sort' => $journal['date']->format('Y-m-d'),diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.phpindex 2c97d54caa..bf263bb2a5 100644--- a/app/Http/Controllers/Report/TagController.php+++ b/app/Http/Controllers/Report/TagController.php@@ -293,8 +293,8 @@ class TagController extends Controller];$result[$key]['transactions']++;$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);- $result[$key]['avg_float'] = (float)$result[$key]['avg'];+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);+ $result[$key]['avg_float'] = (float) $result[$key]['avg'];}}}@@ -345,8 +345,8 @@ class TagController extends Controller];$result[$key]['transactions']++;$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);- $result[$key]['avg_float'] = (float)$result[$key]['avg'];+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);+ $result[$key]['avg_float'] = (float) $result[$key]['avg'];}}}@@ -492,7 +492,7 @@ class TagController extends Controller$result[] = ['description' => $journal['description'],'transaction_group_id' => $journal['transaction_group_id'],- 'amount_float' => (float)$journal['amount'],+ 'amount_float' => (float) $journal['amount'],'amount' => $journal['amount'],'date' => $journal['date']->isoFormat($this->monthAndDayFormat),'date_sort' => $journal['date']->format('Y-m-d'),@@ -542,7 +542,7 @@ class TagController extends Controller$result[] = ['description' => $journal['description'],'transaction_group_id' => $journal['transaction_group_id'],- 'amount_float' => (float)$journal['amount'],+ 'amount_float' => (float) $journal['amount'],'amount' => $journal['amount'],'date' => $journal['date']->isoFormat($this->monthAndDayFormat),'date_sort' => $journal['date']->format('Y-m-d'),diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.phpindex 335267ee5d..e4744e4f79 100644--- a/app/Http/Controllers/ReportController.php+++ b/app/Http/Controllers/ReportController.php@@ -64,7 +64,7 @@ class ReportController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.reports'));+ app('view')->share('title', (string) trans('firefly.reports'));app('view')->share('mainTitleIcon', 'fa-bar-chart');app('view')->share('subTitleIcon', 'fa-calendar');$this->helper = app(ReportHelperInterface::class);@@ -89,7 +89,7 @@ class ReportController extends Controllerpublic function auditReport(Collection $accounts, Carbon $start, Carbon $end){if ($end < $start) {- return view('error')->with('message', (string)trans('firefly.end_after_start_date'));+ return view('error')->with('message', (string) trans('firefly.end_after_start_date'));}$this->repository->cleanupBudgets();@@ -125,7 +125,7 @@ class ReportController extends Controllerpublic function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end){if ($end < $start) {- return view('error')->with('message', (string)trans('firefly.end_after_start_date'));+ return view('error')->with('message', (string) trans('firefly.end_after_start_date'));}$this->repository->cleanupBudgets();@@ -162,7 +162,7 @@ class ReportController extends Controllerpublic function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end){if ($end < $start) {- return view('error')->with('message', (string)trans('firefly.end_after_start_date'));+ return view('error')->with('message', (string) trans('firefly.end_after_start_date'));}$this->repository->cleanupBudgets();@@ -198,7 +198,7 @@ class ReportController extends Controllerpublic function defaultReport(Collection $accounts, Carbon $start, Carbon $end){if ($end < $start) {- return view('error')->with('message', (string)trans('firefly.end_after_start_date'));+ return view('error')->with('message', (string) trans('firefly.end_after_start_date'));}$this->repository->cleanupBudgets();@@ -244,7 +244,7 @@ class ReportController extends Controllertrans('firefly.report_double',['start' => $start->isoFormat($this->monthAndDayFormat),- 'end' => $end->isoFormat($this->monthAndDayFormat)]+ 'end' => $end->isoFormat($this->monthAndDayFormat)]));@@ -342,37 +342,37 @@ class ReportController extends Controllerif (0 === $request->getAccountList()->count()) {Log::debug('Account count is zero');- session()->flash('error', (string)trans('firefly.select_at_least_one_account'));+ session()->flash('error', (string) trans('firefly.select_at_least_one_account'));return redirect(route('reports.index'));}if ('category' === $reportType && 0 === $request->getCategoryList()->count()) {- session()->flash('error', (string)trans('firefly.select_at_least_one_category'));+ session()->flash('error', (string) trans('firefly.select_at_least_one_category'));return redirect(route('reports.index'));}if ('budget' === $reportType && 0 === $request->getBudgetList()->count()) {- session()->flash('error', (string)trans('firefly.select_at_least_one_budget'));+ session()->flash('error', (string) trans('firefly.select_at_least_one_budget'));return redirect(route('reports.index'));}if ('tag' === $reportType && 0 === $request->getTagList()->count()) {- session()->flash('error', (string)trans('firefly.select_at_least_one_tag'));+ session()->flash('error', (string) trans('firefly.select_at_least_one_tag'));return redirect(route('reports.index'));}if ('double' === $reportType && 0 === $request->getDoubleList()->count()) {- session()->flash('error', (string)trans('firefly.select_at_least_one_expense'));+ session()->flash('error', (string) trans('firefly.select_at_least_one_expense'));return redirect(route('reports.index'));}if ($request->getEndDate() < $request->getStartDate()) {- return view('error')->with('message', (string)trans('firefly.end_after_start_date'));+ return view('error')->with('message', (string) trans('firefly.end_after_start_date'));}$uri = match ($reportType) {@@ -401,7 +401,7 @@ class ReportController extends Controllerpublic function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end){if ($end < $start) {- return view('error')->with('message', (string)trans('firefly.end_after_start_date'));+ return view('error')->with('message', (string) trans('firefly.end_after_start_date'));}$this->repository->cleanupBudgets();diff --git a/app/Http/Controllers/Rule/CreateController.php b/app/Http/Controllers/Rule/CreateController.phpindex b0b7e8265b..c470b6af0d 100644--- a/app/Http/Controllers/Rule/CreateController.php+++ b/app/Http/Controllers/Rule/CreateController.php@@ -60,7 +60,7 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->ruleRepos = app(RuleRepositoryInterface::class);@@ -88,7 +88,7 @@ class CreateController extends Controller$oldActions = [];// build triggers from query, if present.- $query = (string)$request->get('from_query');+ $query = (string) $request->get('from_query');if ('' !== $query) {$search = app(SearchInterface::class);$search->parseQuery($query);@@ -112,9 +112,9 @@ class CreateController extends Controller$subTitleIcon = 'fa-clone';// title depends on whether or not there is a rule group:- $subTitle = (string)trans('firefly.make_new_rule_no_group');+ $subTitle = (string) trans('firefly.make_new_rule_no_group');if (null !== $ruleGroup) {- $subTitle = (string)trans('firefly.make_new_rule', ['title' => $ruleGroup->title]);+ $subTitle = (string) trans('firefly.make_new_rule', ['title' => $ruleGroup->title]);}// flash old data@@ -142,13 +142,13 @@ class CreateController extends Controller*/public function createFromBill(Request $request, Bill $bill){- $request->session()->flash('info', (string)trans('firefly.instructions_rule_from_bill', ['name' => e($bill->name)]));+ $request->session()->flash('info', (string) trans('firefly.instructions_rule_from_bill', ['name' => e($bill->name)]));$this->createDefaultRuleGroup();$preFilled = ['strict' => true,- 'title' => (string)trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]),- 'description' => (string)trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]),+ 'title' => (string) trans('firefly.new_rule_for_bill_title', ['name' => $bill->name]),+ 'description' => (string) trans('firefly.new_rule_for_bill_description', ['name' => $bill->name]),];// make triggers and actions from the bill itself.@@ -168,7 +168,7 @@ class CreateController extends Controller$subTitleIcon = 'fa-clone';// title depends on whether or not there is a rule group:- $subTitle = (string)trans('firefly.make_new_rule_no_group');+ $subTitle = (string) trans('firefly.make_new_rule_no_group');// flash old data$request->session()->flash('preFilled', $preFilled);@@ -193,10 +193,10 @@ class CreateController extends Controller*/public function createFromJournal(Request $request, TransactionJournal $journal){- $request->session()->flash('info', (string)trans('firefly.instructions_rule_from_journal', ['name' => e($journal->description)]));+ $request->session()->flash('info', (string) trans('firefly.instructions_rule_from_journal', ['name' => e($journal->description)]));$subTitleIcon = 'fa-clone';- $subTitle = (string)trans('firefly.make_new_rule_no_group');+ $subTitle = (string) trans('firefly.make_new_rule_no_group');// get triggers and actions for journal.$oldTriggers = $this->getTriggersForJournal($journal);@@ -207,8 +207,8 @@ class CreateController extends Controller// collect pre-filled information:$preFilled = ['strict' => true,- 'title' => (string)trans('firefly.new_rule_for_journal_title', ['description' => $journal->description]),- 'description' => (string)trans('firefly.new_rule_for_journal_description', ['description' => $journal->description]),+ 'title' => (string) trans('firefly.new_rule_for_journal_title', ['description' => $journal->description]),+ 'description' => (string) trans('firefly.new_rule_for_journal_description', ['description' => $journal->description]),];// restore actions and triggers from old input:@@ -242,7 +242,7 @@ class CreateController extends Controller*/public function duplicate(Request $request): JsonResponse{- $ruleId = (int)$request->get('id');+ $ruleId = (int) $request->get('id');$rule = $this->ruleRepos->find($ruleId);if (null !== $rule) {$this->ruleRepos->duplicate($rule);@@ -263,22 +263,22 @@ class CreateController extends Controller{$data = $request->getRuleData();$rule = $this->ruleRepos->store($data);- session()->flash('success', (string)trans('firefly.stored_new_rule', ['title' => $rule->title]));+ session()->flash('success', (string) trans('firefly.stored_new_rule', ['title' => $rule->title]));app('preferences')->mark();// redirect to show bill.- if ('true' === $request->get('return_to_bill') && (int)$request->get('bill_id') > 0) {- return redirect(route('bills.show', [(int)$request->get('bill_id')]));+ if ('true' === $request->get('return_to_bill') && (int) $request->get('bill_id') > 0) {+ return redirect(route('bills.show', [(int) $request->get('bill_id')]));}// redirect to new bill creation.- if ((int)$request->get('bill_id') > 0) {+ if ((int) $request->get('bill_id') > 0) {return redirect($this->getPreviousUri('bills.create.uri'));}$redirect = redirect($this->getPreviousUri('rules.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {session()->put('rules.create.fromStore', true);$redirect = redirect(route('rules.create', [$data['rule_group_id']]))->withInput();diff --git a/app/Http/Controllers/Rule/DeleteController.php b/app/Http/Controllers/Rule/DeleteController.phpindex 436e711b25..7d89bd123f 100644--- a/app/Http/Controllers/Rule/DeleteController.php+++ b/app/Http/Controllers/Rule/DeleteController.php@@ -49,7 +49,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->ruleRepos = app(RuleRepositoryInterface::class);@@ -68,7 +68,7 @@ class DeleteController extends Controller*/public function delete(Rule $rule){- $subTitle = (string)trans('firefly.delete_rule', ['title' => $rule->title]);+ $subTitle = (string) trans('firefly.delete_rule', ['title' => $rule->title]);// put previous url in session$this->rememberPreviousUri('rules.delete.uri');@@ -88,7 +88,7 @@ class DeleteController extends Controller$title = $rule->title;$this->ruleRepos->destroy($rule);- session()->flash('success', (string)trans('firefly.deleted_rule', ['title' => $title]));+ session()->flash('success', (string) trans('firefly.deleted_rule', ['title' => $title]));app('preferences')->mark();return redirect($this->getPreviousUri('rules.delete.uri'));diff --git a/app/Http/Controllers/Rule/EditController.php b/app/Http/Controllers/Rule/EditController.phpindex 11c97fbb73..daf8cdbbe1 100644--- a/app/Http/Controllers/Rule/EditController.php+++ b/app/Http/Controllers/Rule/EditController.php@@ -59,7 +59,7 @@ class EditController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->ruleRepos = app(RuleRepositoryInterface::class);@@ -85,7 +85,7 @@ class EditController extends Controller$oldTriggers = [];// build triggers from query, if present.- $query = (string)$request->get('from_query');+ $query = (string) $request->get('from_query');if ('' !== $query) {$search = app(SearchInterface::class);$search->parseQuery($query);@@ -115,15 +115,15 @@ class EditController extends Controller$hasOldInput = null !== $request->old('_token');$preFilled = [- 'active' => $hasOldInput ? (bool)$request->old('active') : $rule->active,- 'stop_processing' => $hasOldInput ? (bool)$request->old('stop_processing') : $rule->stop_processing,- 'strict' => $hasOldInput ? (bool)$request->old('strict') : $rule->strict,+ 'active' => $hasOldInput ? (bool) $request->old('active') : $rule->active,+ 'stop_processing' => $hasOldInput ? (bool) $request->old('stop_processing') : $rule->stop_processing,+ 'strict' => $hasOldInput ? (bool) $request->old('strict') : $rule->strict,];// get rule trigger for update / store-journal:$primaryTrigger = $this->ruleRepos->getPrimaryTrigger($rule);- $subTitle = (string)trans('firefly.edit_rule', ['title' => $rule->title]);+ $subTitle = (string) trans('firefly.edit_rule', ['title' => $rule->title]);// put previous url in session if not redirect from store (not "return_to_edit").if (true !== session('rules.edit.fromUpdate')) {@@ -150,7 +150,7 @@ class EditController extends Controllerforeach ($operators as $key => $operator) {if ('user_action' !== $key && false === $operator['alias']) {- $triggers[$key] = (string)trans(sprintf('firefly.rule_trigger_%s_choice', $key));+ $triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key));}}asort($triggers);@@ -191,10 +191,10 @@ class EditController extends Controller$data = $request->getRuleData();$this->ruleRepos->update($rule, $data);- session()->flash('success', (string)trans('firefly.updated_rule', ['title' => $rule->title]));+ session()->flash('success', (string) trans('firefly.updated_rule', ['title' => $rule->title]));app('preferences')->mark();$redirect = redirect($this->getPreviousUri('rules.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {session()->put('rules.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Rule/IndexController.php b/app/Http/Controllers/Rule/IndexController.phpindex 98e13cc412..ee3f33ed3a 100644--- a/app/Http/Controllers/Rule/IndexController.php+++ b/app/Http/Controllers/Rule/IndexController.php@@ -54,7 +54,7 @@ class IndexController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->ruleGroupRepos = app(RuleGroupRepositoryInterface::class);$this->ruleRepos = app(RuleRepositoryInterface::class);@@ -79,16 +79,16 @@ class IndexController extends Controller}/**- * @param Request $request- * @param Rule $rule+ * @param Request $request+ * @param Rule $rule* @param RuleGroup $ruleGroup** @return JsonResponse*/public function moveRule(Request $request, Rule $rule, RuleGroup $ruleGroup): JsonResponse{- $order = (int)$request->get('order');- $this->ruleRepos->moveRule($rule, $ruleGroup, (int)$order);+ $order = (int) $request->get('order');+ $this->ruleRepos->moveRule($rule, $ruleGroup, (int) $order);return response()->json([]);}diff --git a/app/Http/Controllers/Rule/SelectController.php b/app/Http/Controllers/Rule/SelectController.phpindex 2fc48d7f11..999b46343c 100644--- a/app/Http/Controllers/Rule/SelectController.php+++ b/app/Http/Controllers/Rule/SelectController.php@@ -58,7 +58,7 @@ class SelectController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');return $next($request);@@ -97,7 +97,7 @@ class SelectController extends Controller$newRuleEngine->fire();$resultCount = $newRuleEngine->getResults();- session()->flash('success', (string)trans_choice('firefly.applied_rule_selection', $resultCount, ['title' => $rule->title]));+ session()->flash('success', (string) trans_choice('firefly.applied_rule_selection', $resultCount, ['title' => $rule->title]));return redirect()->route('rules.index');}@@ -119,7 +119,7 @@ class SelectController extends Controller// does the user have shared accounts?$first = session('first', Carbon::now()->subYear())->format('Y-m-d');$today = Carbon::now()->format('Y-m-d');- $subTitle = (string)trans('firefly.apply_rule_selection', ['title' => $rule->title]);+ $subTitle = (string) trans('firefly.apply_rule_selection', ['title' => $rule->title]);return view('rules.rule.select-transactions', compact('first', 'today', 'rule', 'subTitle'));}@@ -145,7 +145,7 @@ class SelectController extends Controller// warn if nothing.if (empty($textTriggers)) {- return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]);+ return response()->json(['html' => '', 'warning' => (string) trans('firefly.warning_no_valid_triggers')]);}foreach ($textTriggers as $textTrigger) {@@ -169,7 +169,7 @@ class SelectController extends Controller// Warn the user if only a subset of transactions is returned$warning = '';if (empty($collection)) {- $warning = (string)trans('firefly.warning_no_matching_transactions');+ $warning = (string) trans('firefly.warning_no_matching_transactions');}// Return json response@@ -200,7 +200,7 @@ class SelectController extends Controller$triggers = $rule->ruleTriggers;if (empty($triggers)) {- return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]);+ return response()->json(['html' => '', 'warning' => (string) trans('firefly.warning_no_valid_triggers')]);}// create new rule engine:$newRuleEngine = app(RuleEngineInterface::class);@@ -212,7 +212,7 @@ class SelectController extends Controller$warning = '';if (empty($collection)) {- $warning = (string)trans('firefly.warning_no_matching_transactions');+ $warning = (string) trans('firefly.warning_no_matching_transactions');}// Return json responsediff --git a/app/Http/Controllers/RuleGroup/CreateController.php b/app/Http/Controllers/RuleGroup/CreateController.phpindex 65c44183db..4e58e6a68b 100644--- a/app/Http/Controllers/RuleGroup/CreateController.php+++ b/app/Http/Controllers/RuleGroup/CreateController.php@@ -50,7 +50,7 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->repository = app(RuleGroupRepositoryInterface::class);@@ -68,7 +68,7 @@ class CreateController extends Controllerpublic function create(){$subTitleIcon = 'fa-clone';- $subTitle = (string)trans('firefly.make_new_rule_group');+ $subTitle = (string) trans('firefly.make_new_rule_group');// put previous url in session if not redirect from store (not "create another").if (true !== session('rule-groups.create.fromStore')) {@@ -88,14 +88,14 @@ class CreateController extends Controller*/public function store(RuleGroupFormRequest $request){- $data = $request->getRuleGroupData();+ $data = $request->getRuleGroupData();$ruleGroup = $this->repository->store($data);- session()->flash('success', (string)trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title]));+ session()->flash('success', (string) trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title]));app('preferences')->mark();$redirect = redirect($this->getPreviousUri('rule-groups.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {session()->put('rule-groups.create.fromStore', true);diff --git a/app/Http/Controllers/RuleGroup/DeleteController.php b/app/Http/Controllers/RuleGroup/DeleteController.phpindex ae87833d8e..d21000ea80 100644--- a/app/Http/Controllers/RuleGroup/DeleteController.php+++ b/app/Http/Controllers/RuleGroup/DeleteController.php@@ -51,7 +51,7 @@ class DeleteController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->repository = app(RuleGroupRepositoryInterface::class);@@ -70,7 +70,7 @@ class DeleteController extends Controller*/public function delete(RuleGroup $ruleGroup){- $subTitle = (string)trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]);+ $subTitle = (string) trans('firefly.delete_rule_group', ['title' => $ruleGroup->title]);// put previous url in session$this->rememberPreviousUri('rule-groups.delete.uri');@@ -81,7 +81,7 @@ class DeleteController extends Controller/*** Actually destroy the rule group.*- * @param Request $request+ * @param Request $request* @param RuleGroup $ruleGroup** @return RedirectResponse|Redirector@@ -91,10 +91,10 @@ class DeleteController extends Controller$title = $ruleGroup->title;/** @var RuleGroup $moveTo */- $moveTo = $this->repository->find((int)$request->get('move_rules_before_delete'));+ $moveTo = $this->repository->find((int) $request->get('move_rules_before_delete'));$this->repository->destroy($ruleGroup, $moveTo);- session()->flash('success', (string)trans('firefly.deleted_rule_group', ['title' => $title]));+ session()->flash('success', (string) trans('firefly.deleted_rule_group', ['title' => $title]));app('preferences')->mark();return redirect($this->getPreviousUri('rule-groups.delete.uri'));diff --git a/app/Http/Controllers/RuleGroup/EditController.php b/app/Http/Controllers/RuleGroup/EditController.phpindex cca24c8f57..d87122cc64 100644--- a/app/Http/Controllers/RuleGroup/EditController.php+++ b/app/Http/Controllers/RuleGroup/EditController.php@@ -52,7 +52,7 @@ class EditController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->repository = app(RuleGroupRepositoryInterface::class);@@ -62,6 +62,32 @@ class EditController extends Controller);}+ /**+ * Edit a rule group.+ *+ * @param Request $request+ * @param RuleGroup $ruleGroup+ *+ * @return Factory|View+ */+ public function edit(Request $request, RuleGroup $ruleGroup)+ {+ $subTitle = (string) trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);++ $hasOldInput = null !== $request->old('_token');+ $preFilled = [+ 'active' => $hasOldInput ? (bool) $request->old('active') : $ruleGroup->active,+ ];+ // put previous url in session if not redirect from store (not "return_to_edit").+ if (true !== session('rule-groups.edit.fromUpdate')) {+ $this->rememberPreviousUri('rule-groups.edit.uri');+ }+ session()->forget('rule-groups.edit.fromUpdate');+ session()->flash('preFilled', $preFilled);++ return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle'));+ }+/*** Move a rule group in either direction.*@@ -71,20 +97,20 @@ class EditController extends Controller*/public function moveGroup(Request $request): JsonResponse{- $groupId = (int)$request->get('id');- $ruleGroup= $this->repository->find($groupId);- if(null !== $ruleGroup) {+ $groupId = (int) $request->get('id');+ $ruleGroup = $this->repository->find($groupId);+ if (null !== $ruleGroup) {$direction = $request->get('direction');- if('down' === $direction) {+ if ('down' === $direction) {$maxOrder = $this->repository->maxOrder();- $order = (int)$ruleGroup->order;+ $order = (int) $ruleGroup->order;if ($order < $maxOrder) {$newOrder = $order + 1;$this->repository->setOrder($ruleGroup, $newOrder);}}- if('up' === $direction) {- $order = (int)$ruleGroup->order;+ if ('up' === $direction) {+ $order = (int) $ruleGroup->order;if ($order > 1) {$newOrder = $order - 1;$this->repository->setOrder($ruleGroup, $newOrder);@@ -94,33 +120,6 @@ class EditController extends Controllerreturn new JsonResponse(['OK']);}-- /**- * Edit a rule group.- *- * @param Request $request- * @param RuleGroup $ruleGroup- *- * @return Factory|View- */- public function edit(Request $request, RuleGroup $ruleGroup)- {- $subTitle = (string)trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);-- $hasOldInput = null !== $request->old('_token');- $preFilled = [- 'active' => $hasOldInput ? (bool)$request->old('active') : $ruleGroup->active,- ];- // put previous url in session if not redirect from store (not "return_to_edit").- if (true !== session('rule-groups.edit.fromUpdate')) {- $this->rememberPreviousUri('rule-groups.edit.uri');- }- session()->forget('rule-groups.edit.fromUpdate');- session()->flash('preFilled', $preFilled);-- return view('rules.rule-group.edit', compact('ruleGroup', 'subTitle'));- }-/*** Update the rule group.*@@ -134,15 +133,15 @@ class EditController extends Controller$data = ['title' => $request->string('title'),'description' => $request->stringWithNewlines('description'),- 'active' => 1 === (int)$request->input('active'),+ 'active' => 1 === (int) $request->input('active'),];$this->repository->update($ruleGroup, $data);- session()->flash('success', (string)trans('firefly.updated_rule_group', ['title' => $ruleGroup->title]));+ session()->flash('success', (string) trans('firefly.updated_rule_group', ['title' => $ruleGroup->title]));app('preferences')->mark();$redirect = redirect($this->getPreviousUri('rule-groups.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {session()->put('rule-groups.edit.fromUpdate', true);diff --git a/app/Http/Controllers/RuleGroup/ExecutionController.php b/app/Http/Controllers/RuleGroup/ExecutionController.phpindex 4868f9d0b3..39d0bc89b8 100644--- a/app/Http/Controllers/RuleGroup/ExecutionController.php+++ b/app/Http/Controllers/RuleGroup/ExecutionController.php@@ -53,7 +53,7 @@ class ExecutionController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.rules'));+ app('view')->share('title', (string) trans('firefly.rules'));app('view')->share('mainTitleIcon', 'fa-random');$this->ruleGroupRepository = app(RuleGroupRepositoryInterface::class);@@ -95,7 +95,7 @@ class ExecutionController extends Controller$newRuleEngine->fire();// Tell the user that the job is queued- session()->flash('success', (string)trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title]));+ session()->flash('success', (string) trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title]));return redirect()->route('rules.index');}@@ -111,7 +111,7 @@ class ExecutionController extends Controller{$first = session('first')->format('Y-m-d');$today = Carbon::now()->format('Y-m-d');- $subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);+ $subTitle = (string) trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);return view('rules.rule-group.select-transactions', compact('first', 'today', 'ruleGroup', 'subTitle'));}diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.phpindex 6eaaed9634..c532600228 100644--- a/app/Http/Controllers/SearchController.php+++ b/app/Http/Controllers/SearchController.php@@ -46,7 +46,7 @@ class SearchController extends Controller$this->middleware(static function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-search');- app('view')->share('title', (string)trans('firefly.search'));+ app('view')->share('title', (string) trans('firefly.search'));return $next($request);}@@ -68,9 +68,9 @@ class SearchController extends Controllerif (is_array($request->get('search'))) {$fullQuery = '';}- $fullQuery = (string)$fullQuery;- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');- $ruleId = (int)$request->get('rule');+ $fullQuery = (string) $fullQuery;+ $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');+ $ruleId = (int) $request->get('rule');$ruleChanged = false;// find rule, check if query is different, offer to update.@@ -89,7 +89,7 @@ class SearchController extends Controller$query = $searcher->getWordsAsString();$operators = $searcher->getOperators();$invalidOperators = $searcher->getInvalidOperators();- $subTitle = (string)trans('breadcrumbs.search_result', ['query' => $fullQuery]);+ $subTitle = (string) trans('breadcrumbs.search_result', ['query' => $fullQuery]);return view('search.index', compact('query', 'operators', 'page', 'rule', 'fullQuery', 'subTitle', 'ruleId', 'ruleChanged', 'invalidOperators'));}@@ -104,8 +104,8 @@ class SearchController extends Controller*/public function search(Request $request, SearchInterface $searcher): JsonResponse{- $fullQuery = (string)$request->get('query');- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');+ $fullQuery = (string) $request->get('query');+ $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');$searcher->parseQuery($fullQuery);diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.phpindex aabaca5514..5777c8285e 100644--- a/app/Http/Controllers/System/InstallController.php+++ b/app/Http/Controllers/System/InstallController.php@@ -47,8 +47,8 @@ class InstallController extends Controller{use GetConfigurationData;- public const FORBIDDEN_ERROR = 'Internal PHP function "proc_close" is disabled for your installation. Auto-migration is not possible.';public const BASEDIR_ERROR = 'Firefly III cannot execute the upgrade commands. It is not allowed to because of an open_basedir restriction.';+ public const FORBIDDEN_ERROR = 'Internal PHP function "proc_close" is disabled for your installation. Auto-migration is not possible.';public const OTHER_ERROR = 'An unknown error prevented Firefly III from executing the upgrade commands. Sorry.';private string $lastError;private array $upgradeCommands;@@ -127,10 +127,10 @@ class InstallController extends Controllerpublic function index(){// index will set FF3 version.- app('fireflyconfig')->set('ff3_version', (string)config('firefly.version'));+ app('fireflyconfig')->set('ff3_version', (string) config('firefly.version'));// set new DB version.- app('fireflyconfig')->set('db_version', (int)config('firefly.db_version'));+ app('fireflyconfig')->set('db_version', (int) config('firefly.db_version'));return view('install.index');}@@ -142,7 +142,7 @@ class InstallController extends Controller*/public function runCommand(Request $request): JsonResponse{- $requestIndex = (int)$request->get('index');+ $requestIndex = (int) $request->get('index');$response = ['hasNextCommand' => false,'done' => true,diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.phpindex 9381a2dbd3..7d457b9db1 100644--- a/app/Http/Controllers/TagController.php+++ b/app/Http/Controllers/TagController.php@@ -56,7 +56,7 @@ class TagController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.tags'));+ app('view')->share('title', (string) trans('firefly.tags'));app('view')->share('mainTitleIcon', 'fa-tag');$this->attachmentsHelper = app(AttachmentHelperInterface::class);@@ -74,7 +74,7 @@ class TagController extends Controller*/public function create(Request $request){- $subTitle = (string)trans('firefly.new_tag');+ $subTitle = (string) trans('firefly.new_tag');$subTitleIcon = 'fa-tag';// location info:@@ -106,7 +106,7 @@ class TagController extends Controller*/public function delete(Tag $tag){- $subTitle = (string)trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]);+ $subTitle = (string) trans('breadcrumbs.delete_tag', ['tag' => $tag->tag]);// put previous url in session$this->rememberPreviousUri('tags.delete.uri');@@ -126,7 +126,7 @@ class TagController extends Controller$tagName = $tag->tag;$this->repository->destroy($tag);- session()->flash('success', (string)trans('firefly.deleted_tag', ['tag' => $tagName]));+ session()->flash('success', (string) trans('firefly.deleted_tag', ['tag' => $tagName]));app('preferences')->mark();return redirect($this->getPreviousUri('tags.delete.uri'));@@ -141,7 +141,7 @@ class TagController extends Controller*/public function edit(Tag $tag){- $subTitle = (string)trans('firefly.edit_tag', ['tag' => $tag->tag]);+ $subTitle = (string) trans('firefly.edit_tag', ['tag' => $tag->tag]);$subTitleIcon = 'fa-tag';$location = $this->repository->getLocation($tag);@@ -202,20 +202,20 @@ class TagController extends Controller{$tags = $request->get('tags');if (null === $tags || !is_array($tags)) {- session()->flash('info', (string)trans('firefly.select_tags_to_delete'));+ session()->flash('info', (string) trans('firefly.select_tags_to_delete'));return redirect(route('tags.index'));}$count = 0;foreach ($tags as $tagId) {- $tagId = (int)$tagId;+ $tagId = (int) $tagId;$tag = $this->repository->find($tagId);if (null !== $tag) {$this->repository->destroy($tag);$count++;}}- session()->flash('success', (string)trans_choice('firefly.deleted_x_tags', $count));+ session()->flash('success', (string) trans_choice('firefly.deleted_x_tags', $count));return redirect(route('tags.index'));}@@ -235,8 +235,8 @@ class TagController extends Controller{// default values:$subTitleIcon = 'fa-tag';- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$start = $start ?? session('start');$end = $end ?? session('end');$location = $this->repository->getLocation($tag);@@ -278,10 +278,10 @@ class TagController extends Controller{// default values:$subTitleIcon = 'fa-tag';- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$periods = [];- $subTitle = (string)trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);+ $subTitle = (string) trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);$start = $this->repository->firstUseDate($tag) ?? today(config('app.timezone'));$end = $this->repository->lastUseDate($tag) ?? today(config('app.timezone'));$attachments = $this->repository->getAttachments($tag);@@ -313,7 +313,7 @@ class TagController extends Controller$result = $this->repository->store($data);Log::debug('Data after storage', $result->toArray());- session()->flash('success', (string)trans('firefly.created_tag', ['tag' => $data['tag']]));+ session()->flash('success', (string) trans('firefly.created_tag', ['tag' => $data['tag']]));app('preferences')->mark();// store attachment(s):@@ -323,14 +323,14 @@ class TagController extends Controller$this->attachmentsHelper->saveAttachmentsForModel($result, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachmentsHelper->getMessages()->get('attachments')) > 0) {$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments'));}$redirect = redirect($this->getPreviousUri('tags.create.uri'));- if (1 === (int)$request->get('create_another')) {+ if (1 === (int) $request->get('create_another')) {session()->put('tags.create.fromStore', true);@@ -354,7 +354,7 @@ class TagController extends Controller$data = $request->collectTagData();$tag = $this->repository->update($tag, $data);- session()->flash('success', (string)trans('firefly.updated_tag', ['tag' => $data['tag']]));+ session()->flash('success', (string) trans('firefly.updated_tag', ['tag' => $data['tag']]));app('preferences')->mark();// store new attachment(s):@@ -364,14 +364,14 @@ class TagController extends Controller$this->attachmentsHelper->saveAttachmentsForModel($tag, $files);}if (null !== $files && auth()->user()->hasRole('demo')) {- session()->flash('info', (string)trans('firefly.no_att_demo_user'));+ session()->flash('info', (string) trans('firefly.no_att_demo_user'));}if (count($this->attachmentsHelper->getMessages()->get('attachments')) > 0) {$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments'));}$redirect = redirect($this->getPreviousUri('tags.edit.uri'));- if (1 === (int)$request->get('return_to_edit')) {+ if (1 === (int) $request->get('return_to_edit')) {session()->put('tags.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.phpindex d1fbce2a75..326251eed0 100644--- a/app/Http/Controllers/Transaction/BulkController.php+++ b/app/Http/Controllers/Transaction/BulkController.php@@ -55,7 +55,7 @@ class BulkController extends Controller$this->middleware(function ($request, $next) {$this->repository = app(JournalRepositoryInterface::class);- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');return $next($request);@@ -74,7 +74,7 @@ class BulkController extends Controller*/public function edit(array $journals){- $subTitle = (string)trans('firefly.mass_bulk_journals');+ $subTitle = (string) trans('firefly.mass_bulk_journals');$this->rememberPreviousUri('transactions.bulk-edit.uri');@@ -97,16 +97,16 @@ class BulkController extends Controller*/public function update(BulkEditJournalRequest $request){- $journalIds = $request->get('journals');- $journalIds = is_array($journalIds) ? $journalIds : [];- $ignoreCategory = 1 === (int)$request->get('ignore_category');- $ignoreBudget = 1 === (int)$request->get('ignore_budget');- $tagsAction = $request->get('tags_action');+ $journalIds = $request->get('journals');+ $journalIds = is_array($journalIds) ? $journalIds : [];+ $ignoreCategory = 1 === (int) $request->get('ignore_category');+ $ignoreBudget = 1 === (int) $request->get('ignore_budget');+ $tagsAction = $request->get('tags_action');$count = 0;foreach ($journalIds as $journalId) {- $journalId = (int)$journalId;+ $journalId = (int) $journalId;$journal = $this->repository->find($journalId);if (null !== $journal) {$resultA = $this->updateJournalBudget($journal, $ignoreBudget, $request->integer('budget_id'));@@ -118,7 +118,7 @@ class BulkController extends Controller}}app('preferences')->mark();- $request->session()->flash('success', (string)trans_choice('firefly.mass_edited_transactions_success', $count));+ $request->session()->flash('success', (string) trans_choice('firefly.mass_edited_transactions_success', $count));// redirect to previous URL:return redirect($this->getPreviousUri('transactions.bulk-edit.uri'));diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.phpindex b27c139266..6fe58158ac 100644--- a/app/Http/Controllers/Transaction/ConvertController.php+++ b/app/Http/Controllers/Transaction/ConvertController.php@@ -70,7 +70,7 @@ class ConvertController extends Controllerfunction ($request, $next) {$this->repository = app(JournalRepositoryInterface::class);$this->accountRepository = app(AccountRepositoryInterface::class);- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');return $next($request);@@ -103,7 +103,7 @@ class ConvertController extends Controller$groupTitle = $group->title ?? $first->description;$groupArray = $transformer->transformObject($group);- $subTitle = (string)trans('firefly.convert_to_' . $destinationType->type, ['description' => $groupTitle]);+ $subTitle = (string) trans('firefly.convert_to_' . $destinationType->type, ['description' => $groupTitle]);$subTitleIcon = 'fa-exchange';// get a list of asset accounts and liabilities and stuff, in various combinations:@@ -119,7 +119,7 @@ class ConvertController extends Controllerif ($sourceType->type === $destinationType->type) { // cannot convert to its own type.Log::debug('This is already a transaction of the expected type..');- session()->flash('info', (string)trans('firefly.convert_is_already_type_' . $destinationType->type));+ session()->flash('info', (string) trans('firefly.convert_is_already_type_' . $destinationType->type));return redirect(route('transactions.show', [$group->id]));}@@ -156,7 +156,7 @@ class ConvertController extends Controller// group accounts:/** @var Account $account */foreach ($accountList as $account) {- $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');+ $role = (string) $this->accountRepository->getMetaValue($account, 'account_role');$name = $account->name;if ('' === $role) {$role = 'no_account_type';@@ -176,7 +176,7 @@ class ConvertController extends Controller$role = 'revenue_account';}- $key = (string)trans('firefly.opt_group_' . $role);+ $key = (string) trans('firefly.opt_group_' . $role);$grouped[$key][$account->id] = $name;}@@ -197,7 +197,7 @@ class ConvertController extends Controller// group accounts:/** @var Account $account */foreach ($accountList as $account) {- $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');+ $role = (string) $this->accountRepository->getMetaValue($account, 'account_role');$name = $account->name;if ('' === $role) {$role = 'no_account_type';@@ -217,7 +217,7 @@ class ConvertController extends Controller$role = 'expense_account';}- $key = (string)trans('firefly.opt_group_' . $role);+ $key = (string) trans('firefly.opt_group_' . $role);$grouped[$key][$account->id] = $name;}@@ -240,7 +240,7 @@ class ConvertController extends Controller$balance = app('steam')->balance($account, today());$currency = $this->accountRepository->getAccountCurrency($account) ?? $defaultCurrency;$role = 'l_' . $account->accountType->type;- $key = (string)trans('firefly.opt_group_' . $role);+ $key = (string) trans('firefly.opt_group_' . $role);$grouped[$key][$account->id] = $account->name . ' (' . app('amount')->formatAnything($currency, $balance, false) . ')';}@@ -262,12 +262,12 @@ class ConvertController extends Controllerforeach ($accountList as $account) {$balance = app('steam')->balance($account, today());$currency = $this->accountRepository->getAccountCurrency($account) ?? $defaultCurrency;- $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');+ $role = (string) $this->accountRepository->getMetaValue($account, 'account_role');if ('' === $role) {$role = 'no_account_type';}- $key = (string)trans('firefly.opt_group_' . $role);+ $key = (string) trans('firefly.opt_group_' . $role);$grouped[$key][$account->id] = $account->name . ' (' . app('amount')->formatAnything($currency, $balance, false) . ')';}@@ -305,7 +305,7 @@ class ConvertController extends Controller// correct transfers:$group->refresh();- session()->flash('success', (string)trans('firefly.converted_to_' . $destinationType->type));+ session()->flash('success', (string) trans('firefly.converted_to_' . $destinationType->type));event(new UpdatedTransactionGroup($group));return redirect(route('transactions.show', [$group->id]));@@ -332,10 +332,10 @@ class ConvertController extends Controller$destinationName = $data['destination_name'][$journal->id] ?? null;// double check its not an empty string.- $sourceId = '' === $sourceId || null === $sourceId ? null : (int)$sourceId;- $sourceName = '' === $sourceName ? null : (string)$sourceName;- $destinationId = '' === $destinationId || null === $destinationId ? null : (int)$destinationId;- $destinationName = '' === $destinationName ? null : (string)$destinationName;+ $sourceId = '' === $sourceId || null === $sourceId ? null : (int) $sourceId;+ $sourceName = '' === $sourceName ? null : (string) $sourceName;+ $destinationId = '' === $destinationId || null === $destinationId ? null : (int) $destinationId;+ $destinationName = '' === $destinationName ? null : (string) $destinationName;$validSource = $validator->validateSource(['id' => $sourceId, 'name' => $sourceName,]);$validDestination = $validator->validateDestination(['id' => $destinationId, 'name' => $destinationName,]);diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.phpindex f57160fed3..b33530a838 100644--- a/app/Http/Controllers/Transaction/CreateController.php+++ b/app/Http/Controllers/Transaction/CreateController.php@@ -52,7 +52,7 @@ class CreateController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');$this->repository = app(TransactionGroupRepositoryInterface::class);@@ -68,7 +68,7 @@ class CreateController extends Controller*/public function cloneGroup(Request $request): JsonResponse{- $groupId = (int)$request->get('id');+ $groupId = (int) $request->get('id');if (0 !== $groupId) {$group = $this->repository->find($groupId);if (null !== $group) {@@ -105,14 +105,14 @@ class CreateController extends Controller{app('preferences')->mark();- $sourceId = (int)request()->get('source');- $destinationId = (int)request()->get('destination');+ $sourceId = (int) request()->get('source');+ $destinationId = (int) request()->get('destination');/** @var AccountRepositoryInterface $accountRepository */$accountRepository = app(AccountRepositoryInterface::class);$cash = $accountRepository->getCashAccount();$preFilled = session()->has('preFilled') ? session('preFilled') : [];- $subTitle = (string)trans(sprintf('breadcrumbs.create_%s', strtolower((string)$objectType)));+ $subTitle = (string) trans(sprintf('breadcrumbs.create_%s', strtolower((string) $objectType)));$subTitleIcon = 'fa-plus';$optionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;$allowedOpposingTypes = config('firefly.allowed_opposing_types');diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.phpindex 1b01269edb..9941c1e23e 100644--- a/app/Http/Controllers/Transaction/DeleteController.php+++ b/app/Http/Controllers/Transaction/DeleteController.php@@ -32,7 +32,6 @@ use Illuminate\Http\RedirectResponse;use Illuminate\Routing\Redirector;use Log;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;-use URL;/*** Class DeleteController@@ -53,7 +52,7 @@ class DeleteController extends Controller// translations:$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');$this->repository = app(TransactionGroupRepositoryInterface::class);@@ -83,7 +82,7 @@ class DeleteController extends Controllerthrow new NotFoundHttpException;}$objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);- $subTitle = (string)trans('firefly.delete_' . $objectType, ['description' => $group->title ?? $journal->description]);+ $subTitle = (string) trans('firefly.delete_' . $objectType, ['description' => $group->title ?? $journal->description]);$previous = app('steam')->getSafePreviousUrl(route('index'));// put previous url in sessionLog::debug('Will try to remember previous URI');@@ -110,7 +109,7 @@ class DeleteController extends Controllerthrow new NotFoundHttpException;}$objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);- session()->flash('success', (string)trans('firefly.deleted_' . strtolower($objectType), ['description' => $group->title ?? $journal->description]));+ session()->flash('success', (string) trans('firefly.deleted_' . strtolower($objectType), ['description' => $group->title ?? $journal->description]));$this->repository->destroy($group);diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.phpindex fa755c250b..f7351aac60 100644--- a/app/Http/Controllers/Transaction/EditController.php+++ b/app/Http/Controllers/Transaction/EditController.php@@ -49,7 +49,7 @@ class EditController extends Controller$this->middleware(static function ($request, $next) {- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');return $next($request);@@ -71,11 +71,11 @@ class EditController extends Controller}/** @var AccountRepositoryInterface $repository */- $repository = app(AccountRepositoryInterface::class);+ $repository = app(AccountRepositoryInterface::class);$allowedOpposingTypes = config('firefly.allowed_opposing_types');- $accountToTypes = config('firefly.account_to_transaction');- $expectedSourceTypes = config('firefly.expected_source_types');- $allowedSourceDests = config('firefly.source_dests');+ $accountToTypes = config('firefly.account_to_transaction');+ $expectedSourceTypes = config('firefly.expected_source_types');+ $allowedSourceDests = config('firefly.source_dests');//$defaultCurrency = app('amount')->getDefaultCurrency();diff --git a/app/Http/Controllers/Transaction/IndexController.php b/app/Http/Controllers/Transaction/IndexController.phpindex 6ab707baf1..ac222205f0 100644--- a/app/Http/Controllers/Transaction/IndexController.php+++ b/app/Http/Controllers/Transaction/IndexController.php@@ -55,7 +55,7 @@ class IndexController extends Controller$this->middleware(function ($request, $next) {app('view')->share('mainTitleIcon', 'fa-exchange');- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));$this->repository = app(JournalRepositoryInterface::class);@@ -83,8 +83,8 @@ class IndexController extends Controller$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);$types = config('firefly.transactionTypesByType.' . $objectType);- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;if (null === $start) {$start = session('start');$end = session('end');@@ -99,7 +99,7 @@ class IndexController extends Controller$path = route('transactions.index', [$objectType, $start->format('Y-m-d'), $end->format('Y-m-d')]);$startStr = $start->isoFormat($this->monthAndDayFormat);$endStr = $end->isoFormat($this->monthAndDayFormat);- $subTitle = (string)trans(sprintf('firefly.title_%s_between', $objectType), ['start' => $startStr, 'end' => $endStr]);+ $subTitle = (string) trans(sprintf('firefly.title_%s_between', $objectType), ['start' => $startStr, 'end' => $endStr]);$firstJournal = $this->repository->firstNull();$startPeriod = null === $firstJournal ? new Carbon : $firstJournal->date;@@ -136,14 +136,14 @@ class IndexController extends Controller{$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);$types = config('firefly.transactionTypesByType.' . $objectType);- $page = (int)$request->get('page');- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;+ $page = (int) $request->get('page');+ $pageSize = (int) app('preferences')->get('listPageSize', 50)->data;$path = route('transactions.index.all', [$objectType]);$first = $this->repository->firstNull();$start = null === $first ? new Carbon : $first->date;$last = $this->repository->getLast();$end = $last ? $last->date : today(config('app.timezone'));- $subTitle = (string)trans('firefly.all_' . $objectType);+ $subTitle = (string) trans('firefly.all_' . $objectType);/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.phpindex 7f8c3d5c9d..89ae0631c2 100644--- a/app/Http/Controllers/Transaction/LinkController.php+++ b/app/Http/Controllers/Transaction/LinkController.php@@ -34,14 +34,13 @@ use Illuminate\Http\Request;use Illuminate\Routing\Redirector;use Illuminate\View\View;use Log;-use URL;/*** Class LinkController.*/class LinkController extends Controller{- private JournalRepositoryInterface $journalRepository;+ private JournalRepositoryInterface $journalRepository;private LinkTypeRepositoryInterface $repository;/**@@ -55,7 +54,7 @@ class LinkController extends Controller// some useful repositories:$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');$this->journalRepository = app(JournalRepositoryInterface::class);@@ -76,7 +75,7 @@ class LinkController extends Controllerpublic function delete(TransactionJournalLink $link){$subTitleIcon = 'fa-link';- $subTitle = (string)trans('breadcrumbs.delete_journal_link');+ $subTitle = (string) trans('breadcrumbs.delete_journal_link');$this->rememberPreviousUri('journal_links.delete.uri');return view('transactions.links.delete', compact('link', 'subTitle', 'subTitleIcon'));@@ -93,10 +92,10 @@ class LinkController extends Controller{$this->repository->destroyLink($link);- session()->flash('success', (string)trans('firefly.deleted_link'));+ session()->flash('success', (string) trans('firefly.deleted_link'));app('preferences')->mark();- return redirect((string)session('journal_links.delete.uri'));+ return redirect((string) session('journal_links.delete.uri'));}/**@@ -126,7 +125,7 @@ class LinkController extends ControllerLog::debug('We are here (store)');$other = $this->journalRepository->find($linkInfo['transaction_journal_id']);if (null === $other) {- session()->flash('error', (string)trans('firefly.invalid_link_selection'));+ session()->flash('error', (string) trans('firefly.invalid_link_selection'));return redirect(route('transactions.show', [$journal->transaction_group_id]));}@@ -134,19 +133,19 @@ class LinkController extends Controller$alreadyLinked = $this->repository->findLink($journal, $other);if ($other->id === $journal->id) {- session()->flash('error', (string)trans('firefly.journals_link_to_self'));+ session()->flash('error', (string) trans('firefly.journals_link_to_self'));return redirect(route('transactions.show', [$journal->transaction_group_id]));}if ($alreadyLinked) {- session()->flash('error', (string)trans('firefly.journals_error_linked'));+ session()->flash('error', (string) trans('firefly.journals_error_linked'));return redirect(route('transactions.show', [$journal->transaction_group_id]));}Log::debug(sprintf('Journal is %d, opposing is %d', $journal->id, $other->id));$this->repository->storeLink($linkInfo, $other, $journal);- session()->flash('success', (string)trans('firefly.journals_linked'));+ session()->flash('success', (string) trans('firefly.journals_linked'));return redirect(route('transactions.show', [$journal->transaction_group_id]));}@@ -160,7 +159,7 @@ class LinkController extends Controller*/public function switchLink(Request $request){- $linkId = (int)$request->get('id');+ $linkId = (int) $request->get('id');$this->repository->switchLinkById($linkId);return redirect(app('steam')->getSafePreviousUrl());diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.phpindex 5b9fafd21d..541a75e5cb 100644--- a/app/Http/Controllers/Transaction/MassController.php+++ b/app/Http/Controllers/Transaction/MassController.php@@ -61,7 +61,7 @@ class MassController extends Controller$this->middleware(function ($request, $next) {- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');$this->repository = app(JournalRepositoryInterface::class);@@ -79,7 +79,7 @@ class MassController extends Controller*/public function delete(array $journals): IlluminateView{- $subTitle = (string)trans('firefly.mass_delete_journals');+ $subTitle = (string) trans('firefly.mass_delete_journals');// put previous url in session$this->rememberPreviousUri('transactions.mass-delete.uri');@@ -104,15 +104,15 @@ class MassController extends Controllerforeach ($ids as $journalId) {/** @var TransactionJournal $journal */- $journal = $this->repository->find((int)$journalId);- if (null !== $journal && (int)$journalId === $journal->id) {+ $journal = $this->repository->find((int) $journalId);+ if (null !== $journal && (int) $journalId === $journal->id) {$this->repository->destroyJournal($journal);++$count;}}}app('preferences')->mark();- session()->flash('success', (string)trans_choice('firefly.mass_deleted_transactions_success', $count));+ session()->flash('success', (string) trans_choice('firefly.mass_deleted_transactions_success', $count));// redirect to previous URL:return redirect($this->getPreviousUri('transactions.mass-delete.uri'));@@ -127,7 +127,7 @@ class MassController extends Controller*/public function edit(array $journals): IlluminateView{- $subTitle = (string)trans('firefly.mass_edit_journals');+ $subTitle = (string) trans('firefly.mass_edit_journals');/** @var AccountRepositoryInterface $accountRepository */$accountRepository = app(AccountRepositoryInterface::class);@@ -146,7 +146,7 @@ class MassController extends Controller// reverse amountsforeach ($journals as $index => $journal) {- $journals[$index]['amount'] = number_format((float) app('steam')->positive($journal['amount']), $journal['currency_decimal_places'],'.','');+ $journals[$index]['amount'] = number_format((float) app('steam')->positive($journal['amount']), $journal['currency_decimal_places'], '.', '');$journals[$index]['foreign_amount'] = null === $journal['foreign_amount'] ?null : app('steam')->positive($journal['foreign_amount']);}@@ -174,7 +174,7 @@ class MassController extends Controller$count = 0;/** @var string $journalId */foreach ($journalIds as $journalId) {- $integer = (int)$journalId;+ $integer = (int) $journalId;try {$this->updateJournal($integer, $request);$count++;@@ -184,7 +184,7 @@ class MassController extends Controller}app('preferences')->mark();- session()->flash('success', (string)trans_choice('firefly.mass_edited_transactions_success', $count));+ session()->flash('success', (string) trans_choice('firefly.mass_edited_transactions_success', $count));// redirect to previous URL:return redirect($this->getPreviousUri('transactions.mass-edit.uri'));@@ -273,7 +273,7 @@ class MassController extends Controllerreturn null;}- return (string)$value[$journalId];+ return (string) $value[$journalId];}/**@@ -294,6 +294,6 @@ class MassController extends Controllerreturn null;}- return (int)$value[$journalId];+ return (int) $value[$journalId];}}diff --git a/app/Http/Controllers/Transaction/ShowController.php b/app/Http/Controllers/Transaction/ShowController.phpindex 2642bcdf3a..ed1aee98fb 100644--- a/app/Http/Controllers/Transaction/ShowController.php+++ b/app/Http/Controllers/Transaction/ShowController.php@@ -54,7 +54,7 @@ class ShowController extends Controllerfunction ($request, $next) {$this->repository = app(TransactionGroupRepositoryInterface::class);- app('view')->share('title', (string)trans('firefly.transactions'));+ app('view')->share('title', (string) trans('firefly.transactions'));app('view')->share('mainTitleIcon', 'fa-exchange');return $next($request);@@ -89,7 +89,7 @@ class ShowController extends Controllerthrow new FireflyException('This transaction is broken :(.');}- $type = (string)trans(sprintf('firefly.%s', $first->transactionType->type));+ $type = (string) trans(sprintf('firefly.%s', $first->transactionType->type));$title = 1 === $splits ? $first->description : $transactionGroup->title;$subTitle = sprintf('%s: "%s"', $type, $title);diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.phpindex 136a3a3262..341c605609 100644--- a/app/Http/Middleware/Authenticate.php+++ b/app/Http/Middleware/Authenticate.php@@ -98,10 +98,10 @@ class Authenticate/** @noinspection PhpUndefinedMethodInspection *//** @var User $user */$user = $this->auth->authenticate();- if (1 === (int)$user->blocked) {- $message = (string)trans('firefly.block_account_logout');+ if (1 === (int) $user->blocked) {+ $message = (string) trans('firefly.block_account_logout');if ('email_changed' === $user->blocked_code) {- $message = (string)trans('firefly.email_changed_logout');+ $message = (string) trans('firefly.email_changed_logout');}app('session')->flash('logoutMessage', $message);/** @noinspection PhpUndefinedMethodInspection */diff --git a/app/Http/Middleware/Installer.php b/app/Http/Middleware/Installer.phpindex a9184ae5d2..b5f6cee268 100644--- a/app/Http/Middleware/Installer.php+++ b/app/Http/Middleware/Installer.php@@ -145,8 +145,8 @@ class Installerprivate function oldDBVersion(): bool{// older version in config than database?- $configVersion = (int)config('firefly.db_version');- $dbVersion = (int)app('fireflyconfig')->getFresh('db_version', 1)->data;+ $configVersion = (int) config('firefly.db_version');+ $dbVersion = (int) app('fireflyconfig')->getFresh('db_version', 1)->data;if ($configVersion > $dbVersion) {Log::warning(sprintf(@@ -172,8 +172,8 @@ class Installerprivate function oldVersion(): bool{// version compare thing.- $configVersion = (string)config('firefly.version');- $dbVersion = (string)app('fireflyconfig')->getFresh('ff3_version', '1.0')->data;+ $configVersion = (string) config('firefly.version');+ $dbVersion = (string) app('fireflyconfig')->getFresh('ff3_version', '1.0')->data;if (1 === version_compare($configVersion, $dbVersion)) {Log::warning(sprintf(diff --git a/app/Http/Middleware/InterestingMessage.php b/app/Http/Middleware/InterestingMessage.phpindex 074e956bac..508eeb579c 100644--- a/app/Http/Middleware/InterestingMessage.php+++ b/app/Http/Middleware/InterestingMessage.php@@ -102,7 +102,7 @@ class InterestingMessage// send message about newly created transaction group./** @var TransactionGroup $group */- $group = auth()->user()->transactionGroups()->with(['transactionJournals', 'transactionJournals.transactionType'])->find((int)$transactionGroupId);+ $group = auth()->user()->transactionGroups()->with(['transactionJournals', 'transactionJournals.transactionType'])->find((int) $transactionGroupId);if (null === $group) {return;@@ -118,17 +118,17 @@ class InterestingMessage$title = $count > 1 ? $group->title : $journal->description;if ('created' === $message) {session()->flash('success_url', route('transactions.show', [$transactionGroupId]));- session()->flash('success', (string)trans('firefly.stored_journal', ['description' => $title]));+ session()->flash('success', (string) trans('firefly.stored_journal', ['description' => $title]));}if ('updated' === $message) {$type = strtolower($journal->transactionType->type);session()->flash('success_url', route('transactions.show', [$transactionGroupId]));- session()->flash('success', (string)trans(sprintf('firefly.updated_%s', $type), ['description' => $title]));+ session()->flash('success', (string) trans(sprintf('firefly.updated_%s', $type), ['description' => $title]));}if ('no_change' === $message) {$type = strtolower($journal->transactionType->type);session()->flash('warning_url', route('transactions.show', [$transactionGroupId]));- session()->flash('warning', (string)trans(sprintf('firefly.no_changes_%s', $type), ['description' => $title]));+ session()->flash('warning', (string) trans(sprintf('firefly.no_changes_%s', $type), ['description' => $title]));}}@@ -163,13 +163,13 @@ class InterestingMessagereturn;}if ('deleted' === $message) {- session()->flash('success', (string)trans('firefly.account_deleted', ['name' => $account->name]));+ session()->flash('success', (string) trans('firefly.account_deleted', ['name' => $account->name]));}if ('created' === $message) {- session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name]));+ session()->flash('success', (string) trans('firefly.stored_new_account', ['name' => $account->name]));}if ('updated' === $message) {- session()->flash('success', (string)trans('firefly.updated_account', ['name' => $account->name]));+ session()->flash('success', (string) trans('firefly.updated_account', ['name' => $account->name]));}}@@ -204,10 +204,10 @@ class InterestingMessagereturn;}if ('deleted' === $message) {- session()->flash('success', (string)trans('firefly.deleted_bill', ['name' => $bill->name]));+ session()->flash('success', (string) trans('firefly.deleted_bill', ['name' => $bill->name]));}if ('created' === $message) {- session()->flash('success', (string)trans('firefly.stored_new_bill', ['name' => $bill->name]));+ session()->flash('success', (string) trans('firefly.stored_new_bill', ['name' => $bill->name]));}}}diff --git a/app/Http/Middleware/IsDemoUser.php b/app/Http/Middleware/IsDemoUser.phpindex 1ce1bf9647..f3d915530f 100644--- a/app/Http/Middleware/IsDemoUser.php+++ b/app/Http/Middleware/IsDemoUser.php@@ -53,7 +53,7 @@ class IsDemoUser$repository = app(UserRepositoryInterface::class);if ($repository->hasRole($user, 'demo')) {Log::info('User is a demo user.');- $request->session()->flash('info', (string)trans('firefly.not_available_demo_user'));+ $request->session()->flash('info', (string) trans('firefly.not_available_demo_user'));$current = $request->url();$previous = $request->session()->previousUrl();if ($current !== $previous) {diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.phpindex 1d590443b2..45351ff4bf 100644--- a/app/Http/Middleware/Range.php+++ b/app/Http/Middleware/Range.php@@ -113,12 +113,12 @@ class Range}// save some formats:- $monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale);- $dateTimeFormat = (string)trans('config.date_time_js', [], $locale);+ $monthAndDayFormat = (string) trans('config.month_and_day_js', [], $locale);+ $dateTimeFormat = (string) trans('config.date_time_js', [], $locale);$defaultCurrency = app('amount')->getDefaultCurrency();// also format for moment JS:- $madMomentJS = (string)trans('config.month_and_day_moment_js', [], $locale);+ $madMomentJS = (string) trans('config.month_and_day_moment_js', [], $locale);app('view')->share('madMomentJS', $madMomentJS);app('view')->share('monthAndDayFormat', $monthAndDayFormat);diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.phpindex b2c5040815..462c6e7ee0 100644--- a/app/Http/Middleware/SecureHeaders.php+++ b/app/Http/Middleware/SecureHeaders.php@@ -64,8 +64,8 @@ class SecureHeaders$route = $request->route();$customUrl = '';- $authGuard = (string)config('firefly.authentication_guard');- $logoutUrl = (string)config('firefly.custom_logout_url');+ $authGuard = (string) config('firefly.authentication_guard');+ $logoutUrl = (string) config('firefly.custom_logout_url');if ('remote_user_guard' === $authGuard && '' !== $logoutUrl) {$customUrl = $logoutUrl;}@@ -115,8 +115,8 @@ class SecureHeaders*/private function getTrackingScriptSource(): string{- if ('' !== (string)config('firefly.tracker_site_id') && '' !== (string)config('firefly.tracker_url')) {- return (string)config('firefly.tracker_url');+ if ('' !== (string) config('firefly.tracker_site_id') && '' !== (string) config('firefly.tracker_url')) {+ return (string) config('firefly.tracker_url');}return '';diff --git a/app/Http/Middleware/StartFireflySession.php b/app/Http/Middleware/StartFireflySession.phpindex 1b8d974f1c..20d1d7d4e6 100644--- a/app/Http/Middleware/StartFireflySession.php+++ b/app/Http/Middleware/StartFireflySession.php@@ -25,7 +25,6 @@ namespace FireflyIII\Http\Middleware;use Illuminate\Contracts\Session\Session;use Illuminate\Http\Request;use Illuminate\Session\Middleware\StartSession;-use Log;/*** Class StartFireflySession.diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.phpindex 1726357661..022d1a1858 100644--- a/app/Http/Middleware/TrustProxies.php+++ b/app/Http/Middleware/TrustProxies.php@@ -45,6 +45,6 @@ class TrustProxies extends Middleware*/public function __construct(){- $this->proxies = (string)config('firefly.trusted_proxies');+ $this->proxies = (string) config('firefly.trusted_proxies');}}diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.phpindex 9b99deff7b..fd7370e2ba 100644--- a/app/Http/Requests/JournalLinkRequest.php+++ b/app/Http/Requests/JournalLinkRequest.php@@ -44,7 +44,7 @@ class JournalLinkRequest extends FormRequest$return = [];$linkType = $this->get('link_type');$parts = explode('_', $linkType);- $return['link_type_id'] = (int)$parts[0];+ $return['link_type_id'] = (int) $parts[0];$return['transaction_journal_id'] = $this->integer('opposing');$return['notes'] = $this->string('notes');$return['direction'] = $parts[1];diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.phpindex 7ffcddb415..9d481118f6 100644--- a/app/Http/Requests/RecurrenceFormRequest.php+++ b/app/Http/Requests/RecurrenceFormRequest.php@@ -313,16 +313,16 @@ class RecurrenceFormRequest extends FormRequestdefault:throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type')));case 'withdrawal':- $sourceId = (int)$data['source_id'];- $destinationId = (int)$data['withdrawal_destination_id'];+ $sourceId = (int) $data['source_id'];+ $destinationId = (int) $data['withdrawal_destination_id'];break;case 'deposit':- $sourceId = (int)$data['deposit_source_id'];- $destinationId = (int)$data['destination_id'];+ $sourceId = (int) $data['deposit_source_id'];+ $destinationId = (int) $data['destination_id'];break;case 'transfer':- $sourceId = (int)$data['source_id'];- $destinationId = (int)$data['destination_id'];+ $sourceId = (int) $data['source_id'];+ $destinationId = (int) $data['destination_id'];break;}// validate source account.@@ -330,7 +330,7 @@ class RecurrenceFormRequest extends FormRequest// do something with result:if (false === $validSource) {- $message = (string)trans('validation.generic_invalid_source');+ $message = (string) trans('validation.generic_invalid_source');$validator->errors()->add('source_id', $message);$validator->errors()->add('deposit_source_id', $message);@@ -341,7 +341,7 @@ class RecurrenceFormRequest extends FormRequest$validDestination = $accountValidator->validateDestination(['id' => $destinationId,]);// do something with result:if (false === $validDestination) {- $message = (string)trans('validation.generic_invalid_destination');+ $message = (string) trans('validation.generic_invalid_destination');$validator->errors()->add('destination_id', $message);$validator->errors()->add('withdrawal_destination_id', $message);}diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.phpindex b28ea86c46..01ad7ff42a 100644--- a/app/Http/Requests/ReportFormRequest.php+++ b/app/Http/Requests/ReportFormRequest.php@@ -55,7 +55,7 @@ class ReportFormRequest extends FormRequest$collection = new Collection;if (is_array($set)) {foreach ($set as $accountId) {- $account = $repository->find((int)$accountId);+ $account = $repository->find((int) $accountId);if (null !== $account) {$collection->push($account);}@@ -78,7 +78,7 @@ class ReportFormRequest extends FormRequest$collection = new Collection;if (is_array($set)) {foreach ($set as $budgetId) {- $budget = $repository->find((int)$budgetId);+ $budget = $repository->find((int) $budgetId);if (null !== $budget) {$collection->push($budget);}@@ -101,7 +101,7 @@ class ReportFormRequest extends FormRequest$collection = new Collection;if (is_array($set)) {foreach ($set as $categoryId) {- $category = $repository->find((int)$categoryId);+ $category = $repository->find((int) $categoryId);if (null !== $category) {$collection->push($category);}@@ -124,7 +124,7 @@ class ReportFormRequest extends FormRequest$collection = new Collection;if (is_array($set)) {foreach ($set as $accountId) {- $account = $repository->find((int)$accountId);+ $account = $repository->find((int) $accountId);if (null !== $account) {$collection->push($account);}@@ -145,7 +145,7 @@ class ReportFormRequest extends FormRequest{$date = today(config('app.timezone'));$range = $this->get('daterange');- $parts = explode(' - ', (string)$range);+ $parts = explode(' - ', (string) $range);if (2 === count($parts)) {$string = $parts[1];// validate as date@@ -179,7 +179,7 @@ class ReportFormRequest extends FormRequest{$date = today(config('app.timezone'));$range = $this->get('daterange');- $parts = explode(' - ', (string)$range);+ $parts = explode(' - ', (string) $range);if (2 === count($parts)) {$string = $parts[0];// validate as date@@ -223,7 +223,7 @@ class ReportFormRequest extends FormRequest$collection->push($tag);continue;}- $tag = $repository->find((int)$tagTag);+ $tag = $repository->find((int) $tagTag);if (null !== $tag) {$collection->push($tag);}diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.phpindex df558c61d2..640f9ddb8b 100644--- a/app/Http/Requests/RuleFormRequest.php+++ b/app/Http/Requests/RuleFormRequest.php@@ -69,7 +69,7 @@ class RuleFormRequest extends FormRequest$return[] = ['type' => $trigger['type'] ?? 'invalid','value' => $trigger['value'] ?? '',- 'stop_processing' => 1 === (int)$stopProcessing,+ 'stop_processing' => 1 === (int) $stopProcessing,];}}@@ -90,7 +90,7 @@ class RuleFormRequest extends FormRequest$return[] = ['type' => $action['type'] ?? 'invalid','value' => $action['value'] ?? '',- 'stop_processing' => 1 === (int)$stopProcessing,+ 'stop_processing' => 1 === (int) $stopProcessing,];}}