diff --git a/.ci/php-cs-fixer/.php-cs-fixer.php b/.ci/php-cs-fixer/.php-cs-fixer.php
index e701db9232..39da58fb06 100644
--- a/.ci/php-cs-fixer/.php-cs-fixer.php
+++ b/.ci/php-cs-fixer/.php-cs-fixer.php
@@ -22,7 +22,7 @@
$current = __DIR__;
$paths = [
- $current . '/../../app/Api',
+ $current . '/../../app',
// $current . '/../../config',
// $current . '/../../database',
// $current . '/../../routes',
diff --git a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php
index 18f6d6a8e8..a1dcf6c476 100644
--- a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php
+++ b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php
@@ -118,7 +118,7 @@ class CorrectOpeningBalanceCurrencies extends Command
if ((int)$journal->transaction_currency_id !== $currency->id) {
$journal->transaction_currency_id = $currency->id;
$journal->save();
- $count = 1;
+ $count = 1;
}
/** @var Transaction $transaction */
@@ -126,7 +126,7 @@ class CorrectOpeningBalanceCurrencies extends Command
if ($transaction->transaction_currency_id !== $currency->id) {
$transaction->transaction_currency_id = $currency->id;
$transaction->save();
- $count = 1;
+ $count = 1;
}
}
diff --git a/app/Console/Commands/Correction/CreateAccessTokens.php b/app/Console/Commands/Correction/CreateAccessTokens.php
index 3b8692e04f..cf1ec32d0d 100644
--- a/app/Console/Commands/Correction/CreateAccessTokens.php
+++ b/app/Console/Commands/Correction/CreateAccessTokens.php
@@ -37,7 +37,7 @@ class CreateAccessTokens extends Command
protected $description = 'Creates user access tokens which are used for command line access to personal data.';
- protected $signature = 'firefly-iii:create-access-tokens';
+ protected $signature = 'firefly-iii:create-access-tokens';
/**
* Execute the console command.
@@ -50,8 +50,8 @@ class CreateAccessTokens extends Command
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
- $count = 0;
- $users = $repository->all();
+ $count = 0;
+ $users = $repository->all();
/** @var User $user */
foreach ($users as $user) {
diff --git a/app/Console/Commands/Correction/CreateLinkTypes.php b/app/Console/Commands/Correction/CreateLinkTypes.php
index 38dbd4ce6a..dd43d97456 100644
--- a/app/Console/Commands/Correction/CreateLinkTypes.php
+++ b/app/Console/Commands/Correction/CreateLinkTypes.php
@@ -36,7 +36,7 @@ class CreateLinkTypes extends Command
protected $description = 'Creates all link types.';
- protected $signature = 'firefly-iii:create-link-types';
+ protected $signature = 'firefly-iii:create-link-types';
/**
* Execute the console command.
@@ -51,7 +51,7 @@ class CreateLinkTypes extends Command
'Reimbursement' => ['(partially) reimburses', 'is (partially) reimbursed by'],
];
foreach ($set as $name => $values) {
- $link = LinkType::where('name', $name)
+ $link = LinkType::where('name', $name)
->first()
;
if (null === $link) {
diff --git a/app/Console/Commands/Correction/DeleteEmptyGroups.php b/app/Console/Commands/Correction/DeleteEmptyGroups.php
index fb75c35b80..3ba5ea8515 100644
--- a/app/Console/Commands/Correction/DeleteEmptyGroups.php
+++ b/app/Console/Commands/Correction/DeleteEmptyGroups.php
@@ -46,7 +46,7 @@ class DeleteEmptyGroups extends Command
public function handle(): int
{
$groupIds
- = TransactionGroup::leftJoin('transaction_journals', 'transaction_groups.id', '=', 'transaction_journals.transaction_group_id')
+ = TransactionGroup::leftJoin('transaction_journals', 'transaction_groups.id', '=', 'transaction_journals.transaction_group_id')
->whereNull('transaction_journals.id')->get(['transaction_groups.id'])->pluck('id')->toArray()
;
diff --git a/app/Console/Commands/Correction/DeleteEmptyJournals.php b/app/Console/Commands/Correction/DeleteEmptyJournals.php
index 112c24577f..a42fbbfbd0 100644
--- a/app/Console/Commands/Correction/DeleteEmptyJournals.php
+++ b/app/Console/Commands/Correction/DeleteEmptyJournals.php
@@ -38,7 +38,7 @@ class DeleteEmptyJournals extends Command
protected $description = 'Delete empty and uneven transaction journals.';
- protected $signature = 'firefly-iii:delete-empty-journals';
+ protected $signature = 'firefly-iii:delete-empty-journals';
/**
* Execute the console command.
@@ -56,7 +56,7 @@ class DeleteEmptyJournals extends Command
*/
private function deleteUnevenJournals(): void
{
- $set = Transaction::whereNull('deleted_at')
+ $set = Transaction::whereNull('deleted_at')
->groupBy('transactions.transaction_journal_id')
->get([\DB::raw('COUNT(transactions.transaction_journal_id) as the_count'), 'transaction_journal_id']) // @phpstan-ignore-line
;
diff --git a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php
index f039eb0ea6..aacaa23ca3 100644
--- a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php
+++ b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php
@@ -37,7 +37,7 @@ class DeleteOrphanedTransactions extends Command
protected $description = 'Deletes orphaned transactions.';
- protected $signature = 'firefly-iii:delete-orphaned-transactions';
+ protected $signature = 'firefly-iii:delete-orphaned-transactions';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Correction/DeleteZeroAmount.php b/app/Console/Commands/Correction/DeleteZeroAmount.php
index 819c32a011..4e0b86734d 100644
--- a/app/Console/Commands/Correction/DeleteZeroAmount.php
+++ b/app/Console/Commands/Correction/DeleteZeroAmount.php
@@ -37,7 +37,7 @@ class DeleteZeroAmount extends Command
protected $description = 'Delete transactions with zero amount.';
- protected $signature = 'firefly-iii:delete-zero-amount';
+ protected $signature = 'firefly-iii:delete-zero-amount';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Correction/EnableCurrencies.php b/app/Console/Commands/Correction/EnableCurrencies.php
index dc51124b5f..3dbea108e6 100644
--- a/app/Console/Commands/Correction/EnableCurrencies.php
+++ b/app/Console/Commands/Correction/EnableCurrencies.php
@@ -62,17 +62,17 @@ class EnableCurrencies extends Command
private function correctCurrencies(UserGroup $userGroup): void
{
/** @var CurrencyRepositoryInterface $repos */
- $repos = app(CurrencyRepositoryInterface::class);
+ $repos = app(CurrencyRepositoryInterface::class);
// first check if the user has any default currency (not necessarily the case, so can be forced).
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($userGroup);
Log::debug(sprintf('Now correcting currencies for user group #%d', $userGroup->id));
- $found = [$defaultCurrency->id];
+ $found = [$defaultCurrency->id];
// get all meta entries
/** @var Collection $meta */
- $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
+ $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
->where('accounts.user_group_id', $userGroup->id)
->where('account_meta.name', 'currency_id')->groupBy('data')->get(['data'])
;
@@ -81,7 +81,7 @@ class EnableCurrencies extends Command
}
// get all from journals:
- $journals = TransactionJournal::where('user_group_id', $userGroup->id)
+ $journals = TransactionJournal::where('user_group_id', $userGroup->id)
->groupBy('transaction_currency_id')->get(['transaction_currency_id'])
;
foreach ($journals as $entry) {
@@ -89,7 +89,7 @@ class EnableCurrencies extends Command
}
// get all from transactions
- $transactions = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
+ $transactions = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.user_group_id', $userGroup->id)
->groupBy('transactions.transaction_currency_id', 'transactions.foreign_currency_id')
->get(['transactions.transaction_currency_id', 'transactions.foreign_currency_id'])
@@ -100,7 +100,7 @@ class EnableCurrencies extends Command
}
// get all from budget limits
- $limits = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
+ $limits = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
->groupBy('transaction_currency_id')
->get(['budget_limits.transaction_currency_id'])
;
@@ -108,8 +108,8 @@ class EnableCurrencies extends Command
$found[] = $entry->transaction_currency_id;
}
- $found = array_values(array_unique($found));
- $found = array_values(
+ $found = array_values(array_unique($found));
+ $found = array_values(
array_filter(
$found,
static function (int $currencyId) {
@@ -118,7 +118,7 @@ class EnableCurrencies extends Command
)
);
- $valid = new Collection();
+ $valid = new Collection();
/** @var int $currencyId */
foreach ($found as $currencyId) {
@@ -127,7 +127,7 @@ class EnableCurrencies extends Command
$valid->push($currency);
}
}
- $ids = $valid->pluck('id')->toArray();
+ $ids = $valid->pluck('id')->toArray();
Log::debug(sprintf('Found currencies for user group #%d: %s', $userGroup->id, implode(', ', $ids)));
$userGroup->currencies()->sync($ids);
diff --git a/app/Console/Commands/Correction/FixAccountTypes.php b/app/Console/Commands/Correction/FixAccountTypes.php
index e04c73d80d..7713cdab34 100644
--- a/app/Console/Commands/Correction/FixAccountTypes.php
+++ b/app/Console/Commands/Correction/FixAccountTypes.php
@@ -60,7 +60,7 @@ class FixAccountTypes extends Command
$this->expected = config('firefly.source_dests');
$expected = config('firefly.source_dests');
- $query = TransactionJournal::leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
+ $query = TransactionJournal::leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
->leftJoin(
'transactions as source',
static function (JoinClause $join): void {
@@ -94,7 +94,7 @@ class FixAccountTypes extends Command
}
});
- $resultSet = $query->get(
+ $resultSet = $query->get(
[
'transaction_journals.id',
// 'transaction_type_id as type_id',
@@ -138,7 +138,7 @@ class FixAccountTypes extends Command
private function inspectJournal(TransactionJournal $journal): void
{
app('log')->debug(sprintf('Now inspecting journal #%d', $journal->id));
- $transactions = $journal->transactions()->count();
+ $transactions = $journal->transactions()->count();
if (2 !== $transactions) {
app('log')->debug(sprintf('Journal has %d transactions, so can\'t fix.', $transactions));
$this->friendlyError(sprintf('Cannot inspect transaction journal #%d because it has %d transaction(s) instead of 2.', $journal->id, $transactions));
@@ -165,7 +165,7 @@ class FixAccountTypes extends Command
return;
}
- $expectedTypes = $this->expected[$type][$sourceAccountType];
+ $expectedTypes = $this->expected[$type][$sourceAccountType];
if (!in_array($destAccountType, $expectedTypes, true)) {
app('log')->debug(sprintf('[b] Going to fix journal #%d', $journal->id));
$this->fixJournal($journal, $type, $sourceTransaction, $destTransaction);
@@ -187,9 +187,9 @@ class FixAccountTypes extends Command
app('log')->debug(sprintf('Going to fix journal #%d', $journal->id));
++$this->count;
// variables:
- $sourceType = $source->account->accountType->type;
- $destinationType = $dest->account->accountType->type;
- $combination = sprintf('%s%s%s', $transactionType, $source->account->accountType->type, $dest->account->accountType->type);
+ $sourceType = $source->account->accountType->type;
+ $destinationType = $dest->account->accountType->type;
+ $combination = sprintf('%s%s%s', $transactionType, $source->account->accountType->type, $dest->account->accountType->type);
app('log')->debug(sprintf('Combination is "%s"', $combination));
if ($this->shouldBeTransfer($transactionType, $sourceType, $destinationType)) {
@@ -214,9 +214,9 @@ class FixAccountTypes extends Command
}
// transaction has no valid source.
- $validSources = array_keys($this->expected[$transactionType]);
- $canCreateSource = $this->canCreateSource($validSources);
- $hasValidSource = $this->hasValidAccountType($validSources, $sourceType);
+ $validSources = array_keys($this->expected[$transactionType]);
+ $canCreateSource = $this->canCreateSource($validSources);
+ $hasValidSource = $this->hasValidAccountType($validSources, $sourceType);
if (!$hasValidSource && $canCreateSource) {
$this->giveNewRevenue($journal, $source);
@@ -279,7 +279,7 @@ class FixAccountTypes extends Command
$withdrawal = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
$journal->transactionType()->associate($withdrawal);
$journal->save();
- $message = sprintf('Converted transaction #%d from a transfer to a withdrawal.', $journal->id);
+ $message = sprintf('Converted transaction #%d from a transfer to a withdrawal.', $journal->id);
$this->friendlyInfo($message);
app('log')->debug($message);
// check it again:
@@ -329,7 +329,7 @@ class FixAccountTypes extends Command
$oldSource = $source->account;
$source->account()->associate($result);
$source->save();
- $message = sprintf(
+ $message = sprintf(
'Transaction journal #%d, source account changed from #%d ("%s") to #%d ("%s").',
$journal->id,
$oldSource->id,
diff --git a/app/Console/Commands/Correction/FixFrontpageAccounts.php b/app/Console/Commands/Correction/FixFrontpageAccounts.php
index 9b39416eec..66c9348504 100644
--- a/app/Console/Commands/Correction/FixFrontpageAccounts.php
+++ b/app/Console/Commands/Correction/FixFrontpageAccounts.php
@@ -62,7 +62,7 @@ class FixFrontpageAccounts extends Command
private function fixPreference(Preference $preference): void
{
- $fixed = [];
+ $fixed = [];
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
@@ -70,7 +70,7 @@ class FixFrontpageAccounts extends Command
return;
}
$repository->setUser($preference->user);
- $data = $preference->data;
+ $data = $preference->data;
if (is_array($data)) {
/** @var string $accountId */
foreach ($data as $accountId) {
diff --git a/app/Console/Commands/Correction/FixGroupAccounts.php b/app/Console/Commands/Correction/FixGroupAccounts.php
index 24c4233e1c..51847ce2c0 100644
--- a/app/Console/Commands/Correction/FixGroupAccounts.php
+++ b/app/Console/Commands/Correction/FixGroupAccounts.php
@@ -46,8 +46,8 @@ class FixGroupAccounts extends Command
*/
public function handle(): int
{
- $groups = [];
- $res = TransactionJournal::groupBy('transaction_group_id')
+ $groups = [];
+ $res = TransactionJournal::groupBy('transaction_group_id')
->get(['transaction_group_id', \DB::raw('COUNT(transaction_group_id) as the_count')])// @phpstan-ignore-line
;
diff --git a/app/Console/Commands/Correction/FixIbans.php b/app/Console/Commands/Correction/FixIbans.php
index 4e8601b2d9..27e79a1c5b 100644
--- a/app/Console/Commands/Correction/FixIbans.php
+++ b/app/Console/Commands/Correction/FixIbans.php
@@ -39,7 +39,7 @@ class FixIbans extends Command
protected $description = 'Removes spaces from IBANs';
protected $signature = 'firefly-iii:fix-ibans';
- private int $count = 0;
+ private int $count = 0;
/**
* Execute the console command.
@@ -79,13 +79,13 @@ class FixIbans extends Command
/** @var Account $account */
foreach ($accounts as $account) {
- $userId = $account->user_id;
+ $userId = $account->user_id;
$set[$userId] ??= [];
- $iban = (string)$account->iban;
+ $iban = (string)$account->iban;
if ('' === $iban) {
continue;
}
- $type = $account->accountType->type;
+ $type = $account->accountType->type;
if (in_array($type, [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], true)) {
$type = 'liabilities';
}
diff --git a/app/Console/Commands/Correction/FixLongDescriptions.php b/app/Console/Commands/Correction/FixLongDescriptions.php
index 2b52327156..6830dd40e9 100644
--- a/app/Console/Commands/Correction/FixLongDescriptions.php
+++ b/app/Console/Commands/Correction/FixLongDescriptions.php
@@ -37,8 +37,8 @@ class FixLongDescriptions extends Command
use ShowsFriendlyMessages;
private const int MAX_LENGTH = 1000;
- protected $description = 'Fixes long descriptions in journals and groups.';
- protected $signature = 'firefly-iii:fix-long-descriptions';
+ protected $description = 'Fixes long descriptions in journals and groups.';
+ protected $signature = 'firefly-iii:fix-long-descriptions';
/**
* Execute the console command.
@@ -58,7 +58,7 @@ class FixLongDescriptions extends Command
}
}
- $groups = TransactionGroup::get(['id', 'title']);
+ $groups = TransactionGroup::get(['id', 'title']);
/** @var TransactionGroup $group */
foreach ($groups as $group) {
diff --git a/app/Console/Commands/Correction/FixRecurringTransactions.php b/app/Console/Commands/Correction/FixRecurringTransactions.php
index 202d67c9a4..a7c3e70bb3 100644
--- a/app/Console/Commands/Correction/FixRecurringTransactions.php
+++ b/app/Console/Commands/Correction/FixRecurringTransactions.php
@@ -40,9 +40,9 @@ class FixRecurringTransactions extends Command
{
use ShowsFriendlyMessages;
- protected $description = 'Fixes recurring transactions with the wrong transaction type.';
- protected $signature = 'firefly-iii:fix-recurring-transactions';
- private int $count = 0;
+ protected $description = 'Fixes recurring transactions with the wrong transaction type.';
+ protected $signature = 'firefly-iii:fix-recurring-transactions';
+ private int $count = 0;
private RecurringRepositoryInterface $recurringRepos;
private UserRepositoryInterface $userRepos;
diff --git a/app/Console/Commands/Correction/FixTransactionTypes.php b/app/Console/Commands/Correction/FixTransactionTypes.php
index 107329a141..a5bcfb9e15 100644
--- a/app/Console/Commands/Correction/FixTransactionTypes.php
+++ b/app/Console/Commands/Correction/FixTransactionTypes.php
@@ -80,7 +80,7 @@ class FixTransactionTypes extends Command
private function fixJournal(TransactionJournal $journal): bool
{
- $type = $journal->transactionType->type;
+ $type = $journal->transactionType->type;
try {
$source = $this->getSourceAccount($journal);
@@ -115,7 +115,7 @@ class FixTransactionTypes extends Command
*/
private function getSourceAccount(TransactionJournal $journal): Account
{
- $collection = $journal->transactions->filter(
+ $collection = $journal->transactions->filter(
static function (Transaction $transaction) {
return $transaction->amount < 0;
}
@@ -131,7 +131,7 @@ class FixTransactionTypes extends Command
$transaction = $collection->first();
/** @var null|Account $account */
- $account = $transaction->account;
+ $account = $transaction->account;
if (null === $account) {
throw new FireflyException(sprintf('300003: Journal #%d, transaction #%d has no source account.', $journal->id, $transaction->id));
}
@@ -144,7 +144,7 @@ class FixTransactionTypes extends Command
*/
private function getDestinationAccount(TransactionJournal $journal): Account
{
- $collection = $journal->transactions->filter(
+ $collection = $journal->transactions->filter(
static function (Transaction $transaction) {
return $transaction->amount > 0;
}
@@ -160,7 +160,7 @@ class FixTransactionTypes extends Command
$transaction = $collection->first();
/** @var null|Account $account */
- $account = $transaction->account;
+ $account = $transaction->account;
if (null === $account) {
throw new FireflyException(sprintf('300006: Journal #%d, transaction #%d has no destination account.', $journal->id, $transaction->id));
}
diff --git a/app/Console/Commands/Correction/FixUnevenAmount.php b/app/Console/Commands/Correction/FixUnevenAmount.php
index 080de0b7d9..608a3ea32c 100644
--- a/app/Console/Commands/Correction/FixUnevenAmount.php
+++ b/app/Console/Commands/Correction/FixUnevenAmount.php
@@ -100,13 +100,13 @@ class FixUnevenAmount extends Command
private function fixJournal(int $param): void
{
// one of the transactions is bad.
- $journal = TransactionJournal::find($param);
+ $journal = TransactionJournal::find($param);
if (null === $journal) {
return;
}
/** @var null|Transaction $source */
- $source = $journal->transactions()->where('amount', '<', 0)->first();
+ $source = $journal->transactions()->where('amount', '<', 0)->first();
if (null === $source) {
$this->friendlyError(
@@ -122,11 +122,11 @@ class FixUnevenAmount extends Command
return;
}
- $amount = bcmul('-1', $source->amount);
+ $amount = bcmul('-1', $source->amount);
// fix amount of destination:
/** @var null|Transaction $destination */
- $destination = $journal->transactions()->where('amount', '>', 0)->first();
+ $destination = $journal->transactions()->where('amount', '>', 0)->first();
if (null === $destination) {
$this->friendlyError(
@@ -146,7 +146,7 @@ class FixUnevenAmount extends Command
$destination->amount = $amount;
$destination->save();
- $message = sprintf('Corrected amount in transaction journal #%d', $param);
+ $message = sprintf('Corrected amount in transaction journal #%d', $param);
$this->friendlyInfo($message);
}
}
diff --git a/app/Console/Commands/Correction/RemoveBills.php b/app/Console/Commands/Correction/RemoveBills.php
index d3fd0f87f1..e4dd225720 100644
--- a/app/Console/Commands/Correction/RemoveBills.php
+++ b/app/Console/Commands/Correction/RemoveBills.php
@@ -48,7 +48,7 @@ class RemoveBills extends Command
if (null === $withdrawal) {
return 0;
}
- $journals = TransactionJournal::whereNotNull('bill_id')->where('transaction_type_id', '!=', $withdrawal->id)->get();
+ $journals = TransactionJournal::whereNotNull('bill_id')->where('transaction_type_id', '!=', $withdrawal->id)->get();
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
diff --git a/app/Console/Commands/Correction/RenameMetaFields.php b/app/Console/Commands/Correction/RenameMetaFields.php
index 09ee5aa4e6..e25c333e16 100644
--- a/app/Console/Commands/Correction/RenameMetaFields.php
+++ b/app/Console/Commands/Correction/RenameMetaFields.php
@@ -36,7 +36,7 @@ class RenameMetaFields extends Command
protected $description = 'Rename changed meta fields.';
protected $signature = 'firefly-iii:rename-meta-fields';
- private int $count = 0;
+ private int $count = 0;
/**
* Execute the console command.
@@ -72,7 +72,7 @@ class RenameMetaFields extends Command
private function rename(string $original, string $update): void
{
- $total = \DB::table('journal_meta')
+ $total = \DB::table('journal_meta')
->where('name', '=', $original)
->update(['name' => $update])
;
diff --git a/app/Console/Commands/Export/ExportData.php b/app/Console/Commands/Export/ExportData.php
index 0e12413de4..4e0ba1731a 100644
--- a/app/Console/Commands/Export/ExportData.php
+++ b/app/Console/Commands/Export/ExportData.php
@@ -46,7 +46,7 @@ class ExportData extends Command
protected $description = 'Command to export data from Firefly III.';
- protected $signature = 'firefly-iii:export-data
+ protected $signature = 'firefly-iii:export-data
{--user=1 : The user ID that the export should run for.}
{--token= : The user\'s access token.}
{--start= : First transaction to export. Defaults to your very first transaction. Only applies to transaction export.}
@@ -81,7 +81,7 @@ class ExportData extends Command
}
// set up repositories.
$this->stupidLaravel();
- $user = $this->getUser();
+ $user = $this->getUser();
$this->journalRepository->setUser($user);
$this->accountRepository->setUser($user);
@@ -96,7 +96,7 @@ class ExportData extends Command
// make export object and configure it.
/** @var ExportDataGenerator $exporter */
- $exporter = app(ExportDataGenerator::class);
+ $exporter = app(ExportDataGenerator::class);
$exporter->setUser($user);
$exporter->setStart($options['start']);
@@ -111,7 +111,7 @@ class ExportData extends Command
$exporter->setExportRules($options['export']['rules']);
$exporter->setExportBills($options['export']['bills']);
$exporter->setExportPiggies($options['export']['piggies']);
- $data = $exporter->export();
+ $data = $exporter->export();
if (0 === count($data)) {
$this->friendlyError('You must export *something*. Use --export-transactions or another option. See docs.firefly-iii.org');
}
diff --git a/app/Console/Commands/Integrity/CreateGroupMemberships.php b/app/Console/Commands/Integrity/CreateGroupMemberships.php
index cee66c6ce2..e6ed94773d 100644
--- a/app/Console/Commands/Integrity/CreateGroupMemberships.php
+++ b/app/Console/Commands/Integrity/CreateGroupMemberships.php
@@ -41,8 +41,8 @@ class CreateGroupMemberships extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '560_create_group_memberships';
- protected $description = 'Update group memberships';
- protected $signature = 'firefly-iii:create-group-memberships';
+ protected $description = 'Update group memberships';
+ protected $signature = 'firefly-iii:create-group-memberships';
/**
* Execute the console command.
@@ -65,12 +65,12 @@ class CreateGroupMemberships extends Command
public static function createGroupMembership(User $user): void
{
// check if membership exists
- $userGroup = UserGroup::where('title', $user->email)->first();
+ $userGroup = UserGroup::where('title', $user->email)->first();
if (null === $userGroup) {
$userGroup = UserGroup::create(['title' => $user->email]);
}
- $userRole = UserRole::where('title', UserRoleEnum::OWNER->value)->first();
+ $userRole = UserRole::where('title', UserRoleEnum::OWNER->value)->first();
if (null === $userRole) {
throw new FireflyException('Firefly III could not find a user role. Please make sure all migrations have run.');
diff --git a/app/Console/Commands/Integrity/ReportEmptyObjects.php b/app/Console/Commands/Integrity/ReportEmptyObjects.php
index 7f7524f4de..1aa793c763 100644
--- a/app/Console/Commands/Integrity/ReportEmptyObjects.php
+++ b/app/Console/Commands/Integrity/ReportEmptyObjects.php
@@ -39,7 +39,7 @@ class ReportEmptyObjects extends Command
protected $description = 'Reports on empty database objects.';
- protected $signature = 'firefly-iii:report-empty-objects';
+ protected $signature = 'firefly-iii:report-empty-objects';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Integrity/ReportIntegrity.php b/app/Console/Commands/Integrity/ReportIntegrity.php
index 9ec1eb8243..5d4d48064e 100644
--- a/app/Console/Commands/Integrity/ReportIntegrity.php
+++ b/app/Console/Commands/Integrity/ReportIntegrity.php
@@ -35,7 +35,7 @@ class ReportIntegrity extends Command
protected $description = 'Will report on the integrity of your database.';
- protected $signature = 'firefly-iii:report-integrity';
+ protected $signature = 'firefly-iii:report-integrity';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Integrity/UpdateGroupInformation.php b/app/Console/Commands/Integrity/UpdateGroupInformation.php
index 24c11715b7..e3e8c5eaef 100644
--- a/app/Console/Commands/Integrity/UpdateGroupInformation.php
+++ b/app/Console/Commands/Integrity/UpdateGroupInformation.php
@@ -83,7 +83,7 @@ class UpdateGroupInformation extends Command
return;
}
- $set = [
+ $set = [
Account::class,
Attachment::class,
AvailableBudget::class,
diff --git a/app/Console/Commands/System/CreateDatabase.php b/app/Console/Commands/System/CreateDatabase.php
index 345cf108a7..64b1c65895 100644
--- a/app/Console/Commands/System/CreateDatabase.php
+++ b/app/Console/Commands/System/CreateDatabase.php
@@ -37,7 +37,7 @@ class CreateDatabase extends Command
protected $description = 'Tries to create the database if it doesn\'t exist yet.';
- protected $signature = 'firefly-iii:create-database';
+ protected $signature = 'firefly-iii:create-database';
/**
* Execute the console command.
@@ -52,8 +52,8 @@ class CreateDatabase extends Command
return 0;
}
// try to set up a raw connection:
- $exists = false;
- $dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', env('DB_HOST', 'localhost'), env('DB_PORT', '3306'));
+ $exists = false;
+ $dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', env('DB_HOST', 'localhost'), env('DB_PORT', '3306'));
if ('' !== env('DB_SOCKET', '')) {
$dsn = sprintf('mysql:unix_socket=%s;charset=utf8mb4', env('DB_SOCKET', ''));
@@ -78,7 +78,7 @@ class CreateDatabase extends Command
// only continue when no error.
// with PDO, try to list DB's (
/** @var array $stmt */
- $stmt = $pdo->query('SHOW DATABASES;');
+ $stmt = $pdo->query('SHOW DATABASES;');
// slightly more complex but less error-prone.
foreach ($stmt as $row) {
$name = $row['Database'] ?? false;
diff --git a/app/Console/Commands/System/CreateFirstUser.php b/app/Console/Commands/System/CreateFirstUser.php
index 7f7a0e32b7..8a4d5dc882 100644
--- a/app/Console/Commands/System/CreateFirstUser.php
+++ b/app/Console/Commands/System/CreateFirstUser.php
@@ -38,7 +38,7 @@ class CreateFirstUser extends Command
protected $description = 'Creates a new user and gives admin rights. Outputs the password on the command line. Strictly for testing.';
- protected $signature = 'firefly-iii:create-first-user {email}';
+ protected $signature = 'firefly-iii:create-first-user {email}';
private UserRepositoryInterface $repository;
/**
@@ -52,7 +52,7 @@ class CreateFirstUser extends Command
return 1;
}
$this->stupidLaravel();
- $count = $this->repository->count();
+ $count = $this->repository->count();
if ($count > 0) {
$this->friendlyError('Already have more than zero users in DB.');
diff --git a/app/Console/Commands/System/ForceDecimalSize.php b/app/Console/Commands/System/ForceDecimalSize.php
index c7be65a7a7..383f004554 100644
--- a/app/Console/Commands/System/ForceDecimalSize.php
+++ b/app/Console/Commands/System/ForceDecimalSize.php
@@ -53,8 +53,8 @@ class ForceDecimalSize extends Command
{
use ShowsFriendlyMessages;
- protected $description = 'This command resizes DECIMAL columns in MySQL or PostgreSQL and correct amounts (only MySQL).';
- protected $signature = 'firefly-iii:force-decimal-size';
+ protected $description = 'This command resizes DECIMAL columns in MySQL or PostgreSQL and correct amounts (only MySQL).';
+ protected $signature = 'firefly-iii:force-decimal-size';
private string $cast;
private array $classes
= [
@@ -73,7 +73,7 @@ class ForceDecimalSize extends Command
private string $operator;
private string $regularExpression;
private array $tables
- = [
+ = [
'accounts' => ['virtual_balance'],
'auto_budgets' => ['amount'],
'available_budgets' => ['amount'],
@@ -233,7 +233,7 @@ class ForceDecimalSize extends Command
$regularExpression = $this->regularExpression;
/** @var Builder $query */
- $query = Account::leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
+ $query = Account::leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string)$currency->id))
;
@@ -246,7 +246,7 @@ class ForceDecimalSize extends Command
);
}
});
- $result = $query->get(['accounts.*']);
+ $result = $query->get(['accounts.*']);
if (0 === $result->count()) {
$this->friendlyPositive(sprintf('All accounts in %s are OK', $currency->code));
@@ -257,7 +257,7 @@ class ForceDecimalSize extends Command
foreach ($result as $account) {
/** @var string $field */
foreach ($fields as $field) {
- $value = $account->{$field};
+ $value = $account->{$field};
if (null === $value) {
continue;
}
@@ -282,7 +282,7 @@ class ForceDecimalSize extends Command
$regularExpression = $this->regularExpression;
/** @var Builder $query */
- $query = $class::where('transaction_currency_id', $currency->id)->where(
+ $query = $class::where('transaction_currency_id', $currency->id)->where(
static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
/** @var string $field */
foreach ($fields as $field) {
@@ -295,7 +295,7 @@ class ForceDecimalSize extends Command
}
);
- $result = $query->get(['*']);
+ $result = $query->get(['*']);
if (0 === $result->count()) {
$this->friendlyPositive(sprintf('All %s in %s are OK', $table, $currency->code));
@@ -306,7 +306,7 @@ class ForceDecimalSize extends Command
foreach ($result as $item) {
/** @var string $field */
foreach ($fields as $field) {
- $value = $item->{$field};
+ $value = $item->{$field};
if (null === $value) {
continue;
}
@@ -329,7 +329,7 @@ class ForceDecimalSize extends Command
$regularExpression = $this->regularExpression;
/** @var Builder $query */
- $query = PiggyBankEvent::leftJoin('piggy_banks', 'piggy_bank_events.piggy_bank_id', '=', 'piggy_banks.id')
+ $query = PiggyBankEvent::leftJoin('piggy_banks', 'piggy_bank_events.piggy_bank_id', '=', 'piggy_banks.id')
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id')
@@ -345,7 +345,7 @@ class ForceDecimalSize extends Command
})
;
- $result = $query->get(['piggy_bank_events.*']);
+ $result = $query->get(['piggy_bank_events.*']);
if (0 === $result->count()) {
$this->friendlyPositive(sprintf('All piggy bank events in %s are OK', $currency->code));
@@ -356,7 +356,7 @@ class ForceDecimalSize extends Command
foreach ($result as $item) {
/** @var string $field */
foreach ($fields as $field) {
- $value = $item->{$field};
+ $value = $item->{$field};
if (null === $value) {
continue;
}
@@ -382,7 +382,7 @@ class ForceDecimalSize extends Command
// select all piggy bank repetitions with this currency and issue.
/** @var Builder $query */
- $query = PiggyBankRepetition::leftJoin('piggy_banks', 'piggy_bank_repetitions.piggy_bank_id', '=', 'piggy_banks.id')
+ $query = PiggyBankRepetition::leftJoin('piggy_banks', 'piggy_bank_repetitions.piggy_bank_id', '=', 'piggy_banks.id')
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id')
@@ -398,7 +398,7 @@ class ForceDecimalSize extends Command
})
;
- $result = $query->get(['piggy_bank_repetitions.*']);
+ $result = $query->get(['piggy_bank_repetitions.*']);
if (0 === $result->count()) {
$this->friendlyPositive(sprintf('All piggy bank repetitions in %s', $currency->code));
@@ -409,7 +409,7 @@ class ForceDecimalSize extends Command
foreach ($result as $item) {
/** @var string $field */
foreach ($fields as $field) {
- $value = $item->{$field};
+ $value = $item->{$field};
if (null === $value) {
continue;
}
@@ -434,7 +434,7 @@ class ForceDecimalSize extends Command
$regularExpression = $this->regularExpression;
/** @var Builder $query */
- $query = PiggyBank::leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
+ $query = PiggyBank::leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string)$currency->id))
@@ -449,7 +449,7 @@ class ForceDecimalSize extends Command
})
;
- $result = $query->get(['piggy_banks.*']);
+ $result = $query->get(['piggy_banks.*']);
if (0 === $result->count()) {
$this->friendlyPositive(sprintf('All piggy banks in %s are OK', $currency->code));
@@ -460,7 +460,7 @@ class ForceDecimalSize extends Command
foreach ($result as $item) {
/** @var string $field */
foreach ($fields as $field) {
- $value = $item->{$field};
+ $value = $item->{$field};
if (null === $value) {
continue;
}
@@ -480,7 +480,7 @@ class ForceDecimalSize extends Command
{
// select all transactions with this currency and issue.
/** @var Builder $query */
- $query = Transaction::where('transaction_currency_id', $currency->id)->where(
+ $query = Transaction::where('transaction_currency_id', $currency->id)->where(
DB::raw(sprintf('CAST(amount as %s)', $this->cast)), // @phpstan-ignore-line
$this->operator,
DB::raw(sprintf($this->regularExpression, $currency->decimal_places))
@@ -493,7 +493,7 @@ class ForceDecimalSize extends Command
/** @var Transaction $item */
foreach ($result as $item) {
- $value = $item->amount;
+ $value = $item->amount;
if ('' === $value) {
continue;
}
@@ -506,7 +506,7 @@ class ForceDecimalSize extends Command
// select all transactions with this FOREIGN currency and issue.
/** @var Builder $query */
- $query = Transaction::where('foreign_currency_id', $currency->id)->where(
+ $query = Transaction::where('foreign_currency_id', $currency->id)->where(
DB::raw(sprintf('CAST(foreign_amount as %s)', $this->cast)), // @phpstan-ignore-line
$this->operator,
DB::raw(sprintf($this->regularExpression, $currency->decimal_places))
@@ -521,7 +521,7 @@ class ForceDecimalSize extends Command
/** @var Transaction $item */
foreach ($result as $item) {
- $value = $item->foreign_amount;
+ $value = $item->foreign_amount;
if (null === $value) {
continue;
}
diff --git a/app/Console/Commands/System/ForceMigration.php b/app/Console/Commands/System/ForceMigration.php
index 26a3b0043b..5e63b0764e 100644
--- a/app/Console/Commands/System/ForceMigration.php
+++ b/app/Console/Commands/System/ForceMigration.php
@@ -42,7 +42,7 @@ class ForceMigration extends Command
protected $description = 'This command will force-run all database migrations.';
- protected $signature = 'firefly-iii:force-migrations
+ protected $signature = 'firefly-iii:force-migrations
{--user=1 : The user ID.}
{--token= : The user\'s access token.}';
diff --git a/app/Console/Commands/System/OutputVersion.php b/app/Console/Commands/System/OutputVersion.php
index 3e225bcf08..88835900b8 100644
--- a/app/Console/Commands/System/OutputVersion.php
+++ b/app/Console/Commands/System/OutputVersion.php
@@ -33,7 +33,7 @@ class OutputVersion extends Command
{
protected $description = 'Outputs the Firefly III version';
- protected $signature = 'firefly-iii:output-version';
+ protected $signature = 'firefly-iii:output-version';
/**
* Execute the console command.
diff --git a/app/Console/Commands/System/ScanAttachments.php b/app/Console/Commands/System/ScanAttachments.php
index 4b0478e5ca..65e2d7964a 100644
--- a/app/Console/Commands/System/ScanAttachments.php
+++ b/app/Console/Commands/System/ScanAttachments.php
@@ -37,7 +37,7 @@ class ScanAttachments extends Command
protected $description = 'Rescan all attachments and re-set the correct MD5 hash and mime.';
- protected $signature = 'firefly-iii:scan-attachments';
+ protected $signature = 'firefly-iii:scan-attachments';
/**
* Execute the console command.
@@ -63,7 +63,7 @@ class ScanAttachments extends Command
app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$decryptedContent = $encryptedContent;
}
- $tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');
+ $tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');
if (false === $tempFileName) {
app('log')->error(sprintf('Could not create temporary file for attachment #%d', $attachment->id));
diff --git a/app/Console/Commands/System/SetLatestVersion.php b/app/Console/Commands/System/SetLatestVersion.php
index cefca2427c..71889bd0b0 100644
--- a/app/Console/Commands/System/SetLatestVersion.php
+++ b/app/Console/Commands/System/SetLatestVersion.php
@@ -36,7 +36,7 @@ class SetLatestVersion extends Command
protected $description = 'Set latest version in DB.';
- protected $signature = 'firefly-iii:set-latest-version {--james-is-cool}';
+ protected $signature = 'firefly-iii:set-latest-version {--james-is-cool}';
/**
* Execute the console command.
diff --git a/app/Console/Commands/System/UpgradeFireflyInstructions.php b/app/Console/Commands/System/UpgradeFireflyInstructions.php
index 0b209f4407..24fe129742 100644
--- a/app/Console/Commands/System/UpgradeFireflyInstructions.php
+++ b/app/Console/Commands/System/UpgradeFireflyInstructions.php
@@ -35,7 +35,7 @@ class UpgradeFireflyInstructions extends Command
protected $description = 'Instructions in case of upgrade trouble.';
- protected $signature = 'firefly:instructions {task}';
+ protected $signature = 'firefly:instructions {task}';
/**
* Execute the console command.
@@ -61,8 +61,8 @@ class UpgradeFireflyInstructions extends Command
$version = (string)config('firefly.version');
/** @var array $config */
- $config = config('upgrade.text.upgrade');
- $text = '';
+ $config = config('upgrade.text.upgrade');
+ $text = '';
/** @var string $compare */
foreach (array_keys($config) as $compare) {
@@ -99,8 +99,8 @@ class UpgradeFireflyInstructions extends Command
*/
private function showLogo(): void
{
- $today = date('m-d');
- $month = date('m');
+ $today = date('m-d');
+ $month = date('m');
// variation in colors and effects just because I can!
// default is Ukraine flag:
$colors = ['blue', 'blue', 'blue', 'yellow', 'yellow', 'yellow', 'default', 'default'];
@@ -171,8 +171,8 @@ class UpgradeFireflyInstructions extends Command
$version = (string)config('firefly.version');
/** @var array $config */
- $config = config('upgrade.text.install');
- $text = '';
+ $config = config('upgrade.text.install');
+ $text = '';
/** @var string $compare */
foreach (array_keys($config) as $compare) {
diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php
index cbfdab3512..aa60146808 100644
--- a/app/Console/Commands/System/VerifySecurityAlerts.php
+++ b/app/Console/Commands/System/VerifySecurityAlerts.php
@@ -38,7 +38,7 @@ class VerifySecurityAlerts extends Command
protected $description = 'Verify security alerts';
- protected $signature = 'firefly-iii:verify-security-alerts';
+ protected $signature = 'firefly-iii:verify-security-alerts';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php
index 3f78585b94..ee108f678a 100644
--- a/app/Console/Commands/Tools/ApplyRules.php
+++ b/app/Console/Commands/Tools/ApplyRules.php
@@ -50,7 +50,7 @@ class ApplyRules extends Command
protected $description = 'This command will apply your rules and rule groups on a selection of your transactions.';
protected $signature
- = 'firefly-iii:apply-rules
+ = 'firefly-iii:apply-rules
{--user=1 : The user ID.}
{--token= : The user\'s access token.}
{--accounts= : A comma-separated list of asset accounts or liabilities to apply your rules to.}
@@ -77,7 +77,7 @@ class ApplyRules extends Command
*/
public function handle(): int
{
- $start = microtime(true);
+ $start = microtime(true);
$this->stupidLaravel();
if (!$this->verifyAccessToken()) {
$this->friendlyError('Invalid access token.');
@@ -89,19 +89,19 @@ class ApplyRules extends Command
$this->ruleRepository->setUser($this->getUser());
$this->ruleGroupRepository->setUser($this->getUser());
- $result = $this->verifyInput();
+ $result = $this->verifyInput();
if (false === $result) {
return 1;
}
- $this->allRules = $this->option('all_rules');
+ $this->allRules = $this->option('all_rules');
// always get all the rules of the user.
$this->grabAllRules();
// loop all groups and rules and indicate if they're included:
- $rulesToApply = $this->getRulesToApply();
- $count = $rulesToApply->count();
+ $rulesToApply = $this->getRulesToApply();
+ $count = $rulesToApply->count();
if (0 === $count) {
$this->friendlyError('No rules or rule groups have been included.');
$this->friendlyWarning('Make a selection using:');
@@ -114,7 +114,7 @@ class ApplyRules extends Command
// create new rule engine:
/** @var RuleEngineInterface $ruleEngine */
- $ruleEngine = app(RuleEngineInterface::class);
+ $ruleEngine = app(RuleEngineInterface::class);
$ruleEngine->setRules($rulesToApply);
$ruleEngine->setUser($this->getUser());
@@ -123,7 +123,7 @@ class ApplyRules extends Command
foreach ($this->accounts as $account) {
$filterAccountList[] = $account->id;
}
- $list = implode(',', $filterAccountList);
+ $list = implode(',', $filterAccountList);
$ruleEngine->addOperator(['type' => 'account_id', 'value' => $list]);
// add the date as a filter:
@@ -137,7 +137,7 @@ class ApplyRules extends Command
$ruleEngine->fire();
$this->friendlyLine('');
- $end = round(microtime(true) - $start, 2);
+ $end = round(microtime(true) - $start, 2);
$this->friendlyPositive(sprintf('Done in %s seconds!', $end));
return 0;
@@ -187,14 +187,14 @@ class ApplyRules extends Command
*/
private function verifyInputAccounts(): bool
{
- $accountString = $this->option('accounts');
+ $accountString = $this->option('accounts');
if (null === $accountString || '' === $accountString) {
$this->friendlyError('Please use the --accounts option to indicate the accounts to apply rules to.');
return false;
}
- $finalList = new Collection();
- $accountList = explode(',', $accountString);
+ $finalList = new Collection();
+ $accountList = explode(',', $accountString);
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
@@ -212,7 +212,7 @@ class ApplyRules extends Command
return false;
}
- $this->accounts = $finalList;
+ $this->accounts = $finalList;
return true;
}
@@ -224,7 +224,7 @@ class ApplyRules extends Command
// can be empty.
return true;
}
- $ruleGroupList = explode(',', $ruleGroupString);
+ $ruleGroupList = explode(',', $ruleGroupString);
foreach ($ruleGroupList as $ruleGroupId) {
$ruleGroup = $this->ruleGroupRepository->find((int)$ruleGroupId);
@@ -246,7 +246,7 @@ class ApplyRules extends Command
// can be empty.
return true;
}
- $ruleList = explode(',', $ruleString);
+ $ruleList = explode(',', $ruleString);
foreach ($ruleList as $ruleId) {
$rule = $this->ruleRepository->find((int)$ruleId);
@@ -264,13 +264,13 @@ class ApplyRules extends Command
private function verifyInputDates(): void
{
// parse start date.
- $inputStart = today(config('app.timezone'))->startOfMonth();
- $startString = $this->option('start_date');
+ $inputStart = today(config('app.timezone'))->startOfMonth();
+ $startString = $this->option('start_date');
if (null === $startString) {
/** @var JournalRepositoryInterface $repository */
$repository = app(JournalRepositoryInterface::class);
$repository->setUser($this->getUser());
- $first = $repository->firstNull();
+ $first = $repository->firstNull();
if (null !== $first) {
$inputStart = $first->date;
}
@@ -280,8 +280,8 @@ class ApplyRules extends Command
}
// parse end date
- $inputEnd = today(config('app.timezone'));
- $endString = $this->option('end_date');
+ $inputEnd = today(config('app.timezone'));
+ $endString = $this->option('end_date');
if (null !== $endString && '' !== $endString) {
$inputEnd = Carbon::createFromFormat('Y-m-d', $endString);
}
diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php
index 3e60037036..4b3b0177b9 100644
--- a/app/Console/Commands/Tools/Cron.php
+++ b/app/Console/Commands/Tools/Cron.php
@@ -43,14 +43,14 @@ class Cron extends Command
protected $description = 'Runs all Firefly III cron-job related commands. Configure a cron job according to the official Firefly III documentation.';
- protected $signature = 'firefly-iii:cron
+ protected $signature = 'firefly-iii:cron
{--F|force : Force the cron job(s) to execute.}
{--date= : Set the date in YYYY-MM-DD to make Firefly III think that\'s the current date.}
';
public function handle(): int
{
- $date = null;
+ $date = null;
try {
$date = new Carbon($this->option('date'));
diff --git a/app/Console/Commands/Upgrade/AccountCurrencies.php b/app/Console/Commands/Upgrade/AccountCurrencies.php
index 2732c5c43f..0ebe0d7b56 100644
--- a/app/Console/Commands/Upgrade/AccountCurrencies.php
+++ b/app/Console/Commands/Upgrade/AccountCurrencies.php
@@ -44,8 +44,8 @@ class AccountCurrencies extends Command
public const string CONFIG_NAME = '480_account_currencies';
- protected $description = 'Give all accounts proper currency info.';
- protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}';
+ protected $description = 'Give all accounts proper currency info.';
+ protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}';
private AccountRepositoryInterface $accountRepos;
private int $count;
private UserRepositoryInterface $userRepos;
@@ -109,7 +109,7 @@ class AccountCurrencies extends Command
private function updateCurrenciesForUser(User $user): void
{
$this->accountRepos->setUser($user);
- $accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
+ $accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
// get user's currency preference:
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
diff --git a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php
index b167042cc4..39263ad0c6 100644
--- a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php
+++ b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php
@@ -36,9 +36,9 @@ class AppendBudgetLimitPeriods extends Command
public const string CONFIG_NAME = '550_budget_limit_periods';
- protected $description = 'Append budget limits with their (estimated) timeframe.';
+ protected $description = 'Append budget limits with their (estimated) timeframe.';
- protected $signature = 'firefly-iii:budget-limit-periods {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:budget-limit-periods {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -76,7 +76,7 @@ class AppendBudgetLimitPeriods extends Command
private function fixLimit(BudgetLimit $limit): void
{
- $period = $this->getLimitPeriod($limit);
+ $period = $this->getLimitPeriod($limit);
if (null === $period) {
$message = sprintf(
@@ -93,7 +93,7 @@ class AppendBudgetLimitPeriods extends Command
$limit->period = $period;
$limit->save();
- $msg = sprintf(
+ $msg = sprintf(
'Budget limit #%d (%s - %s) period is "%s".',
$limit->id,
$limit->start_date->format('Y-m-d'),
diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.php
index ce72554139..d3c3d29000 100644
--- a/app/Console/Commands/Upgrade/BackToJournals.php
+++ b/app/Console/Commands/Upgrade/BackToJournals.php
@@ -40,9 +40,9 @@ class BackToJournals extends Command
public const string CONFIG_NAME = '480_back_to_journals';
- protected $description = 'Move meta data back to journals, not individual transactions.';
+ protected $description = 'Move meta data back to journals, not individual transactions.';
- protected $signature = 'firefly-iii:back-to-journals {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:back-to-journals {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -126,7 +126,7 @@ class BackToJournals extends Command
{
// grab category from first transaction
/** @var null|Transaction $transaction */
- $transaction = $journal->transactions->first();
+ $transaction = $journal->transactions->first();
if (null === $transaction) {
$this->friendlyInfo(sprintf('Transaction journal #%d has no transactions. Will be fixed later.', $journal->id));
@@ -134,7 +134,7 @@ class BackToJournals extends Command
}
/** @var null|Budget $budget */
- $budget = $transaction->budgets->first();
+ $budget = $transaction->budgets->first();
/** @var null|Budget $journalBudget */
$journalBudget = $journal->budgets->first();
@@ -159,7 +159,7 @@ class BackToJournals extends Command
$journals = new Collection();
$allIds = $this->getIdsForCategories();
- $chunks = array_chunk($allIds, 500);
+ $chunks = array_chunk($allIds, 500);
foreach ($chunks as $chunk) {
$collected = TransactionJournal::whereIn('id', $chunk)->with(['transactions', 'categories', 'transactions.categories'])->get();
$journals = $journals->merge($collected);
@@ -192,7 +192,7 @@ class BackToJournals extends Command
{
// grab category from first transaction
/** @var null|Transaction $transaction */
- $transaction = $journal->transactions->first();
+ $transaction = $journal->transactions->first();
if (null === $transaction) {
$this->friendlyInfo(sprintf('Transaction journal #%d has no transactions. Will be fixed later.', $journal->id));
@@ -200,7 +200,7 @@ class BackToJournals extends Command
}
/** @var null|Category $category */
- $category = $transaction->categories->first();
+ $category = $transaction->categories->first();
/** @var null|Category $journalCategory */
$journalCategory = $journal->categories->first();
diff --git a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php
index 6b2121f49d..f59008138b 100644
--- a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php
+++ b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php
@@ -39,9 +39,9 @@ class BudgetLimitCurrency extends Command
public const string CONFIG_NAME = '480_bl_currency';
- protected $description = 'Give budget limits a currency';
+ protected $description = 'Give budget limits a currency';
- protected $signature = 'firefly-iii:bl-currency {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:bl-currency {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Upgrade/CCLiabilities.php b/app/Console/Commands/Upgrade/CCLiabilities.php
index df3cb3856a..78d6511d9d 100644
--- a/app/Console/Commands/Upgrade/CCLiabilities.php
+++ b/app/Console/Commands/Upgrade/CCLiabilities.php
@@ -38,8 +38,8 @@ class CCLiabilities extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_cc_liabilities';
- protected $description = 'Convert old credit card liabilities.';
- protected $signature = 'firefly-iii:cc-liabilities {--F|force : Force the execution of this command.}';
+ protected $description = 'Convert old credit card liabilities.';
+ protected $signature = 'firefly-iii:cc-liabilities {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Upgrade/DecryptDatabase.php b/app/Console/Commands/Upgrade/DecryptDatabase.php
index 411c29c4cc..e4332d5fd5 100644
--- a/app/Console/Commands/Upgrade/DecryptDatabase.php
+++ b/app/Console/Commands/Upgrade/DecryptDatabase.php
@@ -119,8 +119,8 @@ class DecryptDatabase extends Command
if (null === $original) {
return;
}
- $id = (int)$row->id;
- $value = '';
+ $id = (int)$row->id;
+ $value = '';
try {
$value = $this->tryDecrypt($original);
diff --git a/app/Console/Commands/Upgrade/FixPostgresSequences.php b/app/Console/Commands/Upgrade/FixPostgresSequences.php
index e97426a7ad..3bbdc04464 100644
--- a/app/Console/Commands/Upgrade/FixPostgresSequences.php
+++ b/app/Console/Commands/Upgrade/FixPostgresSequences.php
@@ -36,7 +36,7 @@ class FixPostgresSequences extends Command
protected $description = 'Fixes issues with PostgreSQL sequences.';
- protected $signature = 'firefly-iii:fix-pgsql-sequences';
+ protected $signature = 'firefly-iii:fix-pgsql-sequences';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Upgrade/MigrateAttachments.php b/app/Console/Commands/Upgrade/MigrateAttachments.php
index 1aa487e213..08015d38c5 100644
--- a/app/Console/Commands/Upgrade/MigrateAttachments.php
+++ b/app/Console/Commands/Upgrade/MigrateAttachments.php
@@ -38,9 +38,9 @@ class MigrateAttachments extends Command
public const string CONFIG_NAME = '480_migrate_attachments';
- protected $description = 'Migrates attachment meta-data.';
+ protected $description = 'Migrates attachment meta-data.';
- protected $signature = 'firefly-iii:migrate-attachments {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:migrate-attachments {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -49,7 +49,7 @@ class MigrateAttachments extends Command
*/
public function handle(): int
{
- $start = microtime(true);
+ $start = microtime(true);
if ($this->isExecuted() && true !== $this->option('force')) {
$this->friendlyInfo('This command has already been executed.');
@@ -65,12 +65,12 @@ class MigrateAttachments extends Command
$attDescription = (string)$att->description;
if ('' !== $attDescription) {
// find or create note:
- $note = $att->notes()->first();
+ $note = $att->notes()->first();
if (null === $note) {
$note = new Note();
$note->noteable()->associate($att);
}
- $note->text = $attDescription;
+ $note->text = $attDescription;
$note->save();
// clear description:
@@ -87,7 +87,7 @@ class MigrateAttachments extends Command
if (0 !== $count) {
$this->friendlyInfo(sprintf('Updated %d attachment(s).', $count));
}
- $end = round(microtime(true) - $start, 2);
+ $end = round(microtime(true) - $start, 2);
$this->friendlyInfo(sprintf('Migrated attachment notes in %s seconds.', $end));
$this->markAsExecuted();
diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.php
index ab71126391..960125b369 100644
--- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php
+++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php
@@ -37,9 +37,9 @@ class MigrateJournalNotes extends Command
public const string CONFIG_NAME = '480_migrate_notes';
- protected $description = 'Migrate notes for transaction journals.';
+ protected $description = 'Migrate notes for transaction journals.';
- protected $signature = 'firefly-iii:migrate-notes {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:migrate-notes {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -59,8 +59,8 @@ class MigrateJournalNotes extends Command
/** @var TransactionJournalMeta $meta */
foreach ($set as $meta) {
- $journal = $meta->transactionJournal;
- $note = $journal->notes()->first();
+ $journal = $meta->transactionJournal;
+ $note = $journal->notes()->first();
if (null === $note) {
$note = new Note();
$note->noteable()->associate($journal);
@@ -81,7 +81,7 @@ class MigrateJournalNotes extends Command
$this->friendlyInfo(sprintf('Migrated %d note(s).', $count));
}
- $end = round(microtime(true) - $start, 2);
+ $end = round(microtime(true) - $start, 2);
$this->friendlyInfo(sprintf('Migrated notes in %s seconds.', $end));
$this->markAsExecuted();
diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php
index 0a7e4204fc..5b79a96f3c 100644
--- a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php
+++ b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php
@@ -39,9 +39,9 @@ class MigrateRecurrenceMeta extends Command
public const string CONFIG_NAME = '481_migrate_recurrence_meta';
- protected $description = 'Migrate recurrence meta data';
+ protected $description = 'Migrate recurrence meta data';
- protected $signature = 'firefly-iii:migrate-recurrence-meta {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:migrate-recurrence-meta {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -79,7 +79,7 @@ class MigrateRecurrenceMeta extends Command
private function migrateMetaData(): int
{
- $count = 0;
+ $count = 0;
// get all recurrence meta data:
$collection = RecurrenceMeta::with('recurrence')->get();
@@ -94,7 +94,7 @@ class MigrateRecurrenceMeta extends Command
private function migrateEntry(RecurrenceMeta $meta): int
{
/** @var null|Recurrence $recurrence */
- $recurrence = $meta->recurrence;
+ $recurrence = $meta->recurrence;
if (null === $recurrence) {
return 0;
}
@@ -102,7 +102,7 @@ class MigrateRecurrenceMeta extends Command
if (null === $firstTransaction) {
return 0;
}
- $value = $meta->value;
+ $value = $meta->value;
if ('tags' === $meta->name) {
$array = explode(',', $meta->value);
diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php
index 841c0a323a..7aec519d9c 100644
--- a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php
+++ b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php
@@ -25,9 +25,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
-use FireflyIII\Models\Recurrence;
-use FireflyIII\Models\RecurrenceTransaction;
-use FireflyIII\Models\TransactionType;
use Illuminate\Console\Command;
/**
@@ -39,9 +36,9 @@ class MigrateRecurrenceType extends Command
public const string CONFIG_NAME = '550_migrate_recurrence_type';
- protected $description = 'Migrate transaction type of recurring transaction.';
+ protected $description = 'Migrate transaction type of recurring transaction.';
- protected $signature = 'firefly-iii:migrate-recurrence-type {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:migrate-recurrence-type {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -66,7 +63,6 @@ class MigrateRecurrenceType extends Command
return (bool)$configVar?->data;
}
-
private function markAsExecuted(): void
{
app('fireflyconfig')->set(self::CONFIG_NAME, true);
diff --git a/app/Console/Commands/Upgrade/MigrateTagLocations.php b/app/Console/Commands/Upgrade/MigrateTagLocations.php
index a09c0cc0ac..76a7f81a9e 100644
--- a/app/Console/Commands/Upgrade/MigrateTagLocations.php
+++ b/app/Console/Commands/Upgrade/MigrateTagLocations.php
@@ -38,9 +38,9 @@ class MigrateTagLocations extends Command
public const string CONFIG_NAME = '500_migrate_tag_locations';
- protected $description = 'Migrate tag locations.';
+ protected $description = 'Migrate tag locations.';
- protected $signature = 'firefly-iii:migrate-tag-locations {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:migrate-tag-locations {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -94,9 +94,9 @@ class MigrateTagLocations extends Command
$location->locatable()->associate($tag);
$location->save();
- $tag->longitude = null;
- $tag->latitude = null;
- $tag->zoomLevel = null;
+ $tag->longitude = null;
+ $tag->latitude = null;
+ $tag->zoomLevel = null;
$tag->save();
}
diff --git a/app/Console/Commands/Upgrade/MigrateToGroups.php b/app/Console/Commands/Upgrade/MigrateToGroups.php
index 8424f7055a..5b7c49ebe1 100644
--- a/app/Console/Commands/Upgrade/MigrateToGroups.php
+++ b/app/Console/Commands/Upgrade/MigrateToGroups.php
@@ -47,8 +47,8 @@ class MigrateToGroups extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_migrated_to_groups';
- protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.';
- protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}';
+ protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.';
+ protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}';
private JournalCLIRepositoryInterface $cliRepository;
private int $count;
private TransactionGroupFactory $groupFactory;
@@ -157,7 +157,7 @@ class MigrateToGroups extends Command
$data['transactions'][] = $this->generateTransaction($journal, $transaction);
}
app('log')->debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
- $group = $this->groupFactory->create($data);
+ $group = $this->groupFactory->create($data);
app('log')->debug('Done calling transaction journal factory');
// delete the old transaction journal.
@@ -215,7 +215,7 @@ class MigrateToGroups extends Command
private function generateTransaction(TransactionJournal $journal, Transaction $transaction): array
{
app('log')->debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
- $opposingTr = $this->findOpposingTransaction($journal, $transaction);
+ $opposingTr = $this->findOpposingTransaction($journal, $transaction);
if (null === $opposingTr) {
$this->friendlyError(
@@ -256,8 +256,8 @@ class MigrateToGroups extends Command
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
// overrule journal category with transaction category.
- $budgetId = $this->getTransactionBudget($transaction, $opposingTr) ?? $budgetId;
- $categoryId = $this->getTransactionCategory($transaction, $opposingTr) ?? $categoryId;
+ $budgetId = $this->getTransactionBudget($transaction, $opposingTr) ?? $budgetId;
+ $categoryId = $this->getTransactionCategory($transaction, $opposingTr) ?? $categoryId;
return [
'type' => strtolower($journal->transactionType->type),
diff --git a/app/Console/Commands/Upgrade/MigrateToRules.php b/app/Console/Commands/Upgrade/MigrateToRules.php
index 6937e3755d..34db0ce8f7 100644
--- a/app/Console/Commands/Upgrade/MigrateToRules.php
+++ b/app/Console/Commands/Upgrade/MigrateToRules.php
@@ -44,9 +44,9 @@ class MigrateToRules extends Command
public const string CONFIG_NAME = '480_bills_to_rules';
- protected $description = 'Migrate bills to rules.';
+ protected $description = 'Migrate bills to rules.';
- protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
private BillRepositoryInterface $billRepository;
private int $count;
private RuleGroupRepositoryInterface $ruleGroupRepository;
@@ -137,7 +137,7 @@ class MigrateToRules extends Command
]
);
}
- $bills = $this->billRepository->getBills();
+ $bills = $this->billRepository->getBills();
/** @var Bill $bill */
foreach ($bills as $bill) {
@@ -153,8 +153,8 @@ class MigrateToRules extends Command
$languageString = null !== $language->data && !is_array($language->data) ? (string)$language->data : 'en_US';
// get match thing:
- $match = implode(' ', explode(',', $bill->match));
- $newRule = [
+ $match = implode(' ', explode(',', $bill->match));
+ $newRule = [
'rule_group_id' => $ruleGroup->id,
'active' => true,
'strict' => false,
@@ -197,7 +197,7 @@ class MigrateToRules extends Command
$this->ruleRepository->store($newRule);
// update bill:
- $newBillData = [
+ $newBillData = [
'currency_id' => $bill->transaction_currency_id,
'name' => $bill->name,
'match' => 'MIGRATED_TO_RULES',
diff --git a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
index 32a64b7131..a6dba4b748 100644
--- a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
+++ b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
@@ -43,8 +43,8 @@ class OtherCurrenciesCorrections extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_other_currencies';
- protected $description = 'Update all journal currency information.';
- protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}';
+ protected $description = 'Update all journal currency information.';
+ protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos;
@@ -120,7 +120,7 @@ class OtherCurrenciesCorrections extends Command
$this->journalRepos->setUser($journal->user);
$this->cliRepos->setUser($journal->user);
- $leadTransaction = $this->getLeadTransaction($journal);
+ $leadTransaction = $this->getLeadTransaction($journal);
if (null === $leadTransaction) {
$this->friendlyError(sprintf('Could not reliably determine which transaction is in the lead for transaction journal #%d.', $journal->id));
@@ -128,8 +128,8 @@ class OtherCurrenciesCorrections extends Command
return;
}
- $account = $leadTransaction->account;
- $currency = $this->getCurrency($account);
+ $account = $leadTransaction->account;
+ $currency = $this->getCurrency($account);
if (null === $currency) {
$this->friendlyError(
sprintf(
@@ -217,14 +217,14 @@ class OtherCurrenciesCorrections extends Command
private function getCurrency(Account $account): ?TransactionCurrency
{
- $accountId = $account->id;
+ $accountId = $account->id;
if (array_key_exists($accountId, $this->accountCurrencies) && 0 === $this->accountCurrencies[$accountId]) {
return null;
}
if (array_key_exists($accountId, $this->accountCurrencies) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
return $this->accountCurrencies[$accountId];
}
- $currency = $this->accountRepos->getAccountCurrency($account);
+ $currency = $this->accountRepos->getAccountCurrency($account);
if (null === $currency) {
$this->accountCurrencies[$accountId] = 0;
diff --git a/app/Console/Commands/Upgrade/RenameAccountMeta.php b/app/Console/Commands/Upgrade/RenameAccountMeta.php
index 6d22bb7bb2..e62899a19c 100644
--- a/app/Console/Commands/Upgrade/RenameAccountMeta.php
+++ b/app/Console/Commands/Upgrade/RenameAccountMeta.php
@@ -37,9 +37,9 @@ class RenameAccountMeta extends Command
public const string CONFIG_NAME = '480_rename_account_meta';
- protected $description = 'Rename account meta-data to new format.';
+ protected $description = 'Rename account meta-data to new format.';
- protected $signature = 'firefly-iii:rename-account-meta {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:rename-account-meta {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.php
index 3ed8fbab02..b241c6d394 100644
--- a/app/Console/Commands/Upgrade/TransactionIdentifier.php
+++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php
@@ -39,8 +39,8 @@ class TransactionIdentifier extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_transaction_identifier';
- protected $description = 'Fixes transaction identifiers.';
- protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}';
+ protected $description = 'Fixes transaction identifiers.';
+ protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}';
private JournalCLIRepositoryInterface $cliRepository;
private int $count;
@@ -130,8 +130,8 @@ class TransactionIdentifier extends Command
$opposing->identifier = $identifier;
$transaction->save();
$opposing->save();
- $exclude[] = $transaction->id;
- $exclude[] = $opposing->id;
+ $exclude[] = $transaction->id;
+ $exclude[] = $opposing->id;
++$this->count;
}
++$identifier;
diff --git a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
index ab5e731c1b..5733fa365f 100644
--- a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
+++ b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php
@@ -41,8 +41,8 @@ class TransferCurrenciesCorrections extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '480_transfer_currencies';
- protected $description = 'Updates transfer currency information.';
- protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}';
+ protected $description = 'Updates transfer currency information.';
+ protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}';
private array $accountCurrencies;
private AccountRepositoryInterface $accountRepos;
private JournalCLIRepositoryInterface $cliRepos;
@@ -219,14 +219,14 @@ class TransferCurrenciesCorrections extends Command
private function getCurrency(Account $account): ?TransactionCurrency
{
- $accountId = $account->id;
+ $accountId = $account->id;
if (array_key_exists($accountId, $this->accountCurrencies) && 0 === $this->accountCurrencies[$accountId]) {
return null;
}
if (array_key_exists($accountId, $this->accountCurrencies) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
return $this->accountCurrencies[$accountId];
}
- $currency = $this->accountRepos->getAccountCurrency($account);
+ $currency = $this->accountRepos->getAccountCurrency($account);
if (null === $currency) {
$this->accountCurrencies[$accountId] = 0;
@@ -321,7 +321,7 @@ class TransferCurrenciesCorrections extends Command
&& null === $this->sourceTransaction->foreign_amount
&& (int)$this->sourceTransaction->transaction_currency_id !== $this->sourceCurrency->id
) {
- $message = sprintf(
+ $message = sprintf(
'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.',
$this->sourceTransaction->id,
$this->sourceTransaction->transaction_currency_id,
@@ -367,7 +367,7 @@ class TransferCurrenciesCorrections extends Command
&& null === $this->destinationTransaction->foreign_amount
&& (int)$this->destinationTransaction->transaction_currency_id !== $this->destinationCurrency->id
) {
- $message = sprintf(
+ $message = sprintf(
'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.',
$this->destinationTransaction->id,
$this->destinationTransaction->transaction_currency_id,
@@ -390,8 +390,8 @@ class TransferCurrenciesCorrections extends Command
{
if ($this->destinationCurrency->id === $this->sourceCurrency->id) {
// update both transactions to match:
- $this->sourceTransaction->foreign_amount = null;
- $this->sourceTransaction->foreign_currency_id = null;
+ $this->sourceTransaction->foreign_amount = null;
+ $this->sourceTransaction->foreign_currency_id = null;
$this->destinationTransaction->foreign_amount = null;
$this->destinationTransaction->foreign_currency_id = null;
diff --git a/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php b/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php
index 5e8b6d48be..ff59b5169c 100644
--- a/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php
+++ b/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php
@@ -41,9 +41,9 @@ class UpgradeCurrencyPreferences extends Command
public const string CONFIG_NAME = '610_upgrade_currency_prefs';
- protected $description = 'Upgrade user currency preferences';
+ protected $description = 'Upgrade user currency preferences';
- protected $signature = 'firefly-iii:upgrade-currency-preferences {--F|force : Force the execution of this command.}';
+ protected $signature = 'firefly-iii:upgrade-currency-preferences {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -83,7 +83,7 @@ class UpgradeCurrencyPreferences extends Command
$this->upgradeGroupPreferences($group);
}
- $users = User::get();
+ $users = User::get();
/** @var User $user */
foreach ($users as $user) {
@@ -107,8 +107,8 @@ class UpgradeCurrencyPreferences extends Command
private function upgradeUserPreferences(User $user): void
{
- $currencies = TransactionCurrency::get();
- $enabled = new Collection();
+ $currencies = TransactionCurrency::get();
+ $enabled = new Collection();
/** @var TransactionCurrency $currency */
foreach ($currencies as $currency) {
diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilities.php b/app/Console/Commands/Upgrade/UpgradeLiabilities.php
index 0cda08cdc8..0f36506a8e 100644
--- a/app/Console/Commands/Upgrade/UpgradeLiabilities.php
+++ b/app/Console/Commands/Upgrade/UpgradeLiabilities.php
@@ -42,8 +42,8 @@ class UpgradeLiabilities extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '560_upgrade_liabilities';
- protected $description = 'Upgrade liabilities to new 5.6.0 structure.';
- protected $signature = 'firefly-iii:upgrade-liabilities {--F|force : Force the execution of this command.}';
+ protected $description = 'Upgrade liabilities to new 5.6.0 structure.';
+ protected $signature = 'firefly-iii:upgrade-liabilities {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -102,7 +102,7 @@ class UpgradeLiabilities extends Command
private function upgradeLiability(Account $account): void
{
/** @var AccountRepositoryInterface $repository */
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($account->user);
// get opening balance, and correct if necessary.
@@ -113,7 +113,7 @@ class UpgradeLiabilities extends Command
}
// add liability direction property (if it does not yet exist!)
- $value = $repository->getMetaValue($account, 'liability_direction');
+ $value = $repository->getMetaValue($account, 'liability_direction');
if (null === $value) {
/** @var AccountMetaFactory $factory */
$factory = app(AccountMetaFactory::class);
diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php
index 445e59533e..0fb2c9bb84 100644
--- a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php
+++ b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php
@@ -43,8 +43,8 @@ class UpgradeLiabilitiesEight extends Command
use ShowsFriendlyMessages;
public const string CONFIG_NAME = '600_upgrade_liabilities';
- protected $description = 'Upgrade liabilities to new 6.0.0 structure.';
- protected $signature = 'firefly-iii:liabilities-600 {--F|force : Force the execution of this command.}';
+ protected $description = 'Upgrade liabilities to new 6.0.0 structure.';
+ protected $signature = 'firefly-iii:liabilities-600 {--F|force : Force the execution of this command.}';
/**
* Execute the console command.
@@ -105,7 +105,7 @@ class UpgradeLiabilitiesEight extends Command
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($account->user);
- $direction = $repository->getMetaValue($account, 'liability_direction');
+ $direction = $repository->getMetaValue($account, 'liability_direction');
if ('credit' === $direction && $this->hasBadOpening($account)) {
$this->deleteCreditTransaction($account);
$this->reverseOpeningBalance($account);
@@ -131,7 +131,7 @@ class UpgradeLiabilitiesEight extends Command
if (null === $openingJournal) {
return false;
}
- $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
+ $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $liabilityType->id)
->first(['transaction_journals.*'])
@@ -168,17 +168,17 @@ class UpgradeLiabilitiesEight extends Command
$openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
/** @var TransactionJournal $openingJournal */
- $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
+ $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->where('transaction_journals.transaction_type_id', $openingBalanceType->id)
->first(['transaction_journals.*'])
;
/** @var null|Transaction $source */
- $source = $openingJournal->transactions()->where('amount', '<', 0)->first();
+ $source = $openingJournal->transactions()->where('amount', '<', 0)->first();
/** @var null|Transaction $dest */
- $dest = $openingJournal->transactions()->where('amount', '>', 0)->first();
+ $dest = $openingJournal->transactions()->where('amount', '>', 0)->first();
if (null !== $source && null !== $dest) {
$sourceId = $source->account_id;
$destId = $dest->account_id;
diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.php
index 5691f03910..47ddcf88fa 100644
--- a/app/Console/Commands/VerifiesAccessToken.php
+++ b/app/Console/Commands/VerifiesAccessToken.php
@@ -39,7 +39,7 @@ trait VerifiesAccessToken
*/
public function getUser(): User
{
- $userId = (int)$this->option('user');
+ $userId = (int)$this->option('user');
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
@@ -67,12 +67,12 @@ trait VerifiesAccessToken
*/
protected function verifyAccessToken(): bool
{
- $userId = (int)$this->option('user');
- $token = (string)$this->option('token');
+ $userId = (int)$this->option('user');
+ $token = (string)$this->option('token');
/** @var UserRepositoryInterface $repository */
- $repository = app(UserRepositoryInterface::class);
- $user = $repository->find($userId);
+ $repository = app(UserRepositoryInterface::class);
+ $user = $repository->find($userId);
if (null === $user) {
app('log')->error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
diff --git a/app/Enums/UserRoleEnum.php b/app/Enums/UserRoleEnum.php
index af98413c55..8906fb3535 100644
--- a/app/Enums/UserRoleEnum.php
+++ b/app/Enums/UserRoleEnum.php
@@ -30,13 +30,13 @@ namespace FireflyIII\Enums;
enum UserRoleEnum: string
{
// most basic rights, cannot see other members, can see everything else.
- case READ_ONLY = 'ro';
+ case READ_ONLY = 'ro';
// required to even USE the group properly (in this order)
- case MANAGE_TRANSACTIONS = 'mng_trx';
+ case MANAGE_TRANSACTIONS = 'mng_trx';
// required to edit, add or change categories/tags/object-groups
- case MANAGE_META = 'mng_meta';
+ case MANAGE_META = 'mng_meta';
// manage other financial objects:
case MANAGE_BUDGETS = 'mng_budgets';
@@ -49,14 +49,14 @@ enum UserRoleEnum: string
case MANAGE_CURRENCIES = 'mng_currencies';
// view and generate reports
- case VIEW_REPORTS = 'view_reports';
+ case VIEW_REPORTS = 'view_reports';
// view memberships. needs FULL to manage them.
- case VIEW_MEMBERSHIPS = 'view_memberships';
+ case VIEW_MEMBERSHIPS = 'view_memberships';
// everything the creator can, except remove/change original creator and delete group
- case FULL = 'full';
+ case FULL = 'full';
// reserved for original creator
- case OWNER = 'owner';
+ case OWNER = 'owner';
}
diff --git a/app/Enums/WebhookTrigger.php b/app/Enums/WebhookTrigger.php
index c3bf60a4c1..bdb2a58bf2 100644
--- a/app/Enums/WebhookTrigger.php
+++ b/app/Enums/WebhookTrigger.php
@@ -29,9 +29,9 @@ namespace FireflyIII\Enums;
*/
enum WebhookTrigger: int
{
- case STORE_TRANSACTION = 100;
+ case STORE_TRANSACTION = 100;
// case BEFORE_STORE_TRANSACTION = 101;
- case UPDATE_TRANSACTION = 110;
+ case UPDATE_TRANSACTION = 110;
// case BEFORE_UPDATE_TRANSACTION = 111;
case DESTROY_TRANSACTION = 120;
// case BEFORE_DESTROY_TRANSACTION = 121;
diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php
index 101abb5cfa..2f9ca2abf1 100644
--- a/app/Exceptions/GracefulNotFoundHandler.php
+++ b/app/Exceptions/GracefulNotFoundHandler.php
@@ -54,7 +54,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
if (null === $route) {
return parent::render($request, $e);
}
- $name = $route->getName();
+ $name = $route->getName();
if (!auth()->check()) {
return parent::render($request, $e);
}
@@ -160,7 +160,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
/** @var null|Account $account */
- $account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
+ $account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
if (null === $account) {
app('log')->error(sprintf('Could not find account %d, so give big fat error.', $accountId));
@@ -189,7 +189,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$groupId = !is_object($param) ? (int)$param : 0;
/** @var null|TransactionGroup $group */
- $group = $user->transactionGroups()->withTrashed()->find($groupId);
+ $group = $user->transactionGroups()->withTrashed()->find($groupId);
if (null === $group) {
app('log')->error(sprintf('Could not find group %d, so give big fat error.', $groupId));
@@ -203,7 +203,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
return parent::render($request, $exception);
}
- $type = $journal->transactionType->type;
+ $type = $journal->transactionType->type;
$request->session()->reflash();
if (TransactionType::RECONCILIATION === $type) {
@@ -229,7 +229,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$attachmentId = is_object($param) ? 0 : (int)$param;
/** @var null|Attachment $attachment */
- $attachment = $user->attachments()->withTrashed()->find($attachmentId);
+ $attachment = $user->attachments()->withTrashed()->find($attachmentId);
if (null === $attachment) {
app('log')->error(sprintf('Could not find attachment %d, so give big fat error.', $attachmentId));
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index d4b2867672..8cedc72aa5 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -128,7 +128,7 @@ class Handler extends ExceptionHandler
$errorCode = 500;
$errorCode = $e instanceof MethodNotAllowedHttpException ? 405 : $errorCode;
- $isDebug = (bool) config('app.debug', false);
+ $isDebug = (bool) config('app.debug', false);
if ($isDebug) {
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
@@ -191,7 +191,7 @@ class Handler extends ExceptionHandler
return;
}
- $userData = [
+ $userData = [
'id' => 0,
'email' => 'unknown@example.com',
];
@@ -200,9 +200,9 @@ class Handler extends ExceptionHandler
$userData['email'] = auth()->user()->email;
}
- $headers = request()->headers->all();
+ $headers = request()->headers->all();
- $data = [
+ $data = [
'class' => get_class($e),
'errorMessage' => $e->getMessage(),
'time' => date('r'),
@@ -219,8 +219,8 @@ class Handler extends ExceptionHandler
];
// create job that will mail.
- $ipAddress = request()->ip() ?? '0.0.0.0';
- $job = new MailError($userData, (string) config('firefly.site_owner'), $ipAddress, $data);
+ $ipAddress = request()->ip() ?? '0.0.0.0';
+ $job = new MailError($userData, (string) config('firefly.site_owner'), $ipAddress, $data);
dispatch($job);
parent::report($e);
diff --git a/app/Exceptions/IntervalException.php b/app/Exceptions/IntervalException.php
index 2eef5cc811..592eb5f858 100644
--- a/app/Exceptions/IntervalException.php
+++ b/app/Exceptions/IntervalException.php
@@ -50,7 +50,7 @@ final class IntervalException extends \Exception
int $code = 0,
?\Throwable $previous = null
): self {
- $message = sprintf(
+ $message = sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s',
$periodicity->name,
implode(', ', $intervals)
diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php
index 2be08d186c..2fec83f87b 100644
--- a/app/Factory/AccountFactory.php
+++ b/app/Factory/AccountFactory.php
@@ -73,7 +73,7 @@ class AccountFactory
{
app('log')->debug(sprintf('findOrCreate("%s", "%s")', $accountName, $accountType));
- $type = $this->accountRepository->getAccountTypeByType($accountType);
+ $type = $this->accountRepository->getAccountTypeByType($accountType);
if (null === $type) {
throw new FireflyException(sprintf('Cannot find account type "%s"', $accountType));
}
@@ -108,13 +108,13 @@ class AccountFactory
$data['iban'] = $this->filterIban($data['iban'] ?? null);
// account may exist already:
- $return = $this->find($data['name'], $type->type);
+ $return = $this->find($data['name'], $type->type);
if (null !== $return) {
return $return;
}
- $return = $this->createAccount($type, $data);
+ $return = $this->createAccount($type, $data);
event(new StoredAccount($return));
@@ -198,11 +198,11 @@ class AccountFactory
$databaseData['virtual_balance'] = null;
}
// create account!
- $account = Account::create($databaseData);
+ $account = Account::create($databaseData);
Log::channel('audit')->info(sprintf('Account #%d ("%s") has been created.', $account->id, $account->name));
// update meta data:
- $data = $this->cleanMetaDataArray($account, $data);
+ $data = $this->cleanMetaDataArray($account, $data);
$this->storeMetaData($account, $data);
// create opening balance (only asset accounts)
@@ -222,7 +222,7 @@ class AccountFactory
}
// create notes
- $notes = array_key_exists('notes', $data) ? $data['notes'] : '';
+ $notes = array_key_exists('notes', $data) ? $data['notes'] : '';
$this->updateNote($account, $notes);
// create location
@@ -242,10 +242,10 @@ 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;
- $currency = $this->getCurrency($currencyId, $currencyCode);
+ $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:
if (AccountType::ASSET !== $account->accountType->type) {
@@ -263,7 +263,7 @@ class AccountFactory
private function storeMetaData(Account $account, array $data): void
{
- $fields = $this->validFields;
+ $fields = $this->validFields;
if (AccountType::ASSET === $account->accountType->type) {
$fields = $this->validAssetFields;
}
@@ -272,8 +272,8 @@ class AccountFactory
}
// remove currency_id if necessary.
- $type = $account->accountType->type;
- $list = config('firefly.valid_currency_account_types');
+ $type = $account->accountType->type;
+ $list = config('firefly.valid_currency_account_types');
if (!in_array($type, $list, true)) {
$pos = array_search('currency_id', $fields, true);
if (false !== $pos) {
@@ -350,9 +350,9 @@ class AccountFactory
*/
private function storeOrder(Account $account, array $data): void
{
- $accountType = $account->accountType->type;
- $maxOrder = $this->accountRepository->maxOrder($accountType);
- $order = null;
+ $accountType = $account->accountType->type;
+ $maxOrder = $this->accountRepository->maxOrder($accountType);
+ $order = null;
if (!array_key_exists('order', $data)) {
$order = $maxOrder + 1;
}
diff --git a/app/Factory/AttachmentFactory.php b/app/Factory/AttachmentFactory.php
index 41038b67d6..75b60e8738 100644
--- a/app/Factory/AttachmentFactory.php
+++ b/app/Factory/AttachmentFactory.php
@@ -43,13 +43,13 @@ class AttachmentFactory
public function create(array $data): ?Attachment
{
// append if necessary.
- $model = !str_contains($data['attachable_type'], 'FireflyIII') ? sprintf('FireflyIII\\Models\\%s', $data['attachable_type'])
+ $model = !str_contains($data['attachable_type'], 'FireflyIII') ? sprintf('FireflyIII\\Models\\%s', $data['attachable_type'])
: $data['attachable_type'];
// get journal instead of transaction.
if (Transaction::class === $model) {
/** @var null|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');
}
@@ -74,7 +74,7 @@ class AttachmentFactory
);
$notes = (string)($data['notes'] ?? '');
if ('' !== $notes) {
- $note = new Note();
+ $note = new Note();
$note->noteable()->associate($attachment);
$note->text = $notes;
$note->save();
diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php
index 3a0db90c22..cc359db009 100644
--- a/app/Factory/BillFactory.php
+++ b/app/Factory/BillFactory.php
@@ -47,8 +47,8 @@ class BillFactory
public function create(array $data): ?Bill
{
app('log')->debug(sprintf('Now in %s', __METHOD__), $data);
- $factory = app(TransactionCurrencyFactory::class);
- $currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null)) ??
+ $factory = app(TransactionCurrencyFactory::class);
+ $currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null)) ??
app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
try {
@@ -56,7 +56,7 @@ class BillFactory
$active = array_key_exists('active', $data) ? $data['active'] : 0;
/** @var Bill $bill */
- $bill = Bill::create(
+ $bill = Bill::create(
[
'name' => $data['name'],
'match' => 'MIGRATED_TO_RULES',
@@ -93,7 +93,7 @@ class BillFactory
}
}
// try also with ID:
- $objectGroupId = (int)($data['object_group_id'] ?? 0);
+ $objectGroupId = (int)($data['object_group_id'] ?? 0);
if (0 !== $objectGroupId) {
$objectGroup = $this->findObjectGroupById($objectGroupId);
if (null !== $objectGroup) {
diff --git a/app/Factory/PiggyBankEventFactory.php b/app/Factory/PiggyBankEventFactory.php
index 34ce47c4b5..5ae8ed384e 100644
--- a/app/Factory/PiggyBankEventFactory.php
+++ b/app/Factory/PiggyBankEventFactory.php
@@ -54,7 +54,7 @@ class PiggyBankEventFactory
return;
}
app('log')->debug('Found repetition');
- $amount = $piggyRepos->getExactAmount($piggyBank, $repetition, $journal);
+ $amount = $piggyRepos->getExactAmount($piggyBank, $repetition, $journal);
if (0 === bccomp($amount, '0')) {
app('log')->debug('Amount is zero, will not create event.');
diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php
index 364894a661..c2ad81b6ab 100644
--- a/app/Factory/RecurrenceFactory.php
+++ b/app/Factory/RecurrenceFactory.php
@@ -98,7 +98,7 @@ class RecurrenceFactory
}
$repeatUntilString = $repeatUntil?->format('Y-m-d');
- $recurrence = new Recurrence(
+ $recurrence = new Recurrence(
[
'user_id' => $this->user->id,
'user_group_id' => $this->user->user_group_id,
diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.php
index 0af4b51bd0..efe89c3d22 100644
--- a/app/Factory/TagFactory.php
+++ b/app/Factory/TagFactory.php
@@ -36,11 +36,11 @@ class TagFactory
public function findOrCreate(string $tag): ?Tag
{
- $tag = trim($tag);
+ $tag = trim($tag);
app('log')->debug(sprintf('Now in TagFactory::findOrCreate("%s")', $tag));
/** @var null|Tag $dbTag */
- $dbTag = $this->user->tags()->where('tag', $tag)->first();
+ $dbTag = $this->user->tags()->where('tag', $tag)->first();
if (null !== $dbTag) {
app('log')->debug(sprintf('Tag exists (#%d), return it.', $dbTag->id));
@@ -84,7 +84,7 @@ class TagFactory
];
/** @var null|Tag $tag */
- $tag = Tag::create($array);
+ $tag = Tag::create($array);
if (null !== $tag && null !== $latitude && null !== $longitude) {
// create location object.
$location = new Location();
diff --git a/app/Factory/TransactionCurrencyFactory.php b/app/Factory/TransactionCurrencyFactory.php
index 6c305c066b..6c03fde0d8 100644
--- a/app/Factory/TransactionCurrencyFactory.php
+++ b/app/Factory/TransactionCurrencyFactory.php
@@ -43,7 +43,7 @@ class TransactionCurrencyFactory
$data['decimal_places'] = (int)$data['decimal_places'];
// if the code already exists (deleted)
// force delete it and then create the transaction:
- $count = TransactionCurrency::withTrashed()->whereCode($data['code'])->count();
+ $count = TransactionCurrency::withTrashed()->whereCode($data['code'])->count();
if (1 === $count) {
$old = TransactionCurrency::withTrashed()->whereCode($data['code'])->first();
$old->forceDelete();
diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php
index b28e5715d5..f38452e259 100644
--- a/app/Factory/TransactionFactory.php
+++ b/app/Factory/TransactionFactory.php
@@ -221,7 +221,7 @@ class TransactionFactory
}
app('log')->debug('Will update account with IBAN information.');
- $service = app(AccountUpdateService::class);
+ $service = app(AccountUpdateService::class);
$service->update($this->account, ['iban' => $this->accountInformation['iban']]);
}
}
diff --git a/app/Factory/TransactionGroupFactory.php b/app/Factory/TransactionGroupFactory.php
index 87573bb933..d75a170c59 100644
--- a/app/Factory/TransactionGroupFactory.php
+++ b/app/Factory/TransactionGroupFactory.php
@@ -63,8 +63,8 @@ class TransactionGroupFactory
throw new DuplicateTransactionException($e->getMessage(), 0, $e);
}
- $title = $data['group_title'] ?? null;
- $title = '' === $title ? null : $title;
+ $title = $data['group_title'] ?? null;
+ $title = '' === $title ? null : $title;
if (null !== $title) {
$title = substr($title, 0, 1000);
@@ -73,7 +73,7 @@ class TransactionGroupFactory
throw new FireflyException('Created zero transaction journals.');
}
- $group = new TransactionGroup();
+ $group = new TransactionGroup();
$group->user()->associate($this->user);
$group->userGroup()->associate($data['user_group'] ?? $this->user->userGroup);
$group->title = $title;
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index 3678081ccf..84e78ab5c4 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -96,7 +96,7 @@ class TransactionJournalFactory
{
app('log')->debug('Now in TransactionJournalFactory::create()');
// convert to special object.
- $dataObject = new NullArrayObject($data);
+ $dataObject = new NullArrayObject($data);
app('log')->debug('Start of TransactionJournalFactory::create()');
$collection = new Collection();
@@ -163,7 +163,7 @@ class TransactionJournalFactory
protected function storeMeta(TransactionJournal $journal, NullArrayObject $data, string $field): void
{
- $set = [
+ $set = [
'journal' => $journal,
'name' => $field,
'data' => (string) ($data[$field] ?? ''),
@@ -197,14 +197,14 @@ class TransactionJournalFactory
$this->errorIfDuplicate($row['import_hash_v2']);
/** Some basic fields */
- $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']);
- $foreignCurrency = $this->currencyRepository->findCurrencyNull($row['foreign_currency_id'], $row['foreign_currency_code']);
- $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'];
+ $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']);
+ $foreignCurrency = $this->currencyRepository->findCurrencyNull($row['foreign_currency_id'], $row['foreign_currency_code']);
+ $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'];
// Manipulate basic fields
$carbon->setTimezone(config('app.timezone'));
@@ -220,7 +220,7 @@ class TransactionJournalFactory
}
/** create or get source and destination accounts */
- $sourceInfo = [
+ $sourceInfo = [
'id' => $row['source_id'],
'name' => $row['source_name'],
'iban' => $row['source_iban'],
@@ -229,7 +229,7 @@ class TransactionJournalFactory
'currency_id' => $currency->id,
];
- $destInfo = [
+ $destInfo = [
'id' => $row['destination_id'],
'name' => $row['destination_name'],
'iban' => $row['destination_iban'],
@@ -239,8 +239,8 @@ class TransactionJournalFactory
];
app('log')->debug('Source info:', $sourceInfo);
app('log')->debug('Destination info:', $destInfo);
- $sourceAccount = $this->getAccount($type->type, 'source', $sourceInfo);
- $destinationAccount = $this->getAccount($type->type, 'destination', $destInfo);
+ $sourceAccount = $this->getAccount($type->type, 'source', $sourceInfo);
+ $destinationAccount = $this->getAccount($type->type, 'destination', $destInfo);
app('log')->debug('Done with getAccount(2x)');
// this is the moment for a reconciliation sanity check (again).
@@ -248,15 +248,15 @@ class TransactionJournalFactory
[$sourceAccount, $destinationAccount] = $this->reconciliationSanityCheck($sourceAccount, $destinationAccount);
}
- $currency = $this->getCurrencyByAccount($type->type, $currency, $sourceAccount, $destinationAccount);
- $foreignCurrency = $this->compareCurrencies($currency, $foreignCurrency);
- $foreignCurrency = $this->getForeignByAccount($type->type, $foreignCurrency, $destinationAccount);
- $description = $this->getDescription($description);
+ $currency = $this->getCurrencyByAccount($type->type, $currency, $sourceAccount, $destinationAccount);
+ $foreignCurrency = $this->compareCurrencies($currency, $foreignCurrency);
+ $foreignCurrency = $this->getForeignByAccount($type->type, $foreignCurrency, $destinationAccount);
+ $description = $this->getDescription($description);
app('log')->debug(sprintf('Date: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()->getName()));
/** Create a basic journal. */
- $journal = TransactionJournal::create(
+ $journal = TransactionJournal::create(
[
'user_id' => $this->user->id,
'user_group_id' => $this->user->user_group_id,
@@ -273,7 +273,7 @@ class TransactionJournalFactory
app('log')->debug(sprintf('Created new journal #%d: "%s"', $journal->id, $journal->description));
/** Create two transactions. */
- $transactionFactory = app(TransactionFactory::class);
+ $transactionFactory = app(TransactionFactory::class);
$transactionFactory->setUser($this->user);
$transactionFactory->setJournal($journal);
$transactionFactory->setAccount($sourceAccount);
@@ -292,7 +292,7 @@ class TransactionJournalFactory
}
/** @var TransactionFactory $transactionFactory */
- $transactionFactory = app(TransactionFactory::class);
+ $transactionFactory = app(TransactionFactory::class);
$transactionFactory->setUser($this->user);
$transactionFactory->setJournal($journal);
$transactionFactory->setAccount($destinationAccount);
@@ -310,7 +310,7 @@ class TransactionJournalFactory
throw new FireflyException($e->getMessage(), 0, $e);
}
- $journal->completed = true;
+ $journal->completed = true;
$journal->save();
$this->storeBudget($journal, $row);
$this->storeCategory($journal, $row);
@@ -334,7 +334,7 @@ class TransactionJournalFactory
app('log')->error(sprintf('Could not encode dataRow: %s', $e->getMessage()));
$json = microtime();
}
- $hash = hash('sha256', $json);
+ $hash = hash('sha256', $json);
app('log')->debug(sprintf('The hash is: %s', $hash), $dataRow);
return $hash;
@@ -378,18 +378,18 @@ class TransactionJournalFactory
private function validateAccounts(NullArrayObject $data): void
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
- $transactionType = $data['type'] ?? 'invalid';
+ $transactionType = $data['type'] ?? 'invalid';
$this->accountValidator->setUser($this->user);
$this->accountValidator->setTransactionType($transactionType);
// validate source account.
- $array = [
+ $array = [
'id' => null !== $data['source_id'] ? (int) $data['source_id'] : null,
'name' => null !== $data['source_name'] ? (string) $data['source_name'] : null,
'iban' => null !== $data['source_iban'] ? (string) $data['source_iban'] : null,
'number' => null !== $data['source_number'] ? (string) $data['source_number'] : null,
];
- $validSource = $this->accountValidator->validateSource($array);
+ $validSource = $this->accountValidator->validateSource($array);
// do something with result:
if (false === $validSource) {
@@ -398,7 +398,7 @@ class TransactionJournalFactory
app('log')->debug('Source seems valid.');
// validate destination account
- $array = [
+ $array = [
'id' => null !== $data['destination_id'] ? (int) $data['destination_id'] : null,
'name' => null !== $data['destination_name'] ? (string) $data['destination_name'] : null,
'iban' => null !== $data['destination_iban'] ? (string) $data['destination_iban'] : null,
@@ -466,7 +466,7 @@ class TransactionJournalFactory
// return user's default:
return app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
}
- $result = $preference ?? $currency;
+ $result = $preference ?? $currency;
app('log')->debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));
return $result;
diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.php
index 56febdfa77..28f3516609 100644
--- a/app/Factory/TransactionJournalMetaFactory.php
+++ b/app/Factory/TransactionJournalMetaFactory.php
@@ -34,10 +34,10 @@ class TransactionJournalMetaFactory
public function updateOrCreate(array $data): ?TransactionJournalMeta
{
// app('log')->debug('In updateOrCreate()');
- $value = $data['data'];
+ $value = $data['data'];
/** @var null|TransactionJournalMeta $entry */
- $entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
+ $entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
if (null === $value && null !== $entry) {
// app('log')->debug('Value is empty, delete meta value.');
$entry->delete();
@@ -63,7 +63,7 @@ class TransactionJournalMetaFactory
if (null === $entry) {
// app('log')->debug('Will create new object.');
app('log')->debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name']));
- $entry = new TransactionJournalMeta();
+ $entry = new TransactionJournalMeta();
$entry->transactionJournal()->associate($data['journal']);
$entry->name = $data['name'];
}
diff --git a/app/Factory/UserGroupFactory.php b/app/Factory/UserGroupFactory.php
index 86cf7ccd88..d392b69832 100644
--- a/app/Factory/UserGroupFactory.php
+++ b/app/Factory/UserGroupFactory.php
@@ -40,12 +40,12 @@ class UserGroupFactory
*/
public function create(array $data): UserGroup
{
- $userGroup = new UserGroup();
- $userGroup->title = $data['title'];
+ $userGroup = new UserGroup();
+ $userGroup->title = $data['title'];
$userGroup->save();
// grab the OWNER role:
- $role = UserRole::whereTitle(UserRoleEnum::OWNER->value)->first();
+ $role = UserRole::whereTitle(UserRoleEnum::OWNER->value)->first();
if (null === $role) {
throw new FireflyException('Role "owner" does not exist.');
}
diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.php
index 6dbcf367a7..3675871dec 100644
--- a/app/Generator/Chart/Basic/ChartJsGenerator.php
+++ b/app/Generator/Chart/Basic/ChartJsGenerator.php
@@ -44,16 +44,16 @@ class ChartJsGenerator implements GeneratorInterface
'labels' => [],
];
- $amounts = array_column($data, 'amount');
- $next = next($amounts);
- $sortFlag = SORT_ASC;
+ $amounts = array_column($data, 'amount');
+ $next = next($amounts);
+ $sortFlag = SORT_ASC;
if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {
$sortFlag = SORT_DESC;
}
array_multisort($amounts, $sortFlag, $data);
unset($next, $sortFlag, $amounts);
- $index = 0;
+ $index = 0;
foreach ($data as $key => $valueArray) {
// make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string)$valueArray['amount']);
@@ -99,11 +99,11 @@ class ChartJsGenerator implements GeneratorInterface
public function multiSet(array $data): array
{
reset($data);
- $first = current($data);
+ $first = current($data);
if (!is_array($first)) {
return [];
}
- $labels = is_array($first['entries']) ? array_keys($first['entries']) : [];
+ $labels = is_array($first['entries']) ? array_keys($first['entries']) : [];
$chartData = [
'count' => count($data),
@@ -113,7 +113,7 @@ class ChartJsGenerator implements GeneratorInterface
unset($first, $labels);
foreach ($data as $set) {
- $currentSet = [
+ $currentSet = [
'label' => $set['label'] ?? '(no label)',
'type' => $set['type'] ?? 'line',
'data' => array_values($set['entries']),
@@ -153,20 +153,20 @@ class ChartJsGenerator implements GeneratorInterface
// sort by value, keep keys.
// different sort when values are positive and when they're negative.
asort($data);
- $next = next($data);
+ $next = next($data);
if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {
// next is positive, sort other way around.
arsort($data);
}
unset($next);
- $index = 0;
+ $index = 0;
foreach ($data as $key => $value) {
// make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string)$value);
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
- $chartData['labels'][] = $key;
+ $chartData['labels'][] = $key;
++$index;
}
diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php
index 8db365247d..8e12fbea01 100644
--- a/app/Generator/Report/Audit/MonthReportGenerator.php
+++ b/app/Generator/Report/Audit/MonthReportGenerator.php
@@ -48,8 +48,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
public function generate(): string
{
- $auditData = [];
- $dayBefore = clone $this->start;
+ $auditData = [];
+ $dayBefore = clone $this->start;
$dayBefore->subDay();
/** @var Account $account */
@@ -122,16 +122,16 @@ class MonthReportGenerator implements ReportGeneratorInterface
$journalRepository->setUser($account->user);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $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')->getDefaultCurrencyByUserGroup($account->user->userGroup);
- $currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
+ $journals = $collector->getExtractedJournals();
+ $journals = array_reverse($journals, true);
+ $dayBeforeBalance = app('steam')->balance($account, $date);
+ $startBalance = $dayBeforeBalance;
+ $defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
+ $currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
foreach ($journals as $index => $journal) {
$journals[$index]['balance_before'] = $startBalance;
@@ -149,19 +149,19 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
}
- $newBalance = bcadd($startBalance, $transactionAmount);
- $journals[$index]['balance_after'] = $newBalance;
- $startBalance = $newBalance;
+ $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');
+ $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();
+ $locale = app('steam')->getLocale();
return [
'journals' => $journals,
diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.php
index ca30523f1b..505535c403 100644
--- a/app/Generator/Report/Budget/MonthReportGenerator.php
+++ b/app/Generator/Report/Budget/MonthReportGenerator.php
@@ -157,7 +157,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
->setTypes([TransactionType::WITHDRAWAL])
->withAccountInformation()
diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php
index 53559d6aa9..e931057f43 100644
--- a/app/Generator/Report/Category/MonthReportGenerator.php
+++ b/app/Generator/Report/Category/MonthReportGenerator.php
@@ -156,7 +156,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
->setCategories($this->categories)->withAccountInformation()
@@ -178,7 +178,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])
diff --git a/app/Generator/Report/ReportGeneratorFactory.php b/app/Generator/Report/ReportGeneratorFactory.php
index 9c49c9e5f8..fcb97f979f 100644
--- a/app/Generator/Report/ReportGeneratorFactory.php
+++ b/app/Generator/Report/ReportGeneratorFactory.php
@@ -49,7 +49,7 @@ class ReportGeneratorFactory
$period = 'MultiYear';
}
- $class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period);
+ $class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period);
if (class_exists($class)) {
/** @var ReportGeneratorInterface $obj */
$obj = app($class);
diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.php
index 762cbc0af0..0a8302710a 100644
--- a/app/Generator/Webhook/StandardMessageGenerator.php
+++ b/app/Generator/Webhook/StandardMessageGenerator.php
@@ -131,7 +131,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
*/
private function generateMessage(Webhook $webhook, Model $model): void
{
- $class = get_class($model);
+ $class = get_class($model);
// Line is ignored because all of Firefly III's Models have an id property.
app('log')->debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
@@ -179,7 +179,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
case WebhookResponse::TRANSACTIONS->value:
/** @var TransactionGroup $model */
- $transformer = new TransactionGroupTransformer();
+ $transformer = new TransactionGroupTransformer();
try {
$basicMessage['content'] = $transformer->transformObject($model);
@@ -196,9 +196,9 @@ class StandardMessageGenerator implements MessageGeneratorInterface
case WebhookResponse::ACCOUNTS->value:
/** @var TransactionGroup $model */
- $accounts = $this->collectAccounts($model);
+ $accounts = $this->collectAccounts($model);
foreach ($accounts as $account) {
- $transformer = new AccountTransformer();
+ $transformer = new AccountTransformer();
$transformer->setParameters(new ParameterBag());
$basicMessage['content'][] = $transformer->transform($account);
}
@@ -223,7 +223,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
private function storeMessage(Webhook $webhook, array $message): void
{
- $webhookMessage = new WebhookMessage();
+ $webhookMessage = new WebhookMessage();
$webhookMessage->webhook()->associate($webhook);
$webhookMessage->sent = false;
$webhookMessage->errored = false;
diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php
index be927cf0d4..fb8565b137 100644
--- a/app/Handlers/Events/AdminEventHandler.php
+++ b/app/Handlers/Events/AdminEventHandler.php
@@ -39,7 +39,7 @@ class AdminEventHandler
{
public function sendInvitationNotification(InvitationCreated $event): void
{
- $sendMail = app('fireflyconfig')->get('notification_invite_created', true)->data;
+ $sendMail = app('fireflyconfig')->get('notification_invite_created', true)->data;
if (false === $sendMail) {
return;
}
@@ -75,7 +75,7 @@ class AdminEventHandler
*/
public function sendNewVersion(NewVersionAvailable $event): void
{
- $sendMail = app('fireflyconfig')->get('notification_new_version', true)->data;
+ $sendMail = app('fireflyconfig')->get('notification_new_version', true)->data;
if (false === $sendMail) {
return;
}
diff --git a/app/Handlers/Events/AuditEventHandler.php b/app/Handlers/Events/AuditEventHandler.php
index 9ae3dd5bfd..d881b19ed4 100644
--- a/app/Handlers/Events/AuditEventHandler.php
+++ b/app/Handlers/Events/AuditEventHandler.php
@@ -35,7 +35,7 @@ class AuditEventHandler
{
public function storeAuditEvent(TriggeredAuditLog $event): void
{
- $array = [
+ $array = [
'auditable' => $event->auditable,
'changer' => $event->changer,
'action' => $event->field,
diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php
index 61857d33c9..d3f5bc8631 100644
--- a/app/Handlers/Events/AutomationHandler.php
+++ b/app/Handlers/Events/AutomationHandler.php
@@ -46,11 +46,11 @@ class AutomationHandler
app('log')->debug('In reportJournals.');
/** @var UserRepositoryInterface $repository */
- $repository = app(UserRepositoryInterface::class);
- $user = $repository->find($event->userId);
+ $repository = app(UserRepositoryInterface::class);
+ $user = $repository->find($event->userId);
/** @var bool $sendReport */
- $sendReport = app('preferences')->getForUser($user, 'notification_transaction_creation', false)->data;
+ $sendReport = app('preferences')->getForUser($user, 'notification_transaction_creation', false)->data;
if (false === $sendReport) {
app('log')->debug('Not sending report, because config says so.');
diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php
index 81092b6a2b..7d87e6727f 100644
--- a/app/Handlers/Events/BillEventHandler.php
+++ b/app/Handlers/Events/BillEventHandler.php
@@ -37,7 +37,7 @@ class BillEventHandler
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
- $bill = $event->bill;
+ $bill = $event->bill;
/** @var bool $preference */
$preference = app('preferences')->getForUser($bill->user, 'notification_bill_reminder', true)->data;
diff --git a/app/Handlers/Events/DestroyedGroupEventHandler.php b/app/Handlers/Events/DestroyedGroupEventHandler.php
index c615735a8d..db437d989c 100644
--- a/app/Handlers/Events/DestroyedGroupEventHandler.php
+++ b/app/Handlers/Events/DestroyedGroupEventHandler.php
@@ -37,8 +37,8 @@ class DestroyedGroupEventHandler
public function triggerWebhooks(DestroyedTransactionGroup $destroyedGroupEvent): void
{
app('log')->debug('DestroyedTransactionGroup:triggerWebhooks');
- $group = $destroyedGroupEvent->transactionGroup;
- $user = $group->user;
+ $group = $destroyedGroupEvent->transactionGroup;
+ $user = $group->user;
/** @var MessageGeneratorInterface $engine */
$engine = app(MessageGeneratorInterface::class);
diff --git a/app/Handlers/Events/Model/BudgetLimitHandler.php b/app/Handlers/Events/Model/BudgetLimitHandler.php
index dcf1b022e5..5129e7bd85 100644
--- a/app/Handlers/Events/Model/BudgetLimitHandler.php
+++ b/app/Handlers/Events/Model/BudgetLimitHandler.php
@@ -66,7 +66,7 @@ class BudgetLimitHandler
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
{
app('log')->debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));
- $budget = Budget::find($budgetLimit->budget_id);
+ $budget = Budget::find($budgetLimit->budget_id);
if (null === $budget) {
app('log')->warning('Budget is null, probably deleted, find deleted version.');
$budget = Budget::withTrashed()->find($budgetLimit->budget_id);
@@ -79,7 +79,7 @@ class BudgetLimitHandler
}
/** @var null|User $user */
- $user = $budget->user;
+ $user = $budget->user;
// sanity check. It happens when the budget has been deleted so the original user is unknown.
if (null === $user) {
@@ -102,20 +102,20 @@ class BudgetLimitHandler
if (null === $viewRange || is_array($viewRange)) {
$viewRange = '1M';
}
- $viewRange = (string)$viewRange;
+ $viewRange = (string)$viewRange;
- $start = app('navigation')->startOfPeriod($budgetLimit->start_date, $viewRange);
- $end = app('navigation')->startOfPeriod($budgetLimit->end_date, $viewRange);
- $end = app('navigation')->endOfPeriod($end, $viewRange);
+ $start = app('navigation')->startOfPeriod($budgetLimit->start_date, $viewRange);
+ $end = app('navigation')->startOfPeriod($budgetLimit->end_date, $viewRange);
+ $end = app('navigation')->endOfPeriod($end, $viewRange);
// limit period in total is:
$limitPeriod = Period::make($start, $end, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
app('log')->debug(sprintf('Limit period is from %s to %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
// from the start until the end of the budget limit, need to loop!
- $current = clone $start;
+ $current = clone $start;
while ($current <= $end) {
- $currentEnd = app('navigation')->endOfPeriod($current, $viewRange);
+ $currentEnd = app('navigation')->endOfPeriod($current, $viewRange);
// create or find AB for this particular period, and set the amount accordingly.
/** @var null|AvailableBudget $availableBudget */
@@ -158,16 +158,16 @@ class BudgetLimitHandler
}
// prep for next loop
- $current = app('navigation')->addPeriod($current, $viewRange, 0);
+ $current = app('navigation')->addPeriod($current, $viewRange, 0);
}
}
private function calculateAmount(AvailableBudget $availableBudget): void
{
- $repository = app(BudgetLimitRepositoryInterface::class);
+ $repository = app(BudgetLimitRepositoryInterface::class);
$repository->setUser($availableBudget->user);
- $newAmount = '0';
- $abPeriod = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
+ $newAmount = '0';
+ $abPeriod = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
app('log')->debug(
sprintf(
'Now at AB #%d, ("%s" to "%s")',
@@ -177,7 +177,7 @@ class BudgetLimitHandler
)
);
// have to recalculate everything just in case.
- $set = $repository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
+ $set = $repository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
app('log')->debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
/** @var BudgetLimit $budgetLimit */
diff --git a/app/Handlers/Events/Model/PiggyBankEventHandler.php b/app/Handlers/Events/Model/PiggyBankEventHandler.php
index a0c8208146..f97319bac6 100644
--- a/app/Handlers/Events/Model/PiggyBankEventHandler.php
+++ b/app/Handlers/Events/Model/PiggyBankEventHandler.php
@@ -39,7 +39,7 @@ class PiggyBankEventHandler
if (null !== $event->transactionGroup) {
$journal = $event->transactionGroup->transactionJournals()->first();
}
- $date = $journal?->date ?? today(config('app.timezone'));
+ $date = $journal?->date ?? today(config('app.timezone'));
// sanity check: event must not already exist for this journal and piggy bank.
if (null !== $journal) {
$exists = PiggyBankEvent::where('piggy_bank_id', $event->piggyBank->id)
diff --git a/app/Handlers/Events/Model/RuleHandler.php b/app/Handlers/Events/Model/RuleHandler.php
index 8ae02c8260..872429747b 100644
--- a/app/Handlers/Events/Model/RuleHandler.php
+++ b/app/Handlers/Events/Model/RuleHandler.php
@@ -36,18 +36,18 @@ class RuleHandler
{
public function ruleActionFailedOnArray(RuleActionFailedOnArray $event): void
{
- $ruleAction = $event->ruleAction;
- $rule = $ruleAction->rule;
+ $ruleAction = $event->ruleAction;
+ $rule = $ruleAction->rule;
/** @var bool $preference */
- $preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data;
+ $preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data;
if (false === $preference) {
return;
}
app('log')->debug('Now in ruleActionFailedOnArray');
- $journal = $event->journal;
- $error = $event->error;
- $user = $ruleAction->rule->user;
+ $journal = $event->journal;
+ $error = $event->error;
+ $user = $ruleAction->rule->user;
$mainMessage = trans('rules.main_message', ['rule' => $rule->title, 'action' => $ruleAction->action_type, 'group' => $journal['transaction_group_id'], 'error' => $error]);
$groupTitle = $journal['description'] ?? '';
@@ -61,18 +61,18 @@ class RuleHandler
public function ruleActionFailedOnObject(RuleActionFailedOnObject $event): void
{
- $ruleAction = $event->ruleAction;
- $rule = $ruleAction->rule;
+ $ruleAction = $event->ruleAction;
+ $rule = $ruleAction->rule;
/** @var bool $preference */
- $preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data;
+ $preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data;
if (false === $preference) {
return;
}
app('log')->debug('Now in ruleActionFailedOnObject');
- $journal = $event->journal;
- $error = $event->error;
- $user = $ruleAction->rule->user;
+ $journal = $event->journal;
+ $error = $event->error;
+ $user = $ruleAction->rule->user;
$mainMessage = trans('rules.main_message', ['rule' => $rule->title, 'action' => $ruleAction->action_type, 'group' => $journal->transaction_group_id, 'error' => $error]);
$groupTitle = $journal->description ?? '';
diff --git a/app/Handlers/Events/StoredAccountEventHandler.php b/app/Handlers/Events/StoredAccountEventHandler.php
index bb81b22cec..574148def2 100644
--- a/app/Handlers/Events/StoredAccountEventHandler.php
+++ b/app/Handlers/Events/StoredAccountEventHandler.php
@@ -37,7 +37,7 @@ class StoredAccountEventHandler
$account = $event->account;
/** @var CreditRecalculateService $object */
- $object = app(CreditRecalculateService::class);
+ $object = app(CreditRecalculateService::class);
$object->setAccount($account);
$object->recalculate();
}
diff --git a/app/Handlers/Events/StoredGroupEventHandler.php b/app/Handlers/Events/StoredGroupEventHandler.php
index a057774587..53faaffe21 100644
--- a/app/Handlers/Events/StoredGroupEventHandler.php
+++ b/app/Handlers/Events/StoredGroupEventHandler.php
@@ -50,14 +50,14 @@ class StoredGroupEventHandler
}
app('log')->debug('Now in StoredGroupEventHandler::processRules()');
- $journals = $storedGroupEvent->transactionGroup->transactionJournals;
- $array = [];
+ $journals = $storedGroupEvent->transactionGroup->transactionJournals;
+ $array = [];
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
$array[] = $journal->id;
}
- $journalIds = implode(',', $array);
+ $journalIds = implode(',', $array);
app('log')->debug(sprintf('Add local operator for journal(s): %s', $journalIds));
// collect rules:
@@ -66,10 +66,10 @@ class StoredGroupEventHandler
// add the groups to the rule engine.
// it should run the rules in the group and cancel the group if necessary.
- $groups = $ruleGroupRepository->getRuleGroupsWithRules('store-journal');
+ $groups = $ruleGroupRepository->getRuleGroupsWithRules('store-journal');
// create and fire rule engine.
- $newRuleEngine = app(RuleEngineInterface::class);
+ $newRuleEngine = app(RuleEngineInterface::class);
$newRuleEngine->setUser($storedGroupEvent->transactionGroup->user);
$newRuleEngine->addOperator(['type' => 'journal_id', 'value' => $journalIds]);
$newRuleEngine->setRuleGroups($groups);
@@ -78,7 +78,7 @@ class StoredGroupEventHandler
public function recalculateCredit(StoredTransactionGroup $event): void
{
- $group = $event->transactionGroup;
+ $group = $event->transactionGroup;
/** @var CreditRecalculateService $object */
$object = app(CreditRecalculateService::class);
@@ -92,14 +92,14 @@ class StoredGroupEventHandler
public function triggerWebhooks(StoredTransactionGroup $storedGroupEvent): void
{
app('log')->debug(__METHOD__);
- $group = $storedGroupEvent->transactionGroup;
+ $group = $storedGroupEvent->transactionGroup;
if (false === $storedGroupEvent->fireWebhooks) {
app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
return;
}
- $user = $group->user;
+ $user = $group->user;
/** @var MessageGeneratorInterface $engine */
$engine = app(MessageGeneratorInterface::class);
diff --git a/app/Handlers/Events/UpdatedAccountEventHandler.php b/app/Handlers/Events/UpdatedAccountEventHandler.php
index e949c02e6b..59c137e817 100644
--- a/app/Handlers/Events/UpdatedAccountEventHandler.php
+++ b/app/Handlers/Events/UpdatedAccountEventHandler.php
@@ -37,7 +37,7 @@ class UpdatedAccountEventHandler
$account = $event->account;
/** @var CreditRecalculateService $object */
- $object = app(CreditRecalculateService::class);
+ $object = app(CreditRecalculateService::class);
$object->setAccount($account);
$object->recalculate();
}
diff --git a/app/Handlers/Events/UpdatedGroupEventHandler.php b/app/Handlers/Events/UpdatedGroupEventHandler.php
index 7ff319630a..3daa2604b9 100644
--- a/app/Handlers/Events/UpdatedGroupEventHandler.php
+++ b/app/Handlers/Events/UpdatedGroupEventHandler.php
@@ -52,24 +52,24 @@ class UpdatedGroupEventHandler
return;
}
- $journals = $updatedGroupEvent->transactionGroup->transactionJournals;
- $array = [];
+ $journals = $updatedGroupEvent->transactionGroup->transactionJournals;
+ $array = [];
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
$array[] = $journal->id;
}
- $journalIds = implode(',', $array);
+ $journalIds = implode(',', $array);
app('log')->debug(sprintf('Add local operator for journal(s): %s', $journalIds));
// collect rules:
$ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
$ruleGroupRepository->setUser($updatedGroupEvent->transactionGroup->user);
- $groups = $ruleGroupRepository->getRuleGroupsWithRules('update-journal');
+ $groups = $ruleGroupRepository->getRuleGroupsWithRules('update-journal');
// file rule engine.
- $newRuleEngine = app(RuleEngineInterface::class);
+ $newRuleEngine = app(RuleEngineInterface::class);
$newRuleEngine->setUser($updatedGroupEvent->transactionGroup->user);
$newRuleEngine->addOperator(['type' => 'journal_id', 'value' => $journalIds]);
$newRuleEngine->setRuleGroups($groups);
@@ -78,7 +78,7 @@ class UpdatedGroupEventHandler
public function recalculateCredit(UpdatedTransactionGroup $event): void
{
- $group = $event->transactionGroup;
+ $group = $event->transactionGroup;
/** @var CreditRecalculateService $object */
$object = app(CreditRecalculateService::class);
@@ -89,13 +89,13 @@ class UpdatedGroupEventHandler
public function triggerWebhooks(UpdatedTransactionGroup $updatedGroupEvent): void
{
app('log')->debug(__METHOD__);
- $group = $updatedGroupEvent->transactionGroup;
+ $group = $updatedGroupEvent->transactionGroup;
if (false === $updatedGroupEvent->fireWebhooks) {
app('log')->info(sprintf('Will not fire webhooks for transaction group #%d', $group->id));
return;
}
- $user = $group->user;
+ $user = $group->user;
/** @var MessageGeneratorInterface $engine */
$engine = app(MessageGeneratorInterface::class);
@@ -112,14 +112,14 @@ class UpdatedGroupEventHandler
*/
public function unifyAccounts(UpdatedTransactionGroup $updatedGroupEvent): void
{
- $group = $updatedGroupEvent->transactionGroup;
+ $group = $updatedGroupEvent->transactionGroup;
if (1 === $group->transactionJournals->count()) {
return;
}
// first journal:
/** @var null|TransactionJournal $first */
- $first = $group->transactionJournals()
+ $first = $group->transactionJournals()
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC')
@@ -133,15 +133,15 @@ class UpdatedGroupEventHandler
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 */
- $destAccount = $first->transactions()->where('amount', '>', '0')->first()->account;
+ $destAccount = $first->transactions()->where('amount', '>', '0')->first()->account;
- $type = $first->transactionType->type;
+ $type = $first->transactionType->type;
if (TransactionType::TRANSFER === $type || TransactionType::WITHDRAWAL === $type) {
// set all source transactions to source account:
Transaction::whereIn('transaction_journal_id', $all)
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index e928fb27b6..a7c0bad1ee 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -82,8 +82,8 @@ class UserEventHandler
$repository = app(UserRepositoryInterface::class);
/** @var User $user */
- $user = $event->user;
- $count = $repository->count();
+ $user = $event->user;
+ $count = $repository->count();
// only act when there is 1 user in the system and he has no admin rights.
if (1 === $count && !$repository->hasRole($user, 'owner')) {
@@ -115,13 +115,13 @@ class UserEventHandler
*/
public function createGroupMembership(RegisteredUser $event): void
{
- $user = $event->user;
- $groupExists = true;
- $groupTitle = $user->email;
- $index = 1;
+ $user = $event->user;
+ $groupExists = true;
+ $groupTitle = $user->email;
+ $index = 1;
/** @var UserGroup $group */
- $group = null;
+ $group = null;
// create a new group.
while (true === $groupExists) { // @phpstan-ignore-line
@@ -131,7 +131,7 @@ class UserEventHandler
break;
}
- $groupTitle = sprintf('%s-%d', $user->email, $index);
+ $groupTitle = sprintf('%s-%d', $user->email, $index);
++$index;
if ($index > 99) {
throw new FireflyException('Email address can no longer be used for registrations.');
@@ -139,7 +139,7 @@ class UserEventHandler
}
/** @var null|UserRole $role */
- $role = UserRole::where('title', UserRoleEnum::OWNER->value)->first();
+ $role = UserRole::where('title', UserRoleEnum::OWNER->value)->first();
if (null === $role) {
throw new FireflyException('The user role is unexpectedly empty. Did you run all migrations?');
}
@@ -165,7 +165,7 @@ class UserEventHandler
$repository = app(UserRepositoryInterface::class);
/** @var User $user */
- $user = $event->user;
+ $user = $event->user;
if ($repository->hasRole($user, 'demo')) {
// set user back to English.
app('preferences')->setForUser($user, 'language', 'en_US');
@@ -186,7 +186,7 @@ class UserEventHandler
return; // do not email demo user.
}
- $list = app('preferences')->getForUser($user, 'login_ip_history', [])->data;
+ $list = app('preferences')->getForUser($user, 'login_ip_history', [])->data;
if (!is_array($list)) {
$list = [];
}
@@ -375,7 +375,7 @@ class UserEventHandler
public function storeUserIPAddress(ActuallyLoggedIn $event): void
{
app('log')->debug('Now in storeUserIPAddress');
- $user = $event->user;
+ $user = $event->user;
if ($user->hasRole('demo')) {
app('log')->debug('Do not log demo user logins');
@@ -392,8 +392,8 @@ class UserEventHandler
return;
}
- $inArray = false;
- $ip = request()->ip();
+ $inArray = false;
+ $ip = request()->ip();
app('log')->debug(sprintf('User logging in from IP address %s', $ip));
// update array if in array
@@ -421,7 +421,7 @@ class UserEventHandler
$preference = array_values($preference);
/** @var bool $send */
- $send = app('preferences')->getForUser($user, 'notification_user_login', true)->data;
+ $send = app('preferences')->getForUser($user, 'notification_user_login', true)->data;
app('preferences')->setForUser($user, 'login_ip_history', $preference);
if (false === $inArray && true === $send) {
diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php
index 56f060d678..70a104ac07 100644
--- a/app/Handlers/Events/VersionCheckEventHandler.php
+++ b/app/Handlers/Events/VersionCheckEventHandler.php
@@ -48,8 +48,8 @@ class VersionCheckEventHandler
app('log')->debug('Now in checkForUpdates()');
// should not check for updates:
- $permission = app('fireflyconfig')->get('permission_update_check', -1);
- $value = (int)$permission->data;
+ $permission = app('fireflyconfig')->get('permission_update_check', -1);
+ $value = (int)$permission->data;
if (1 !== $value) {
app('log')->debug('Update check is not enabled.');
$this->warnToCheckForUpdates($event);
@@ -58,8 +58,8 @@ class VersionCheckEventHandler
}
/** @var UserRepositoryInterface $repository */
- $repository = app(UserRepositoryInterface::class);
- $user = $event->user;
+ $repository = app(UserRepositoryInterface::class);
+ $user = $event->user;
if (!$repository->hasRole($user, 'owner')) {
app('log')->debug('User is not admin, done.');
@@ -78,7 +78,7 @@ class VersionCheckEventHandler
}
// last check time was more than a week ago.
app('log')->debug('Have not checked for a new version in a week!');
- $release = $this->getLatestRelease();
+ $release = $this->getLatestRelease();
session()->flash($release['level'], $release['message']);
app('fireflyconfig')->set('last_update_check', time());
@@ -90,8 +90,8 @@ class VersionCheckEventHandler
protected function warnToCheckForUpdates(RequestedVersionCheckStatus $event): void
{
/** @var UserRepositoryInterface $repository */
- $repository = app(UserRepositoryInterface::class);
- $user = $event->user;
+ $repository = app(UserRepositoryInterface::class);
+ $user = $event->user;
if (!$repository->hasRole($user, 'owner')) {
app('log')->debug('User is not admin, done.');
diff --git a/app/Handlers/Observer/PiggyBankObserver.php b/app/Handlers/Observer/PiggyBankObserver.php
index 7f56a3fefb..7e9b879892 100644
--- a/app/Handlers/Observer/PiggyBankObserver.php
+++ b/app/Handlers/Observer/PiggyBankObserver.php
@@ -34,7 +34,7 @@ class PiggyBankObserver
public function created(PiggyBank $piggyBank): void
{
app('log')->debug('Observe "created" of a piggy bank.');
- $repetition = new PiggyBankRepetition();
+ $repetition = new PiggyBankRepetition();
$repetition->piggyBank()->associate($piggyBank);
$repetition->startdate = $piggyBank->startdate;
$repetition->targetdate = $piggyBank->targetdate;
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index b357c64626..b3b22d058a 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -117,7 +117,7 @@ class AttachmentHelper implements AttachmentHelperInterface
public function saveAttachmentFromApi(Attachment $attachment, string $content): bool
{
Log::debug(sprintf('Now in %s', __METHOD__));
- $resource = tmpfile();
+ $resource = tmpfile();
if (false === $resource) {
Log::error('Cannot create temp-file for file upload.');
@@ -130,24 +130,24 @@ class AttachmentHelper implements AttachmentHelperInterface
return false;
}
- $path = stream_get_meta_data($resource)['uri'];
+ $path = stream_get_meta_data($resource)['uri'];
Log::debug(sprintf('Path is %s', $path));
- $result = fwrite($resource, $content);
+ $result = fwrite($resource, $content);
if (false === $result) {
Log::error('Could not write temp file.');
return false;
}
Log::debug(sprintf('Wrote %d bytes to temp file.', $result));
- $finfo = finfo_open(FILEINFO_MIME_TYPE);
+ $finfo = finfo_open(FILEINFO_MIME_TYPE);
if (false === $finfo) {
Log::error('Could not open finfo.');
fclose($resource);
return false;
}
- $mime = (string)finfo_file($finfo, $path);
- $allowedMime = config('firefly.allowedMimes');
+ $mime = (string)finfo_file($finfo, $path);
+ $allowedMime = config('firefly.allowedMimes');
if (!in_array($mime, $allowedMime, true)) {
Log::error(sprintf('Mime type %s is not allowed for API file upload.', $mime));
fclose($resource);
@@ -156,8 +156,8 @@ class AttachmentHelper implements AttachmentHelperInterface
}
Log::debug(sprintf('Found mime "%s" in file "%s"', $mime, $path));
// is allowed? Save the file, without encryption.
- $parts = explode('/', $attachment->fileName());
- $file = $parts[count($parts) - 1];
+ $parts = explode('/', $attachment->fileName());
+ $file = $parts[count($parts) - 1];
Log::debug(sprintf('Write file to disk in file named "%s"', $file));
$this->uploadDisk->put($file, $content);
@@ -215,13 +215,13 @@ class AttachmentHelper implements AttachmentHelperInterface
$validation = $this->validateUpload($file, $model);
$attachment = null;
if (false !== $validation) {
- $user = $model->user;
+ $user = $model->user;
// ignore lines about polymorphic calls.
if ($model instanceof PiggyBank) {
$user = $model->account->user;
}
- $attachment = new Attachment(); // create Attachment object.
+ $attachment = new Attachment(); // create Attachment object.
$attachment->user()->associate($user);
$attachment->attachable()->associate($model);
$attachment->md5 = (string)md5_file($file->getRealPath());
@@ -232,14 +232,14 @@ class AttachmentHelper implements AttachmentHelperInterface
$attachment->save();
Log::debug('Created attachment:', $attachment->toArray());
- $fileObject = $file->openFile();
+ $fileObject = $file->openFile();
$fileObject->rewind();
if (0 === $file->getSize()) {
throw new FireflyException('Cannot upload empty or non-existent file.');
}
- $content = (string)$fileObject->fread($file->getSize());
+ $content = (string)$fileObject->fread($file->getSize());
Log::debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize()));
// store it without encryption.
@@ -248,8 +248,8 @@ class AttachmentHelper implements AttachmentHelperInterface
$attachment->save();
$this->attachments->push($attachment);
- $name = e($file->getClientOriginalName()); // add message:
- $msg = (string)trans('validation.file_attached', ['name' => $name]);
+ $name = e($file->getClientOriginalName()); // add message:
+ $msg = (string)trans('validation.file_attached', ['name' => $name]);
$this->messages->add('attachments', $msg);
}
@@ -289,14 +289,14 @@ class AttachmentHelper implements AttachmentHelperInterface
protected function validMime(UploadedFile $file): bool
{
Log::debug('Now in validMime()');
- $mime = e($file->getMimeType());
- $name = e($file->getClientOriginalName());
+ $mime = e($file->getMimeType());
+ $name = e($file->getClientOriginalName());
Log::debug(sprintf('Name is %s, and mime is %s', $name, $mime));
Log::debug('Valid mimes are', $this->allowedMimes);
$result = true;
if (!in_array($mime, $this->allowedMimes, true)) {
- $msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]);
+ $msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]);
$this->errors->add('attachments', $msg);
Log::error($msg);
@@ -315,7 +315,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$name = e($file->getClientOriginalName());
$result = true;
if ($size > $this->maxUploadSize) {
- $msg = (string)trans('validation.file_too_large', ['name' => $name]);
+ $msg = (string)trans('validation.file_too_large', ['name' => $name]);
$this->errors->add('attachments', $msg);
Log::error($msg);
@@ -330,10 +330,10 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
protected function hasFile(UploadedFile $file, Model $model): bool
{
- $md5 = md5_file($file->getRealPath());
- $name = $file->getClientOriginalName();
- $class = get_class($model);
- $count = 0;
+ $md5 = md5_file($file->getRealPath());
+ $name = $file->getClientOriginalName();
+ $class = get_class($model);
+ $count = 0;
// ignore lines about polymorphic calls.
if ($model instanceof PiggyBank) {
$count = $model->account->user->attachments()->where('md5', $md5)->where('attachable_id', $model->id)->where('attachable_type', $class)->count();
@@ -343,7 +343,7 @@ class AttachmentHelper implements AttachmentHelperInterface
}
$result = false;
if ($count > 0) {
- $msg = (string)trans('validation.file_already_attached', ['name' => $name]);
+ $msg = (string)trans('validation.file_already_attached', ['name' => $name]);
$this->errors->add('attachments', $msg);
Log::error($msg);
$result = true;
diff --git a/app/Helpers/Collector/Extensions/AccountCollection.php b/app/Helpers/Collector/Extensions/AccountCollection.php
index 9ababe58e5..1de78d7f31 100644
--- a/app/Helpers/Collector/Extensions/AccountCollection.php
+++ b/app/Helpers/Collector/Extensions/AccountCollection.php
@@ -211,9 +211,9 @@ trait AccountCollection
$this->query->leftJoin('account_types as source_account_type', 'source_account_type.id', '=', 'source_account.account_type_id');
// add source account fields:
- $this->fields[] = 'source_account.name as source_account_name';
- $this->fields[] = 'source_account.iban as source_account_iban';
- $this->fields[] = 'source_account_type.type as source_account_type';
+ $this->fields[] = 'source_account.name as source_account_name';
+ $this->fields[] = 'source_account.iban as source_account_iban';
+ $this->fields[] = 'source_account_type.type as source_account_type';
// same for dest
$this->query->leftJoin('accounts as dest_account', 'dest_account.id', '=', 'destination.account_id');
diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php
index a7b5e641d7..5f79b8d0b5 100644
--- a/app/Helpers/Collector/Extensions/MetaCollection.php
+++ b/app/Helpers/Collector/Extensions/MetaCollection.php
@@ -682,12 +682,12 @@ trait MetaCollection
$list = $tags->pluck('tag')->toArray();
$list = array_map('strtolower', $list);
$filter = static function (array $object) use ($list): bool|array {
- $return = $object;
+ $return = $object;
unset($return['transactions']);
$return['transactions'] = [];
Log::debug(sprintf('Now in setAllTags(%s) filter', implode(', ', $list)));
- $expectedTagCount = count($list);
- $foundTagCount = 0;
+ $expectedTagCount = count($list);
+ $foundTagCount = 0;
foreach ($object['transactions'] as $transaction) {
$transactionTagCount = count($transaction['tags']);
app('log')->debug(sprintf('Transaction #%d has %d tag(s)', $transaction['transaction_journal_id'], $transactionTagCount));
@@ -708,7 +708,7 @@ trait MetaCollection
Log::debug(sprintf('Found %d tags, need at least %d.', $foundTagCount, $expectedTagCount));
// found at least the expected tags.
- $result = $foundTagCount >= $expectedTagCount;
+ $result = $foundTagCount >= $expectedTagCount;
if (true === $result) {
return $return;
}
@@ -941,8 +941,8 @@ trait MetaCollection
if (false === $this->hasJoinedMetaTables) {
$this->hasJoinedMetaTables = true;
$this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id');
- $this->fields[] = 'journal_meta.name as meta_name';
- $this->fields[] = 'journal_meta.data as meta_data';
+ $this->fields[] = 'journal_meta.name as meta_name';
+ $this->fields[] = 'journal_meta.data as meta_data';
}
}
diff --git a/app/Helpers/Collector/Extensions/TimeCollection.php b/app/Helpers/Collector/Extensions/TimeCollection.php
index 2f4d8a499a..32b011fa88 100644
--- a/app/Helpers/Collector/Extensions/TimeCollection.php
+++ b/app/Helpers/Collector/Extensions/TimeCollection.php
@@ -65,7 +65,7 @@ trait TimeCollection
if ($end < $start) {
[$start, $end] = [$end, $start];
}
- $end = clone $end; // this is so weird, but it works if $end and $start secretly point to the same object.
+ $end = clone $end; // this is so weird, but it works if $end and $start secretly point to the same object.
$end->endOfDay();
$start->startOfDay();
$this->withMetaDate($field);
@@ -536,7 +536,7 @@ trait TimeCollection
if ($end < $start) {
[$start, $end] = [$end, $start];
}
- $end = clone $end; // this is so weird, but it works if $end and $start secretly point to the same object.
+ $end = clone $end; // this is so weird, but it works if $end and $start secretly point to the same object.
$end->endOfDay();
$start->startOfDay();
$this->withMetaDate($field);
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index 1727c1cadb..d746f1cbd2 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -62,12 +62,12 @@ class GroupCollector implements GroupCollectorInterface
*/
public function __construct()
{
- $this->postFilters = [];
- $this->tags = [];
- $this->user = null;
- $this->userGroup = null;
- $this->limit = null;
- $this->page = null;
+ $this->postFilters = [];
+ $this->tags = [];
+ $this->user = null;
+ $this->userGroup = null;
+ $this->limit = null;
+ $this->page = null;
$this->hasAccountInfo = false;
$this->hasCatInformation = false;
@@ -287,7 +287,7 @@ class GroupCollector implements GroupCollectorInterface
if (is_int($param)) {
$replace = (string)$param;
}
- $pos = strpos($query, '?');
+ $pos = strpos($query, '?');
if (false !== $pos) {
$query = substr_replace($query, $replace, $pos, 1);
}
@@ -455,13 +455,13 @@ class GroupCollector implements GroupCollectorInterface
// add to query:
$this->query->orWhereIn('transaction_journals.transaction_group_id', $groupIds);
}
- $result = $this->query->get($this->fields);
+ $result = $this->query->get($this->fields);
// now to parse this into an array.
- $collection = $this->parseArray($result);
+ $collection = $this->parseArray($result);
// filter the array using all available post filters:
- $collection = $this->postFilterCollection($collection);
+ $collection = $this->postFilterCollection($collection);
// count it and continue:
$this->total = $collection->count();
@@ -691,12 +691,12 @@ class GroupCollector implements GroupCollectorInterface
/** @var TransactionJournal $augumentedJournal */
foreach ($collection as $augumentedJournal) {
- $groupId = (int)$augumentedJournal->transaction_group_id;
+ $groupId = (int)$augumentedJournal->transaction_group_id;
if (!array_key_exists($groupId, $groups)) {
// make new array
- $parsedGroup = $this->parseAugmentedJournal($augumentedJournal);
- $groupArray = [
+ $parsedGroup = $this->parseAugmentedJournal($augumentedJournal);
+ $groupArray = [
'id' => (int)$augumentedJournal->transaction_group_id,
'user_id' => $augumentedJournal->user_id,
'user_group_id' => $augumentedJournal->user_group_id,
@@ -766,7 +766,7 @@ class GroupCollector implements GroupCollectorInterface
}
// try to process meta date value (if present)
- $dates = ['interest_date', 'payment_date', 'invoice_date', 'book_date', 'due_date', 'process_date'];
+ $dates = ['interest_date', 'payment_date', 'invoice_date', 'book_date', 'due_date', 'process_date'];
if (array_key_exists('meta_name', $result) && in_array($result['meta_name'], $dates, true)) {
$name = $result['meta_name'];
if (array_key_exists('meta_data', $result) && '' !== (string)$result['meta_data']) {
@@ -775,15 +775,15 @@ class GroupCollector implements GroupCollectorInterface
}
// convert values to integers:
- $result = $this->convertToInteger($result);
+ $result = $this->convertToInteger($result);
// convert back to strings because SQLite is dumb like that.
- $result = $this->convertToStrings($result);
+ $result = $this->convertToStrings($result);
- $result['reconciled'] = 1 === (int)$result['reconciled'];
+ $result['reconciled'] = 1 === (int)$result['reconciled'];
if (array_key_exists('tag_id', $result) && null !== $result['tag_id']) { // assume the other fields are present as well.
- $tagId = (int)$augumentedJournal['tag_id'];
- $tagDate = null;
+ $tagId = (int)$augumentedJournal['tag_id'];
+ $tagDate = null;
try {
$tagDate = Carbon::parse($augumentedJournal['tag_date']);
@@ -847,9 +847,9 @@ class GroupCollector implements GroupCollectorInterface
{
$newArray = $newJournal->toArray();
if (array_key_exists('tag_id', $newArray)) { // assume the other fields are present as well.
- $tagId = (int)$newJournal['tag_id'];
+ $tagId = (int)$newJournal['tag_id'];
- $tagDate = null;
+ $tagDate = null;
try {
$tagDate = Carbon::parse($newArray['tag_date']);
@@ -872,7 +872,7 @@ class GroupCollector implements GroupCollectorInterface
{
$newArray = $newJournal->toArray();
if (array_key_exists('attachment_id', $newArray)) {
- $attachmentId = (int)$newJournal['attachment_id'];
+ $attachmentId = (int)$newJournal['attachment_id'];
$existingJournal['attachments'][$attachmentId] = [
'id' => $attachmentId,
@@ -891,7 +891,7 @@ class GroupCollector implements GroupCollectorInterface
foreach ($groups as $groudId => $group) {
/** @var array $transaction */
foreach ($group['transactions'] as $transaction) {
- $currencyId = (int)$transaction['currency_id'];
+ $currencyId = (int)$transaction['currency_id'];
if (null === $transaction['amount']) {
throw new FireflyException(sprintf('Amount is NULL for a transaction in group #%d, please investigate.', $groudId));
}
@@ -907,7 +907,7 @@ class GroupCollector implements GroupCollectorInterface
$groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['amount']);
if (null !== $transaction['foreign_amount'] && null !== $transaction['foreign_currency_id']) {
- $currencyId = (int)$transaction['foreign_currency_id'];
+ $currencyId = (int)$transaction['foreign_currency_id'];
// set default:
if (!array_key_exists($currencyId, $groups[$groudId]['sums'])) {
@@ -936,7 +936,7 @@ class GroupCollector implements GroupCollectorInterface
*/
foreach ($this->postFilters as $function) {
app('log')->debug('Applying filter...');
- $nextCollection = new Collection();
+ $nextCollection = new Collection();
// loop everything in the current collection
// and save it (or not) in the new collection.
diff --git a/app/Helpers/Fiscal/FiscalHelper.php b/app/Helpers/Fiscal/FiscalHelper.php
index 8516319741..c977bc773b 100644
--- a/app/Helpers/Fiscal/FiscalHelper.php
+++ b/app/Helpers/Fiscal/FiscalHelper.php
@@ -74,7 +74,7 @@ class FiscalHelper implements FiscalHelperInterface
$prefStartStr = '01-01';
}
$prefStartStr = (string)$prefStartStr;
- [$mth, $day] = explode('-', $prefStartStr);
+ [$mth, $day] = explode('-', $prefStartStr);
$startDate->day((int)$day)->month((int)$mth);
// if start date is after passed date, sub 1 year.
diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php
index 700097b263..e66ca81732 100644
--- a/app/Helpers/Report/NetWorth.php
+++ b/app/Helpers/Report/NetWorth.php
@@ -64,8 +64,8 @@ class NetWorth implements NetWorthInterface
public function byAccounts(Collection $accounts, Carbon $date): array
{
// start in the past, end in the future? use $date
- $ids = implode(',', $accounts->pluck('id')->toArray());
- $cache = new CacheProperties();
+ $ids = implode(',', $accounts->pluck('id')->toArray());
+ $cache = new CacheProperties();
$cache->addProperty($date);
$cache->addProperty('net-worth-by-accounts');
$cache->addProperty($ids);
@@ -78,7 +78,7 @@ class NetWorth implements NetWorthInterface
$converter = new ExchangeRateConverter();
// default "native" currency has everything twice, for consistency.
- $netWorth = [
+ $netWorth = [
'native' => [
'balance' => '0',
'native_balance' => '0',
@@ -94,25 +94,25 @@ class NetWorth implements NetWorthInterface
'native_currency_decimal_places' => $default->decimal_places,
],
];
- $balances = app('steam')->balancesByAccountsConverted($accounts, $date);
+ $balances = app('steam')->balancesByAccountsConverted($accounts, $date);
/** @var Account $account */
foreach ($accounts as $account) {
app('log')->debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name));
- $currency = $this->getRepository()->getAccountCurrency($account);
+ $currency = $this->getRepository()->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrency();
}
- $currencyCode = $currency->code;
- $balance = '0';
- $nativeBalance = '0';
+ $currencyCode = $currency->code;
+ $balance = '0';
+ $nativeBalance = '0';
if (array_key_exists($account->id, $balances)) {
$balance = $balances[$account->id]['balance'] ?? '0';
$nativeBalance = $balances[$account->id]['native_balance'] ?? '0';
}
app('log')->debug(sprintf('Balance is %s, native balance is %s', $balance, $nativeBalance));
// always subtract virtual balance
- $virtualBalance = $account->virtual_balance;
+ $virtualBalance = $account->virtual_balance;
if ('' !== $virtualBalance) {
$balance = bcsub($balance, $virtualBalance);
$nativeVirtualBalance = $converter->convert($default, $currency, $account->created_at, $virtualBalance);
@@ -149,14 +149,14 @@ class NetWorth implements NetWorthInterface
if (!$user instanceof User) {
return;
}
- $this->user = $user;
- $this->userGroup = null;
+ $this->user = $user;
+ $this->userGroup = null;
// make repository:
$this->accountRepository = app(AccountRepositoryInterface::class);
$this->accountRepository->setUser($this->user);
- $this->currencyRepos = app(CurrencyRepositoryInterface::class);
+ $this->currencyRepos = app(CurrencyRepositoryInterface::class);
$this->currencyRepos->setUser($this->user);
}
@@ -179,16 +179,16 @@ class NetWorth implements NetWorthInterface
$return = [];
$balances = app('steam')->balancesByAccounts($accounts, $date);
foreach ($accounts as $account) {
- $currency = $this->getRepository()->getAccountCurrency($account);
- $balance = $balances[$account->id] ?? '0';
+ $currency = $this->getRepository()->getAccountCurrency($account);
+ $balance = $balances[$account->id] ?? '0';
// always subtract virtual balance.
- $virtualBalance = $account->virtual_balance;
+ $virtualBalance = $account->virtual_balance;
if ('' !== $virtualBalance) {
$balance = bcsub($balance, $virtualBalance);
}
- $return[$currency->id] ??= [
+ $return[$currency->id] ??= [
'id' => (string) $currency->id,
'name' => $currency->name,
'symbol' => $currency->symbol,
diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php
index c9a2c3aa9e..e5276d6161 100644
--- a/app/Helpers/Report/PopupReport.php
+++ b/app/Helpers/Report/PopupReport.php
@@ -70,7 +70,7 @@ class PopupReport implements PopupReportInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector
->setAccounts(new Collection([$account]))
->setTypes([TransactionType::WITHDRAWAL])
@@ -102,7 +102,7 @@ class PopupReport implements PopupReportInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($attributes['accounts'])
->withAccountInformation()
->withBudgetInformation()
@@ -139,7 +139,7 @@ class PopupReport implements PopupReportInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($attributes['accounts'])
->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER, TransactionType::DEPOSIT])
@@ -169,8 +169,8 @@ class PopupReport implements PopupReportInterface
public function byExpenses(Account $account, array $attributes): array
{
// filter by currency, if set.
- $currencyId = $attributes['currencyId'] ?? null;
- $currency = null;
+ $currencyId = $attributes['currencyId'] ?? null;
+ $currency = null;
if (null !== $currencyId) {
/** @var CurrencyRepositoryInterface $repos */
$repos = app(CurrencyRepositoryInterface::class);
@@ -178,14 +178,14 @@ class PopupReport implements PopupReportInterface
}
/** @var JournalRepositoryInterface $repository */
- $repository = app(JournalRepositoryInterface::class);
+ $repository = app(JournalRepositoryInterface::class);
$repository->setUser($account->user);
$accountRepository = app(AccountRepositoryInterface::class);
$accountRepository->setUser($account->user);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
// set report accounts + the request accounts:
// $set = $attributes['accounts'] ?? new Collection;
@@ -216,7 +216,7 @@ class PopupReport implements PopupReportInterface
$repository->setUser($account->user);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector
->setSourceAccounts(new Collection([$account]))
->setDestinationAccounts($attributes['accounts'])
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php
index ce736b7d33..9582c7287d 100644
--- a/app/Helpers/Report/ReportHelper.php
+++ b/app/Helpers/Report/ReportHelper.php
@@ -64,10 +64,10 @@ class ReportHelper implements ReportHelperInterface
/** @var Bill $bill */
foreach ($bills as $bill) {
- $expectedDates = $repository->getPayDatesInRange($bill, $start, $end);
- $billId = $bill->id;
- $currency = $bill->transactionCurrency;
- $current = [
+ $expectedDates = $repository->getPayDatesInRange($bill, $start, $end);
+ $billId = $bill->id;
+ $currency = $bill->transactionCurrency;
+ $current = [
'id' => $bill->id,
'name' => $bill->name,
'active' => $bill->active,
@@ -84,11 +84,11 @@ class ReportHelper implements ReportHelperInterface
/** @var Carbon $expectedStart */
foreach ($expectedDates as $expectedStart) {
- $expectedEnd = app('navigation')->endOfX($expectedStart, $bill->repeat_freq, null);
+ $expectedEnd = app('navigation')->endOfX($expectedStart, $bill->repeat_freq, null);
// is paid in this period maybe?
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($expectedStart, $expectedEnd)->setBill($bill);
$current['paid_moments'][] = $collector->getExtractedJournals();
}
@@ -109,12 +109,12 @@ class ReportHelper implements ReportHelperInterface
$fiscalHelper = app(FiscalHelperInterface::class);
$start = clone $date;
$start->startOfMonth();
- $end = today(config('app.timezone'));
+ $end = today(config('app.timezone'));
$end->endOfMonth();
- $months = [];
+ $months = [];
while ($start <= $end) {
- $year = $fiscalHelper->endOfFiscalYear($start)->year; // current year
+ $year = $fiscalHelper->endOfFiscalYear($start)->year; // current year
if (!array_key_exists($year, $months)) {
$months[$year] = [
'fiscal_start' => $fiscalHelper->startOfFiscalYear($start)->format('Y-m-d'),
@@ -125,7 +125,7 @@ class ReportHelper implements ReportHelperInterface
];
}
- $currentEnd = clone $start;
+ $currentEnd = clone $start;
$currentEnd->endOfMonth();
$months[$year]['months'][] = [
'formatted' => $start->isoFormat((string)trans('config.month_js')),
@@ -135,7 +135,7 @@ class ReportHelper implements ReportHelperInterface
'year' => $year,
];
- $start = clone $currentEnd; // to make the hop to the next month properly
+ $start = clone $currentEnd; // to make the hop to the next month properly
$start->addDay();
}
diff --git a/app/Helpers/Webhook/Sha3SignatureGenerator.php b/app/Helpers/Webhook/Sha3SignatureGenerator.php
index 708088851f..dfa342af70 100644
--- a/app/Helpers/Webhook/Sha3SignatureGenerator.php
+++ b/app/Helpers/Webhook/Sha3SignatureGenerator.php
@@ -42,7 +42,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
if (null === $message->webhook) {
throw new FireflyException('Part of a deleted webhook.');
}
- $json = '';
+ $json = '';
try {
$json = json_encode($message->message, JSON_THROW_ON_ERROR);
diff --git a/app/Http/Controllers/Account/CreateController.php b/app/Http/Controllers/Account/CreateController.php
index a7ace0460b..5e06f5aa29 100644
--- a/app/Http/Controllers/Account/CreateController.php
+++ b/app/Http/Controllers/Account/CreateController.php
@@ -95,7 +95,7 @@ class CreateController extends Controller
];
// interest calculation periods:
- $interestPeriods = [
+ $interestPeriods = [
'daily' => (string)trans('firefly.interest_calc_daily'),
'monthly' => (string)trans('firefly.interest_calc_monthly'),
'yearly' => (string)trans('firefly.interest_calc_yearly'),
@@ -132,8 +132,8 @@ class CreateController extends Controller
*/
public function store(AccountFormRequest $request)
{
- $data = $request->getAccountData();
- $account = $this->repository->store($data);
+ $data = $request->getAccountData();
+ $account = $this->repository->store($data);
$request->session()->flash('success', (string)trans('firefly.stored_new_account', ['name' => $account->name]));
app('preferences')->mark();
@@ -151,7 +151,7 @@ class CreateController extends Controller
// store attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($account, $files);
}
@@ -165,7 +165,7 @@ class CreateController extends Controller
}
// redirect to previous URL.
- $redirect = redirect($this->getPreviousUrl('accounts.create.url'));
+ $redirect = redirect($this->getPreviousUrl('accounts.create.url'));
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/EditController.php b/app/Http/Controllers/Account/EditController.php
index 109097f394..91f1e6715c 100644
--- a/app/Http/Controllers/Account/EditController.php
+++ b/app/Http/Controllers/Account/EditController.php
@@ -80,17 +80,17 @@ class EditController extends Controller
return $this->redirectAccountToAccount($account);
}
- $objectType = config('firefly.shortNamesByFullName')[$account->accountType->type];
- $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();
- $location = $repository->getLocation($account);
- $latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
- $longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
- $zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
- $hasLocation = null !== $location;
- $locations = [
+ $objectType = config('firefly.shortNamesByFullName')[$account->accountType->type];
+ $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();
+ $location = $repository->getLocation($account);
+ $latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
+ $longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
+ $zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
+ $hasLocation = null !== $location;
+ $locations = [
'location' => [
'latitude' => null !== old('location_latitude') ? old('location_latitude') : $latitude,
'longitude' => null !== old('location_longitude') ? old('location_longitude') : $longitude,
@@ -99,13 +99,13 @@ class EditController extends Controller
],
];
- $liabilityDirections = [
+ $liabilityDirections = [
'debit' => trans('firefly.liability_direction_debit'),
'credit' => trans('firefly.liability_direction_credit'),
];
// interest calculation periods:
- $interestPeriods = [
+ $interestPeriods = [
'daily' => (string) trans('firefly.interest_calc_daily'),
'monthly' => (string) trans('firefly.interest_calc_monthly'),
'yearly' => (string) trans('firefly.interest_calc_yearly'),
@@ -121,17 +121,17 @@ class EditController extends Controller
if ('0' === $openingBalanceAmount) {
$openingBalanceAmount = '';
}
- $openingBalanceDate = $repository->getOpeningBalanceDate($account);
- $currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
+ $openingBalanceDate = $repository->getOpeningBalanceDate($account);
+ $currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
// include this account in net-worth charts?
- $includeNetWorth = $repository->getMetaValue($account, 'include_net_worth');
- $includeNetWorth = null === $includeNetWorth ? true : '1' === $includeNetWorth;
+ $includeNetWorth = $repository->getMetaValue($account, 'include_net_worth');
+ $includeNetWorth = null === $includeNetWorth ? true : '1' === $includeNetWorth;
// code to handle active-checkboxes
- $hasOldInput = null !== $request->old('_token');
- $virtualBalance = null === $account->virtual_balance ? '0' : $account->virtual_balance;
- $preFilled = [
+ $hasOldInput = null !== $request->old('_token');
+ $virtualBalance = null === $account->virtual_balance ? '0' : $account->virtual_balance;
+ $preFilled = [
'account_number' => $repository->getMetaValue($account, 'account_number'),
'account_role' => $repository->getMetaValue($account, 'account_role'),
'cc_type' => $repository->getMetaValue($account, 'cc_type'),
@@ -169,14 +169,14 @@ class EditController extends Controller
return $this->redirectAccountToAccount($account);
}
- $data = $request->getAccountData();
+ $data = $request->getAccountData();
$this->repository->update($account, $data);
Log::channel('audit')->info(sprintf('Updated account #%d.', $account->id), $data);
$request->session()->flash('success', (string) trans('firefly.updated_account', ['name' => $account->name]));
// store new attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($account, $files);
}
diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php
index 12ebab549b..870999de13 100644
--- a/app/Http/Controllers/Account/IndexController.php
+++ b/app/Http/Controllers/Account/IndexController.php
@@ -70,22 +70,22 @@ class IndexController extends Controller
* */
public function inactive(Request $request, string $objectType)
{
- $inactivePage = true;
- $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;
- $accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
+ $inactivePage = true;
+ $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;
+ $accounts = $collection->slice(($page - 1) * $pageSize, $pageSize);
unset($collection);
/** @var Carbon $start */
- $start = clone session('start', today(config('app.timezone'))->startOfMonth());
+ $start = clone session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = clone session('end', today(config('app.timezone'))->endOfMonth());
+ $end = clone session('end', today(config('app.timezone'))->endOfMonth());
$start->subDay();
$ids = $accounts->pluck('id')->toArray();
@@ -108,7 +108,7 @@ class IndexController extends Controller
);
// make paginator:
- $accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
+ $accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
$accounts->setPath(route('accounts.inactive.index', [$objectType]));
return view('accounts.index', compact('objectType', 'inactivePage', 'subTitleIcon', 'subTitle', 'page', 'accounts'));
@@ -124,9 +124,9 @@ class IndexController extends Controller
public function index(Request $request, string $objectType)
{
app('log')->debug(sprintf('Now at %s', __METHOD__));
- $subTitle = (string)trans(sprintf('firefly.%s_accounts', $objectType));
- $subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));
- $types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));
+ $subTitle = (string)trans(sprintf('firefly.%s_accounts', $objectType));
+ $subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));
+ $types = config(sprintf('firefly.accountTypesByIdentifier.%s', $objectType));
$this->repository->resetAccountOrder();
@@ -142,10 +142,10 @@ class IndexController extends Controller
unset($collection);
/** @var Carbon $start */
- $start = clone session('start', today(config('app.timezone'))->startOfMonth());
+ $start = clone session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = clone session('end', today(config('app.timezone'))->endOfMonth());
+ $end = clone session('end', today(config('app.timezone'))->endOfMonth());
$start->subDay();
$ids = $accounts->pluck('id')->toArray();
@@ -155,8 +155,8 @@ class IndexController extends Controller
$accounts->each(
function (Account $account) use ($activities, $startBalances, $endBalances): void {
- $interest = (string)$this->repository->getMetaValue($account, 'interest');
- $interest = '' === $interest ? '0' : $interest;
+ $interest = (string)$this->repository->getMetaValue($account, 'interest');
+ $interest = '' === $interest ? '0' : $interest;
// See reference nr. 68
$account->lastActivityDate = $this->isInArrayDate($activities, $account->id);
@@ -178,7 +178,7 @@ class IndexController extends Controller
app('log')->debug(sprintf('Count of accounts before LAP: %d', $accounts->count()));
/** @var LengthAwarePaginator $accounts */
- $accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
+ $accounts = new LengthAwarePaginator($accounts, $total, $pageSize, $page);
$accounts->setPath(route('accounts.index', [$objectType]));
app('log')->debug(sprintf('Count of accounts after LAP (1): %d', $accounts->count()));
diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php
index efaf41c6db..59ffa098c2 100644
--- a/app/Http/Controllers/Account/ReconcileController.php
+++ b/app/Http/Controllers/Account/ReconcileController.php
@@ -85,10 +85,10 @@ class ReconcileController extends Controller
return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))]));
}
- $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
+ $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
// no start or end:
- $range = app('navigation')->getViewRange(false);
+ $range = app('navigation')->getViewRange(false);
// get start and end
@@ -97,7 +97,7 @@ class ReconcileController extends Controller
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon(), $range));
/** @var Carbon $end */
- $end = clone session('end', app('navigation')->endOfPeriod(new Carbon(), $range));
+ $end = clone session('end', app('navigation')->endOfPeriod(new Carbon(), $range));
}
if (null === $end) {
/** @var Carbon $end */
@@ -108,12 +108,12 @@ class ReconcileController extends Controller
[$start, $end] = [$end, $start];
}
- $startDate = clone $start;
+ $startDate = clone $start;
$startDate->subDay();
- $startBalance = app('steam')->bcround(app('steam')->balance($account, $startDate), $currency->decimal_places);
- $endBalance = app('steam')->bcround(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]);
+ $startBalance = app('steam')->bcround(app('steam')->balance($account, $startDate), $currency->decimal_places);
+ $endBalance = app('steam')->bcround(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]);
// various links
$transactionsUrl = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']);
@@ -154,7 +154,7 @@ class ReconcileController extends Controller
}
app('log')->debug('In ReconcileController::submit()');
- $data = $request->getAll();
+ $data = $request->getAll();
/** @var string $journalId */
foreach ($data['journals'] as $journalId) {
@@ -209,14 +209,14 @@ class ReconcileController extends Controller
}
// title:
- $description = trans(
+ $description = trans(
'firefly.reconciliation_transaction_title',
[
'from' => $start->isoFormat($this->monthAndDayFormat),
'to' => $end->isoFormat($this->monthAndDayFormat),
]
);
- $submission = [
+ $submission = [
'user' => auth()->user()->id,
'group_title' => null,
'transactions' => [
@@ -238,10 +238,10 @@ class ReconcileController extends Controller
];
/** @var TransactionGroupFactory $factory */
- $factory = app(TransactionGroupFactory::class);
+ $factory = app(TransactionGroupFactory::class);
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
$factory->setUser($user);
try {
diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php
index 2b9c398578..5d5a11085e 100644
--- a/app/Http/Controllers/Account/ShowController.php
+++ b/app/Http/Controllers/Account/ShowController.php
@@ -77,7 +77,7 @@ class ShowController extends Controller
* */
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
{
- $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
+ $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
if (!$this->isEditableAccount($account)) {
return $this->redirectAccountToAccount($account);
@@ -86,7 +86,7 @@ class ShowController extends Controller
// @var Carbon $start
$start ??= session('start');
// @var Carbon $end
- $end ??= session('end');
+ $end ??= session('end');
if ($end < $start) {
[$start, $end] = [$end, $start];
@@ -111,7 +111,7 @@ class ShowController extends Controller
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector
->setAccounts(new Collection([$account]))
->setLimit($pageSize)
@@ -123,11 +123,11 @@ class ShowController extends Controller
// is just part of ONE of the journals. To force this:
$collector->setExpandGroupSearch(true);
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]));
- $showAll = false;
- $balance = app('steam')->balance($account, $end);
+ $showAll = false;
+ $balance = app('steam')->balance($account, $end);
return view(
'accounts.show',
@@ -178,18 +178,18 @@ class ShowController extends Controller
$periods = new Collection();
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation();
// this search will not include transaction groups where this asset account (or liability)
// is just part of ONE of the journals. To force this:
$collector->setExpandGroupSearch(true);
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('accounts.show.all', [$account->id]));
- $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
- $showAll = true;
- $balance = app('steam')->balance($account, $end);
+ $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
+ $showAll = true;
+ $balance = app('steam')->balance($account, $end);
return view(
'accounts.show',
diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php
index 553f4dea69..25e810aeab 100644
--- a/app/Http/Controllers/Admin/ConfigurationController.php
+++ b/app/Http/Controllers/Admin/ConfigurationController.php
@@ -61,8 +61,8 @@ class ConfigurationController extends Controller
*/
public function index()
{
- $subTitle = (string)trans('firefly.instance_configuration');
- $subTitleIcon = 'fa-wrench';
+ $subTitle = (string)trans('firefly.instance_configuration');
+ $subTitleIcon = 'fa-wrench';
Log::channel('audit')->info('User visits admin config index.');
diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php
index 95c943cc2c..a641b2f4a5 100644
--- a/app/Http/Controllers/Admin/HomeController.php
+++ b/app/Http/Controllers/Admin/HomeController.php
@@ -70,7 +70,7 @@ class HomeController extends Controller
foreach (config('firefly.admin_notifications') as $item) {
$notifications[$item] = app('fireflyconfig')->get(sprintf('notification_%s', $item), true)->data;
}
- $slackUrl = app('fireflyconfig')->get('slack_webhook_url', '')->data;
+ $slackUrl = app('fireflyconfig')->get('slack_webhook_url', '')->data;
return view('admin.index', compact('title', 'mainTitleIcon', 'email', 'notifications', 'slackUrl'));
}
diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php
index ebec22fe2c..a2ccd109d8 100644
--- a/app/Http/Controllers/Admin/LinkController.php
+++ b/app/Http/Controllers/Admin/LinkController.php
@@ -237,7 +237,7 @@ class LinkController extends Controller
return redirect(route('admin.links.index'));
}
- $data = [
+ $data = [
'name' => $request->convertString('name'),
'inward' => $request->convertString('inward'),
'outward' => $request->convertString('outward'),
diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.php
index e4c3b2a1cb..b335ed9d07 100644
--- a/app/Http/Controllers/Admin/UpdateController.php
+++ b/app/Http/Controllers/Admin/UpdateController.php
@@ -75,7 +75,7 @@ class UpdateController extends Controller
1 => (string)trans('firefly.updates_enable_check'),
];
- $channelOptions = [
+ $channelOptions = [
'stable' => (string)trans('firefly.update_channel_stable'),
'beta' => (string)trans('firefly.update_channel_beta'),
'alpha' => (string)trans('firefly.update_channel_alpha'),
diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php
index 1074075515..6c060b3bb5 100644
--- a/app/Http/Controllers/Admin/UserController.php
+++ b/app/Http/Controllers/Admin/UserController.php
@@ -133,11 +133,11 @@ class UserController extends Controller
}
session()->forget('users.edit.fromUpdate');
- $subTitle = (string)trans('firefly.edit_user', ['email' => $user->email]);
- $subTitleIcon = 'fa-user-o';
- $currentUser = auth()->user();
- $isAdmin = $this->repository->hasRole($user, 'owner');
- $codes = [
+ $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'),
@@ -164,7 +164,7 @@ class UserController extends Controller
$allowInvites = true;
}
- $invitedUsers = $this->repository->getInvitedUsers();
+ $invitedUsers = $this->repository->getInvitedUsers();
// add meta stuff.
$users->each(
@@ -223,7 +223,7 @@ class UserController extends Controller
public function update(UserFormRequest $request, User $user)
{
app('log')->debug('Actually here');
- $data = $request->getUserData();
+ $data = $request->getUserData();
// var_dump($data);
diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php
index 16997f11ab..2ae7fa576a 100644
--- a/app/Http/Controllers/AttachmentController.php
+++ b/app/Http/Controllers/AttachmentController.php
@@ -103,8 +103,8 @@ class AttachmentController extends Controller
public function download(Attachment $attachment)
{
if ($this->repository->exists($attachment)) {
- $content = $this->repository->getContent($attachment);
- $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
+ $content = $this->repository->getContent($attachment);
+ $quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
/** @var LaravelResponse $response */
$response = response($content);
@@ -141,7 +141,7 @@ class AttachmentController extends Controller
$this->rememberPreviousUrl('attachments.edit.url');
}
$request->session()->forget('attachments.edit.fromUpdate');
- $preFilled = [
+ $preFilled = [
'notes' => $this->repository->getNoteText($attachment),
];
$request->session()->flash('preFilled', $preFilled);
@@ -173,7 +173,7 @@ class AttachmentController extends Controller
*/
public function update(AttachmentFormRequest $request, Attachment $attachment): RedirectResponse
{
- $data = $request->getAttachmentData();
+ $data = $request->getAttachmentData();
$this->repository->update($attachment, $data);
$request->session()->flash('success', (string)trans('firefly.attachment_updated', ['name' => $attachment->filename]));
@@ -202,7 +202,7 @@ class AttachmentController extends Controller
$content = $this->repository->getContent($attachment);
// prevent XSS by adding a new secure header.
- $csp = [
+ $csp = [
"default-src 'none'",
"object-src 'none'",
"script-src 'none'",
diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php
index 2148c655ac..c026d12ad5 100644
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php
@@ -72,7 +72,7 @@ class ForgotPasswordController extends Controller
// verify if the user is not a demo user. If so, we give him back an error.
/** @var null|User $user */
- $user = User::where('email', $request->get('email'))->first();
+ $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')]);
@@ -81,7 +81,7 @@ class ForgotPasswordController extends Controller
// 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'));
+ $result = $this->broker()->sendResetLink($request->only('email'));
if ('passwords.throttled' === $result) {
app('log')->error(sprintf('Cowardly refuse to send a password reset message to user #%d because the reset button has been throttled.', $user->id));
}
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index 9bd553e74f..5c68275371 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -139,8 +139,8 @@ class LoginController extends Controller
*/
public function logout(Request $request)
{
- $authGuard = config('firefly.authentication_guard');
- $logoutUrl = config('firefly.custom_logout_url');
+ $authGuard = config('firefly.authentication_guard');
+ $logoutUrl = config('firefly.custom_logout_url');
if ('remote_user_guard' === $authGuard && '' !== $logoutUrl) {
return redirect($logoutUrl);
}
@@ -176,9 +176,9 @@ class LoginController extends Controller
{
Log::channel('audit')->info('Show login form (1.1).');
- $count = \DB::table('users')->count();
- $guard = config('auth.defaults.guard');
- $title = (string)trans('firefly.login_page_title');
+ $count = \DB::table('users')->count();
+ $guard = config('auth.defaults.guard');
+ $title = (string)trans('firefly.login_page_title');
if (0 === $count && 'web' === $guard) {
return redirect(route('register'));
@@ -198,15 +198,15 @@ class LoginController extends Controller
$allowReset = false;
}
- $email = $request->old('email');
- $remember = $request->old('remember');
+ $email = $request->old('email');
+ $remember = $request->old('remember');
- $storeInCookie = config('google2fa.store_in_cookie', false);
+ $storeInCookie = config('google2fa.store_in_cookie', false);
if (false !== $storeInCookie) {
$cookieName = config('google2fa.cookie_name', 'google2fa_token');
request()->cookies->set($cookieName, 'invalid');
}
- $usernameField = $this->username();
+ $usernameField = $this->username();
return view('auth.login', compact('allowRegistration', 'email', 'remember', 'allowReset', 'title', 'usernameField'));
}
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index dd3b54085f..8fba878c41 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -92,7 +92,7 @@ class RegisterController extends Controller
}
$this->validator($request->all())->validate();
- $user = $this->createUser($request->all());
+ $user = $this->createUser($request->all());
app('log')->info(sprintf('Registered new user %s', $user->email));
event(new RegisteredUser($user));
@@ -136,7 +136,7 @@ class RegisterController extends Controller
return view('error', compact('message'));
}
- $email = $request->old('email');
+ $email = $request->old('email');
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle', 'inviteCode'));
}
@@ -160,7 +160,7 @@ class RegisterController extends Controller
return view('error', compact('message'));
}
- $email = $request->old('email');
+ $email = $request->old('email');
return view('auth.register', compact('isDemoSite', 'email', 'pageTitle'));
}
@@ -178,8 +178,8 @@ class RegisterController extends Controller
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {
$singleUserMode = true;
}
- $userCount = User::count();
- $guard = config('auth.defaults.guard');
+ $userCount = User::count();
+ $guard = config('auth.defaults.guard');
if (true === $singleUserMode && $userCount > 0 && 'web' === $guard) {
$allowRegistration = false;
}
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index 3b1fe3148b..0a0ff45a0e 100644
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -80,7 +80,7 @@ class ResetPasswordController extends Controller
return view('error', compact('message'));
}
- $rules = [
+ $rules = [
'token' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed|min:16|secure_password',
diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php
index 9d09234da5..e053441abd 100644
--- a/app/Http/Controllers/Auth/TwoFactorController.php
+++ b/app/Http/Controllers/Auth/TwoFactorController.php
@@ -59,8 +59,8 @@ class TwoFactorController extends Controller
public function submitMFA(Request $request)
{
/** @var array $mfaHistory */
- $mfaHistory = app('preferences')->get('mfa_history', [])->data;
- $mfaCode = (string)$request->get('one_time_password');
+ $mfaHistory = app('preferences')->get('mfa_history', [])->data;
+ $mfaCode = (string)$request->get('one_time_password');
// is in history? then refuse to use it.
if ($this->inMFAHistory($mfaCode, $mfaHistory)) {
@@ -171,7 +171,7 @@ class TwoFactorController extends Controller
*/
private function removeFromBackupCodes(string $mfaCode): void
{
- $list = app('preferences')->get('mfa_recovery', [])->data;
+ $list = app('preferences')->get('mfa_recovery', [])->data;
if (!is_array($list)) {
$list = [];
}
diff --git a/app/Http/Controllers/Bill/CreateController.php b/app/Http/Controllers/Bill/CreateController.php
index 40398693ca..443d3eb444 100644
--- a/app/Http/Controllers/Bill/CreateController.php
+++ b/app/Http/Controllers/Bill/CreateController.php
@@ -69,10 +69,10 @@ class CreateController extends Controller
*/
public function create(Request $request)
{
- $periods = [];
+ $periods = [];
/** @var array $billPeriods */
- $billPeriods = config('firefly.bill_periods');
+ $billPeriods = config('firefly.bill_periods');
foreach ($billPeriods as $current) {
$periods[$current] = (string)trans('firefly.repeat_freq_'.$current);
}
@@ -93,7 +93,7 @@ class CreateController extends Controller
*/
public function store(BillStoreRequest $request): RedirectResponse
{
- $billData = $request->getBillData();
+ $billData = $request->getBillData();
$billData['active'] = true;
@@ -111,7 +111,7 @@ class CreateController extends Controller
app('preferences')->mark();
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($bill, $files);
}
diff --git a/app/Http/Controllers/Bill/EditController.php b/app/Http/Controllers/Bill/EditController.php
index 92fd5bf228..f076ed4bb6 100644
--- a/app/Http/Controllers/Bill/EditController.php
+++ b/app/Http/Controllers/Bill/EditController.php
@@ -69,16 +69,16 @@ class EditController extends Controller
*/
public function edit(Request $request, Bill $bill)
{
- $periods = [];
+ $periods = [];
/** @var array $billPeriods */
- $billPeriods = config('firefly.bill_periods');
+ $billPeriods = config('firefly.bill_periods');
foreach ($billPeriods as $current) {
$periods[$current] = (string)trans('firefly.'.$current);
}
- $subTitle = (string)trans('firefly.edit_bill', ['name' => $bill->name]);
+ $subTitle = (string)trans('firefly.edit_bill', ['name' => $bill->name]);
// put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('bills.edit.fromUpdate')) {
@@ -92,9 +92,9 @@ class EditController extends Controller
$defaultCurrency = app('amount')->getDefaultCurrency();
// code to handle active-checkboxes
- $hasOldInput = null !== $request->old('_token');
+ $hasOldInput = null !== $request->old('_token');
- $preFilled = [
+ $preFilled = [
'bill_end_date' => $bill->end_date,
'extension_date' => $bill->extension_date,
'notes' => $this->repository->getNoteText($bill),
@@ -123,7 +123,7 @@ class EditController extends Controller
app('preferences')->mark();
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($bill, $files);
}
diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php
index 1052b58895..069d1f0974 100644
--- a/app/Http/Controllers/Bill/IndexController.php
+++ b/app/Http/Controllers/Bill/IndexController.php
@@ -71,29 +71,29 @@ class IndexController extends Controller
{
$this->cleanupObjectGroups();
$this->repository->correctOrder();
- $start = session('start');
- $end = session('end');
- $collection = $this->repository->getBills();
- $total = $collection->count();
+ $start = session('start');
+ $end = session('end');
+ $collection = $this->repository->getBills();
+ $total = $collection->count();
$defaultCurrency = app('amount')->getDefaultCurrency();
$parameters = new ParameterBag();
// sub one day from temp start so the last paid date is one day before it should be.
- $tempStart = clone $start;
+ $tempStart = clone $start;
// 2023-06-23 do not sub one day from temp start, fix is in BillTransformer::payDates instead
// $tempStart->subDay();
$parameters->set('start', $tempStart);
$parameters->set('end', $end);
/** @var BillTransformer $transformer */
- $transformer = app(BillTransformer::class);
+ $transformer = app(BillTransformer::class);
$transformer->setParameters($parameters);
// loop all bills, convert to array and add rules and stuff.
- $rules = $this->repository->getRulesForBills($collection);
+ $rules = $this->repository->getRulesForBills($collection);
// make bill groups:
- $bills = [
+ $bills = [
0 => [ // the index is the order, not the ID.
'object_group_id' => 0,
'object_group_title' => (string)trans('firefly.default_group_title_name'),
@@ -103,8 +103,8 @@ class IndexController extends Controller
/** @var Bill $bill */
foreach ($collection as $bill) {
- $array = $transformer->transform($bill);
- $groupOrder = (int)$array['object_group_order'];
+ $array = $transformer->transform($bill);
+ $groupOrder = (int)$array['object_group_order'];
// make group array if necessary:
$bills[$groupOrder] ??= [
'object_group_id' => $array['object_group_id'],
@@ -127,9 +127,9 @@ class IndexController extends Controller
ksort($bills);
// summarise per currency / per group.
- $sums = $this->getSums($bills);
- $totals = $this->getTotals($sums);
- $today = now()->startOfDay();
+ $sums = $this->getSums($bills);
+ $totals = $this->getTotals($sums);
+ $today = now()->startOfDay();
return view('bills.index', compact('bills', 'sums', 'total', 'totals', 'today'));
}
@@ -168,7 +168,7 @@ class IndexController extends Controller
continue;
}
- $currencyId = $bill['currency_id'];
+ $currencyId = $bill['currency_id'];
$sums[$groupOrder][$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $bill['currency_code'],
@@ -196,7 +196,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');
app('log')->debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
app('log')->debug(sprintf('Average is %s', $avg));
@@ -213,7 +213,7 @@ class IndexController extends Controller
app('log')->debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
// per period:
- $division = [
+ $division = [
'1Y' => '1',
'6M' => '2',
'3M' => '4',
@@ -228,7 +228,7 @@ class IndexController extends Controller
'last90' => '4',
'last365' => '1',
];
- $perPeriod = bcdiv($yearAmount, $division[$range]);
+ $perPeriod = bcdiv($yearAmount, $division[$range]);
app('log')->debug(sprintf('Amount per %s is %s (%s / %s)', $range, $perPeriod, $yearAmount, $division[$range]));
@@ -251,7 +251,7 @@ class IndexController extends Controller
* @var array $entry
*/
foreach ($array as $currencyId => $entry) {
- $totals[$currencyId] ??= [
+ $totals[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $entry['currency_code'],
'currency_name' => $entry['currency_name'],
diff --git a/app/Http/Controllers/Bill/ShowController.php b/app/Http/Controllers/Bill/ShowController.php
index 78ac8b4fec..b0764bcd83 100644
--- a/app/Http/Controllers/Bill/ShowController.php
+++ b/app/Http/Controllers/Bill/ShowController.php
@@ -77,13 +77,13 @@ class ShowController extends Controller
*/
public function rescan(Request $request, Bill $bill)
{
- $total = 0;
+ $total = 0;
if (false === $bill->active) {
$request->session()->flash('warning', (string)trans('firefly.cannot_scan_inactive_bill'));
return redirect(route('bills.show', [$bill->id]));
}
- $set = $this->repository->getRulesForBill($bill);
+ $set = $this->repository->getRulesForBill($bill);
if (0 === $set->count()) {
$request->session()->flash('error', (string)trans('firefly.no_rules_for_bill'));
@@ -115,34 +115,34 @@ class ShowController extends Controller
public function show(Request $request, Bill $bill)
{
// add info about rules:
- $rules = $this->repository->getRulesForBill($bill);
- $subTitle = $bill->name;
+ $rules = $this->repository->getRulesForBill($bill);
+ $subTitle = $bill->name;
/** @var Carbon $start */
- $start = session('start');
+ $start = session('start');
/** @var Carbon $end */
- $end = session('end');
- $year = $start->year;
- $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();
+ $end = session('end');
+ $year = $start->year;
+ $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();
$manager->setSerializer(new DataArraySerializer());
$manager->parseIncludes(['attachments', 'notes']);
// add another period to end, could fix 8163
- $range = app('navigation')->getViewRange(true);
- $end = app('navigation')->addPeriod($end, $range);
+ $range = app('navigation')->getViewRange(true);
+ $end = app('navigation')->addPeriod($end, $range);
// Make a resource out of the data and
- $parameters = new ParameterBag();
+ $parameters = new ParameterBag();
$parameters->set('start', $start);
$parameters->set('end', $end);
/** @var BillTransformer $transformer */
- $transformer = app(BillTransformer::class);
+ $transformer = app(BillTransformer::class);
$transformer->setParameters($parameters);
$resource = new Item($bill, $transformer, 'bill');
@@ -150,16 +150,16 @@ class ShowController extends Controller
$object['data']['currency'] = $bill->transactionCurrency;
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setBill($bill)->setLimit($pageSize)->setPage($page)->withBudgetInformation()
->withCategoryInformation()->withAccountInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('bills.show', [$bill->id]));
// transform any attachments as well.
- $collection = $this->repository->getAttachments($bill);
- $attachments = new Collection();
+ $collection = $this->repository->getAttachments($bill);
+ $attachments = new Collection();
if ($collection->count() > 0) {
/** @var AttachmentTransformer $transformer */
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index dc7c9dac1d..7eade3fe56 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -83,7 +83,7 @@ class BudgetLimitController extends Controller
$budgetLimits = $this->blRepository->getBudgetLimits($budget, $start, $end);
// remove already budgeted currencies with the same date range
- $currencies = $collection->filter(
+ $currencies = $collection->filter(
static function (TransactionCurrency $currency) use ($budgetLimits, $start, $end) {
/** @var BudgetLimit $limit */
foreach ($budgetLimits as $limit) {
@@ -125,14 +125,14 @@ class BudgetLimitController extends Controller
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'));
+ $start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
+ $end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
if (false === $start || false === $end) {
return response()->json([]);
}
- $amount = (string)$request->get('amount');
+ $amount = (string)$request->get('amount');
$start->startOfDay();
$end->startOfDay();
@@ -142,7 +142,7 @@ class BudgetLimitController extends Controller
app('log')->debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
- $limit = $this->blRepository->find($budget, $currency, $start, $end);
+ $limit = $this->blRepository->find($budget, $currency, $start, $end);
// sanity check on amount:
if (0 === bccomp($amount, '0')) {
@@ -177,15 +177,15 @@ class BudgetLimitController extends Controller
}
if ($request->expectsJson()) {
- $array = $limit->toArray();
+ $array = $limit->toArray();
// add some extra metadata:
- $spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection([$budget]), $currency);
- $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);
+ $spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection([$budget]), $currency);
+ $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);
// left per day:
- $array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']);
+ $array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']);
// left per day formatted.
$array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']);
@@ -198,7 +198,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';
}
@@ -208,7 +208,7 @@ class BudgetLimitController extends Controller
$budgetId = $budgetLimit->budget_id;
$currency = $budgetLimit->transactionCurrency;
$this->blRepository->destroyBudgetLimit($budgetLimit);
- $array = [
+ $array = [
'budget_id' => $budgetId,
'left_formatted' => app('amount')->formatAnything($currency, '0'),
'left_per_day_formatted' => app('amount')->formatAnything($currency, '0'),
@@ -224,23 +224,23 @@ class BudgetLimitController extends Controller
$amount = bcmul($amount, '-1');
}
- $limit = $this->blRepository->update($budgetLimit, ['amount' => $amount]);
+ $limit = $this->blRepository->update($budgetLimit, ['amount' => $amount]);
app('preferences')->mark();
- $array = $limit->toArray();
+ $array = $limit->toArray();
- $spentArr = $this->opsRepository->sumExpenses(
+ $spentArr = $this->opsRepository->sumExpenses(
$limit->start_date,
$limit->end_date,
null,
new Collection([$budgetLimit->budget]),
$budgetLimit->transactionCurrency
);
- $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['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);
// left per day:
- $array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']);
+ $array['left_per_day'] = bcdiv(bcadd($array['spent'], $array['amount']), $array['days_left']);
// left per day formatted.
$array['amount'] = app('steam')->bcround($limit['amount'], $limit->transactionCurrency->decimal_places);
diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.php
index 73d217a843..68b3847b62 100644
--- a/app/Http/Controllers/Budget/CreateController.php
+++ b/app/Http/Controllers/Budget/CreateController.php
@@ -68,7 +68,7 @@ class CreateController extends Controller
*/
public function create(Request $request)
{
- $hasOldInput = null !== $request->old('_token');
+ $hasOldInput = null !== $request->old('_token');
// auto budget types
$autoBudgetTypes = [
@@ -87,7 +87,7 @@ class CreateController extends Controller
];
$currency = app('amount')->getDefaultCurrency();
- $preFilled = [
+ $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,
];
@@ -99,7 +99,7 @@ class CreateController extends Controller
$this->rememberPreviousUrl('budgets.create.url');
}
$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'));
}
@@ -111,9 +111,9 @@ class CreateController extends Controller
*/
public function store(BudgetFormStoreRequest $request): RedirectResponse
{
- $data = $request->getBudgetData();
+ $data = $request->getBudgetData();
- $budget = $this->repository->store($data);
+ $budget = $this->repository->store($data);
$this->repository->cleanupBudgets();
$request->session()->flash('success', (string)trans('firefly.stored_new_budget', ['name' => $budget->name]));
app('preferences')->mark();
@@ -122,7 +122,7 @@ class CreateController extends Controller
// store attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($budget, $files);
}
diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php
index 1555630b81..ec0fe37d26 100644
--- a/app/Http/Controllers/Budget/EditController.php
+++ b/app/Http/Controllers/Budget/EditController.php
@@ -69,8 +69,8 @@ class EditController extends Controller
*/
public function edit(Request $request, Budget $budget)
{
- $subTitle = (string)trans('firefly.edit_budget', ['name' => $budget->name]);
- $autoBudget = $this->repository->getAutoBudget($budget);
+ $subTitle = (string)trans('firefly.edit_budget', ['name' => $budget->name]);
+ $autoBudget = $this->repository->getAutoBudget($budget);
// auto budget types
$autoBudgetTypes = [
@@ -89,14 +89,14 @@ class EditController extends Controller
];
// code to handle active-checkboxes
- $hasOldInput = null !== $request->old('_token');
- $currency = app('amount')->getDefaultCurrency();
- $preFilled = [
+ $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,
];
if (null !== $autoBudget) {
- $amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;
+ $amount = $hasOldInput ? $request->old('auto_budget_amount') : $autoBudget->amount;
if (is_array($amount)) {
$amount = '0';
}
@@ -119,7 +119,7 @@ class EditController extends Controller
*/
public function update(BudgetFormUpdateRequest $request, Budget $budget): RedirectResponse
{
- $data = $request->getBudgetData();
+ $data = $request->getBudgetData();
$this->repository->update($budget, $data);
$request->session()->flash('success', (string)trans('firefly.updated_budget', ['name' => $budget->name]));
@@ -132,7 +132,7 @@ class EditController extends Controller
// store new attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($budget, $files);
}
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 5bf99dfb42..3bd4679bae 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -91,8 +91,8 @@ class IndexController extends Controller
app('log')->debug(sprintf('Start of IndexController::index("%s", "%s")', $start?->format('Y-m-d'), $end?->format('Y-m-d')));
// collect some basic vars:
- $range = app('navigation')->getViewRange(true);
- $isCustomRange = session('is_custom_range', false);
+ $range = app('navigation')->getViewRange(true);
+ $isCustomRange = session('is_custom_range', false);
if (false === $isCustomRange) {
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
$end ??= app('navigation')->endOfPeriod($start, $range);
@@ -104,22 +104,22 @@ class IndexController extends Controller
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
}
- $defaultCurrency = app('amount')->getDefaultCurrency();
- $currencies = $this->currencyRepository->get();
- $budgeted = '0';
- $spent = '0';
+ $defaultCurrency = app('amount')->getDefaultCurrency();
+ $currencies = $this->currencyRepository->get();
+ $budgeted = '0';
+ $spent = '0';
// new period stuff:
- $periodTitle = app('navigation')->periodShow($start, $range);
- $prevLoop = $this->getPreviousPeriods($start, $range);
- $nextLoop = $this->getNextPeriods($start, $range);
+ $periodTitle = app('navigation')->periodShow($start, $range);
+ $prevLoop = $this->getPreviousPeriods($start, $range);
+ $nextLoop = $this->getNextPeriods($start, $range);
// get all available budgets:
$availableBudgets = $this->getAllAvailableBudgets($start, $end);
// get all active budgets:
- $budgets = $this->getAllBudgets($start, $end, $currencies, $defaultCurrency);
- $sums = $this->getSums($budgets);
+ $budgets = $this->getAllBudgets($start, $end, $currencies, $defaultCurrency);
+ $sums = $this->getSums($budgets);
// get budgeted for default currency:
if (0 === count($availableBudgets)) {
@@ -134,7 +134,7 @@ class IndexController extends Controller
$activeDaysLeft = $this->activeDaysLeft($start, $end); // see method description.
// get all inactive budgets, and simply list them:
- $inactive = $this->repository->getInactiveBudgets();
+ $inactive = $this->repository->getInactiveBudgets();
return view(
'budgets.index',
@@ -191,13 +191,13 @@ class IndexController extends Controller
$array['end_date'] = $entry->end_date;
// spent in period:
- $spentArr = $this->opsRepository->sumExpenses($entry->start_date, $entry->end_date, null, null, $entry->transactionCurrency);
- $array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
+ $spentArr = $this->opsRepository->sumExpenses($entry->start_date, $entry->end_date, null, null, $entry->transactionCurrency);
+ $array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
// budgeted in period:
- $budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency);
- $array['budgeted'] = $budgeted;
- $availableBudgets[] = $array;
+ $budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency);
+ $array['budgeted'] = $budgeted;
+ $availableBudgets[] = $array;
unset($spentArr);
}
@@ -252,7 +252,7 @@ class IndexController extends Controller
$array['spent'][$currency->id]['currency_decimal_places'] = $currency->decimal_places;
}
}
- $budgets[] = $array;
+ $budgets[] = $array;
}
return $budgets;
@@ -295,7 +295,7 @@ class IndexController extends Controller
// also calculate how much left from budgeted:
$sums['left'][$currencyId]
- ??= [
+ ??= [
'amount' => '0',
'currency_id' => $budgeted['currency_id'],
'currency_symbol' => $budgeted['currency_symbol'],
diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php
index 4c53d7a4ee..7ad24fbe5a 100644
--- a/app/Http/Controllers/Budget/ShowController.php
+++ b/app/Http/Controllers/Budget/ShowController.php
@@ -80,8 +80,8 @@ class ShowController extends Controller
// @var Carbon $start
$start ??= session('start');
// @var Carbon $end
- $end ??= session('end');
- $subTitle = trans(
+ $end ??= session('end');
+ $subTitle = trans(
'firefly.without_budget_between',
['start' => $start->isoFormat($this->monthAndDayFormat), 'end' => $end->isoFormat($this->monthAndDayFormat)]
);
@@ -98,7 +98,7 @@ class ShowController extends Controller
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withAccountInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget'));
return view('budgets.no-budget', compact('groups', 'subTitle', 'periods', 'start', 'end'));
@@ -111,19 +111,19 @@ class ShowController extends Controller
*/
public function noBudgetAll(Request $request)
{
- $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;
+ $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;
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withAccountInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget-all'));
return view('budgets.no-budget', compact('groups', 'subTitle', 'start', 'end'));
@@ -147,15 +147,15 @@ class ShowController extends Controller
// collector:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($allStart, $allEnd)->setBudget($budget)
->withAccountInformation()
->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $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'));
}
@@ -173,9 +173,9 @@ class ShowController extends Controller
throw new FireflyException('This budget limit is not part of this budget.');
}
- $page = (int)$request->get('page');
- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
- $subTitle = trans(
+ $page = (int)$request->get('page');
+ $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
+ $subTitle = trans(
'firefly.budget_in_period',
[
'name' => $budget->name,
@@ -187,12 +187,12 @@ class ShowController extends Controller
// collector:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date)->withAccountInformation()
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.show.limit', [$budget->id, $budgetLimit->id]));
/** @var Carbon $start */
diff --git a/app/Http/Controllers/Category/CreateController.php b/app/Http/Controllers/Category/CreateController.php
index 6371a90428..e7115c063b 100644
--- a/app/Http/Controllers/Category/CreateController.php
+++ b/app/Http/Controllers/Category/CreateController.php
@@ -95,7 +95,7 @@ class CreateController extends Controller
// store attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($category, $files);
}
diff --git a/app/Http/Controllers/Category/EditController.php b/app/Http/Controllers/Category/EditController.php
index c473955b5f..265ee53095 100644
--- a/app/Http/Controllers/Category/EditController.php
+++ b/app/Http/Controllers/Category/EditController.php
@@ -69,7 +69,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')) {
@@ -91,7 +91,7 @@ class EditController extends Controller
*/
public function update(CategoryFormRequest $request, Category $category)
{
- $data = $request->getCategoryData();
+ $data = $request->getCategoryData();
$this->repository->update($category, $data);
$request->session()->flash('success', (string)trans('firefly.updated_category', ['name' => $category->name]));
@@ -99,7 +99,7 @@ class EditController extends Controller
// store new attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($category, $files);
}
diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.php
index f0e123b480..212c955442 100644
--- a/app/Http/Controllers/Category/NoCategoryController.php
+++ b/app/Http/Controllers/Category/NoCategoryController.php
@@ -76,14 +76,14 @@ class NoCategoryController extends Controller
// @var Carbon $start
$start ??= session('start');
// @var Carbon $end
- $end ??= session('end');
- $page = (int)$request->get('page');
- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
- $subTitle = trans(
+ $end ??= session('end');
+ $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)]
);
- $periods = $this->getNoCategoryPeriodOverview($start);
+ $periods = $this->getNoCategoryPeriodOverview($start);
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
@@ -95,7 +95,7 @@ class NoCategoryController extends Controller
->withAccountInformation()->withBudgetInformation()
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER])
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('categories.no-category', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
@@ -109,16 +109,16 @@ class NoCategoryController extends Controller
public function showAll(Request $request)
{
// default values:
- $start = null;
- $end = null;
- $periods = new Collection();
- $page = (int)$request->get('page');
- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
+ $start = null;
+ $end = null;
+ $periods = new Collection();
+ $page = (int)$request->get('page');
+ $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
app('log')->debug('Start of noCategory()');
- $subTitle = (string)trans('firefly.all_journals_without_category');
- $first = $this->journalRepos->firstNull();
- $start = null === $first ? new Carbon() : $first->date;
- $end = today(config('app.timezone'));
+ $subTitle = (string)trans('firefly.all_journals_without_category');
+ $first = $this->journalRepos->firstNull();
+ $start = null === $first ? new Carbon() : $first->date;
+ $end = today(config('app.timezone'));
app('log')->debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d')));
@@ -128,7 +128,7 @@ class NoCategoryController extends Controller
->withAccountInformation()->withBudgetInformation()
->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER])
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath(route('categories.no-category.all'));
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php
index 44d56a0266..bc51b4c0a1 100644
--- a/app/Http/Controllers/Category/ShowController.php
+++ b/app/Http/Controllers/Category/ShowController.php
@@ -76,7 +76,7 @@ class ShowController extends Controller
// @var Carbon $start
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
// @var Carbon $end
- $end ??= session('end', today(config('app.timezone'))->endOfMonth());
+ $end ??= session('end', today(config('app.timezone'))->endOfMonth());
$subTitleIcon = 'fa-bookmark';
$page = (int)$request->get('page');
$attachments = $this->repository->getAttachments($category);
@@ -94,13 +94,13 @@ class ShowController extends Controller
);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)
->withAccountInformation()
->setCategory($category)->withBudgetInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath($path);
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
@@ -121,23 +121,23 @@ class ShowController extends Controller
$end = null;
$periods = new Collection();
- $subTitle = (string)trans('firefly.all_journals_for_category', ['name' => $category->name]);
- $first = $this->repository->firstUseDate($category);
+ $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'));
- $end = today(config('app.timezone'));
- $path = route('categories.show.all', [$category->id]);
- $attachments = $this->repository->getAttachments($category);
+ $start = $first ?? today(config('app.timezone'));
+ $end = today(config('app.timezone'));
+ $path = route('categories.show.all', [$category->id]);
+ $attachments = $this->repository->getAttachments($category);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)
->withAccountInformation()
->setCategory($category)->withBudgetInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath($path);
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index e77745adeb..0ed853c01a 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -80,11 +80,11 @@ class AccountController extends Controller
public function expenseAccounts(): JsonResponse
{
/** @var Carbon $start */
- $start = clone session('start', today(config('app.timezone'))->startOfMonth());
+ $start = clone session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = clone session('end', today(config('app.timezone'))->endOfMonth());
- $cache = new CacheProperties();
+ $end = clone session('end', today(config('app.timezone'))->endOfMonth());
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.account.expense-accounts');
@@ -94,13 +94,13 @@ class AccountController extends Controller
$start->subDay();
// prep some vars:
- $currencies = [];
- $chartData = [];
- $tempData = [];
+ $currencies = [];
+ $chartData = [];
+ $tempData = [];
// grab all accounts and names
- $accounts = $this->accountRepository->getAccountsByType([AccountType::EXPENSE]);
- $accountNames = $this->extractNames($accounts);
+ $accounts = $this->accountRepository->getAccountsByType([AccountType::EXPENSE]);
+ $accountNames = $this->extractNames($accounts);
// grab all balances
$startBalances = app('steam')->balancesPerCurrencyByAccounts($accounts, $start);
@@ -111,12 +111,12 @@ class AccountController extends Controller
$accountId = (int)$accountId;
// loop each expense entry (each entry can be a different currency).
foreach ($expenses as $currencyId => $endAmount) {
- $currencyId = (int)$currencyId;
+ $currencyId = (int)$currencyId;
// see if there is an accompanying start amount.
// grab the difference and find the currency.
- $startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
- $diff = bcsub((string)$endAmount, $startAmount);
+ $startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
+ $diff = bcsub((string)$endAmount, $startAmount);
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
if (0 !== bccomp($diff, '0')) {
// store the values in a temporary array.
@@ -131,7 +131,7 @@ class AccountController extends Controller
}
// sort temp array by amount.
- $amounts = array_column($tempData, 'diff_float');
+ $amounts = array_column($tempData, 'diff_float');
array_multisort($amounts, SORT_DESC, $tempData);
// loop all found currencies and build the data array for the chart.
@@ -158,7 +158,7 @@ class AccountController extends Controller
$chartData[$currencyId]['entries'][$name] = $entry['difference'];
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
@@ -180,7 +180,7 @@ class AccountController extends Controller
*/
public function expenseBudget(Account $account, Carbon $start, Carbon $end): JsonResponse
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty($start);
$cache->addProperty($end);
@@ -199,9 +199,9 @@ class AccountController extends Controller
/** @var array $journal */
foreach ($journals as $journal) {
- $budgetId = (int)$journal['budget_id'];
- $key = sprintf('%d-%d', $budgetId, $journal['currency_id']);
- $budgetIds[] = $budgetId;
+ $budgetId = (int)$journal['budget_id'];
+ $key = sprintf('%d-%d', $budgetId, $journal['currency_id']);
+ $budgetIds[] = $budgetId;
if (!array_key_exists($key, $result)) {
$result[$key] = [
'total' => '0',
@@ -214,7 +214,7 @@ class AccountController extends Controller
$result[$key]['total'] = bcadd($journal['amount'], $result[$key]['total']);
}
- $names = $this->getBudgetNames($budgetIds);
+ $names = $this->getBudgetNames($budgetIds);
foreach ($result as $row) {
$budgetId = $row['budget_id'];
@@ -223,7 +223,7 @@ class AccountController extends Controller
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
}
- $data = $this->generator->multiCurrencyPieChart($chartData);
+ $data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
return response()->json($data);
@@ -245,7 +245,7 @@ class AccountController extends Controller
*/
public function expenseCategory(Account $account, Carbon $start, Carbon $end): JsonResponse
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty($start);
$cache->addProperty($end);
@@ -263,7 +263,7 @@ class AccountController extends Controller
/** @var array $journal */
foreach ($journals as $journal) {
- $key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
+ $key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
if (!array_key_exists($key, $result)) {
$result[$key] = [
'total' => '0',
@@ -275,7 +275,7 @@ class AccountController extends Controller
}
$result[$key]['total'] = bcadd($journal['amount'], $result[$key]['total']);
}
- $names = $this->getCategoryNames(array_keys($result));
+ $names = $this->getCategoryNames(array_keys($result));
foreach ($result as $row) {
$categoryId = $row['category_id'];
@@ -284,7 +284,7 @@ class AccountController extends Controller
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
}
- $data = $this->generator->multiCurrencyPieChart($chartData);
+ $data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
return response()->json($data);
@@ -297,9 +297,9 @@ class AccountController extends Controller
* */
public function frontpage(AccountRepositoryInterface $repository): JsonResponse
{
- $start = clone session('start', today(config('app.timezone'))->startOfMonth());
- $end = clone session('end', today(config('app.timezone'))->endOfMonth());
- $defaultSet = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
+ $start = clone session('start', today(config('app.timezone'))->startOfMonth());
+ $end = clone session('end', today(config('app.timezone'))->endOfMonth());
+ $defaultSet = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET])->pluck('id')->toArray();
app('log')->debug('Default set is ', $defaultSet);
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
$frontPageArray = !is_array($frontPage->data) ? [] : $frontPage->data;
@@ -308,7 +308,7 @@ class AccountController extends Controller
app('preferences')->set('frontPageAccounts', $defaultSet);
app('log')->debug('frontpage set is empty!');
}
- $accounts = $repository->getAccountsById($frontPageArray);
+ $accounts = $repository->getAccountsById($frontPageArray);
return response()->json($this->accountBalanceChart($accounts, $start, $end));
}
@@ -329,7 +329,7 @@ class AccountController extends Controller
*/
public function incomeCategory(Account $account, Carbon $start, Carbon $end): JsonResponse
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty($start);
$cache->addProperty($end);
@@ -349,7 +349,7 @@ class AccountController extends Controller
/** @var array $journal */
foreach ($journals as $journal) {
- $key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
+ $key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
if (!array_key_exists($key, $result)) {
$result[$key] = [
'total' => '0',
@@ -362,14 +362,14 @@ class AccountController extends Controller
$result[$key]['total'] = bcadd($journal['amount'], $result[$key]['total']);
}
- $names = $this->getCategoryNames(array_keys($result));
+ $names = $this->getCategoryNames(array_keys($result));
foreach ($result as $row) {
$categoryId = $row['category_id'];
$name = $names[$categoryId] ?? '(unknown)';
$label = (string)trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
}
- $data = $this->generator->multiCurrencyPieChart($chartData);
+ $data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
return response()->json($data);
@@ -382,8 +382,8 @@ class AccountController extends Controller
*/
public function period(Account $account, Carbon $start, Carbon $end): JsonResponse
{
- $chartData = [];
- $cache = new CacheProperties();
+ $chartData = [];
+ $cache = new CacheProperties();
$cache->addProperty('chart.account.period');
$cache->addProperty($start);
$cache->addProperty($end);
@@ -403,7 +403,7 @@ class AccountController extends Controller
$chartData[] = $this->periodByCurrency($start, $end, $account, $currency);
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
@@ -429,11 +429,11 @@ class AccountController extends Controller
public function revenueAccounts(): JsonResponse
{
/** @var Carbon $start */
- $start = clone session('start', today(config('app.timezone'))->startOfMonth());
+ $start = clone session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = clone session('end', today(config('app.timezone'))->endOfMonth());
- $cache = new CacheProperties();
+ $end = clone session('end', today(config('app.timezone'))->endOfMonth());
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.account.revenue-accounts');
@@ -443,13 +443,13 @@ class AccountController extends Controller
$start->subDay();
// prep some vars:
- $currencies = [];
- $chartData = [];
- $tempData = [];
+ $currencies = [];
+ $chartData = [];
+ $tempData = [];
// grab all accounts and names
- $accounts = $this->accountRepository->getAccountsByType([AccountType::REVENUE]);
- $accountNames = $this->extractNames($accounts);
+ $accounts = $this->accountRepository->getAccountsByType([AccountType::REVENUE]);
+ $accountNames = $this->extractNames($accounts);
// grab all balances
$startBalances = app('steam')->balancesPerCurrencyByAccounts($accounts, $start);
@@ -460,12 +460,12 @@ class AccountController extends Controller
$accountId = (int)$accountId;
// loop each expense entry (each entry can be a different currency).
foreach ($expenses as $currencyId => $endAmount) {
- $currencyId = (int)$currencyId;
+ $currencyId = (int)$currencyId;
// see if there is an accompanying start amount.
// grab the difference and find the currency.
- $startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
- $diff = bcsub((string)$endAmount, $startAmount);
+ $startAmount = (string)($startBalances[$accountId][$currencyId] ?? '0');
+ $diff = bcsub((string)$endAmount, $startAmount);
$currencies[$currencyId] ??= $this->currencyRepository->find($currencyId);
if (0 !== bccomp($diff, '0')) {
// store the values in a temporary array.
@@ -480,7 +480,7 @@ class AccountController extends Controller
}
// sort temp array by amount.
- $amounts = array_column($tempData, 'diff_float');
+ $amounts = array_column($tempData, 'diff_float');
array_multisort($amounts, SORT_ASC, $tempData);
// loop all found currencies and build the data array for the chart.
@@ -507,7 +507,7 @@ class AccountController extends Controller
$chartData[$currencyId]['entries'][$name] = bcmul($entry['difference'], '-1');
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
@@ -519,21 +519,21 @@ class AccountController extends Controller
private function periodByCurrency(Carbon $start, Carbon $end, Account $account, TransactionCurrency $currency): array
{
app('log')->debug(sprintf('Now in periodByCurrency("%s", "%s", %s, "%s")', $start->format('Y-m-d'), $end->format('Y-m-d'), $account->id, $currency->code));
- $locale = app('steam')->getLocale();
- $step = $this->calculateStep($start, $end);
- $result = [
+ $locale = app('steam')->getLocale();
+ $step = $this->calculateStep($start, $end);
+ $result = [
'label' => sprintf('%s (%s)', $account->name, $currency->symbol),
'currency_symbol' => $currency->symbol,
'currency_code' => $currency->code,
];
- $entries = [];
- $current = clone $start;
+ $entries = [];
+ $current = clone $start;
app('log')->debug(sprintf('Step is %s', $step));
// fix for issue https://github.com/firefly-iii/firefly-iii/issues/8041
// have to make sure this chart is always based on the balance at the END of the period.
// This period depends on the size of the chart
- $current = app('navigation')->endOfX($current, $step, null);
+ $current = app('navigation')->endOfX($current, $step, null);
app('log')->debug(sprintf('$current date is %s', $current->format('Y-m-d')));
if ('1D' === $step) {
// per day the entire period, balance for every day.
@@ -557,7 +557,7 @@ class AccountController extends Controller
$entries[$label] = $balance;
$current = app('navigation')->addPeriod($current, $step, 0);
// here too, to fix #8041, the data is corrected to the end of the period.
- $current = app('navigation')->endOfX($current, $step, null);
+ $current = app('navigation')->endOfX($current, $step, null);
}
}
$result['entries'] = $entries;
diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php
index e2319d6572..3e8c23c996 100644
--- a/app/Http/Controllers/Chart/BillController.php
+++ b/app/Http/Controllers/Chart/BillController.php
@@ -53,9 +53,9 @@ class BillController extends Controller
*/
public function frontpage(BillRepositoryInterface $repository): JsonResponse
{
- $start = session('start', today(config('app.timezone'))->startOfMonth());
- $end = session('end', today(config('app.timezone'))->endOfMonth());
- $cache = new CacheProperties();
+ $start = session('start', today(config('app.timezone'))->startOfMonth());
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.bill.frontpage');
@@ -93,7 +93,7 @@ class BillController extends Controller
];
}
- $data = $this->generator->multiCurrencyPieChart($chartData);
+ $data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
return response()->json($data);
@@ -106,17 +106,17 @@ class BillController extends Controller
*/
public function single(Bill $bill): JsonResponse
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('chart.bill.single');
$cache->addProperty($bill->id);
if ($cache->has()) {
return response()->json($cache->get());
}
- $locale = app('steam')->getLocale();
+ $locale = app('steam')->getLocale();
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
- $journals = $collector->setBill($bill)->getExtractedJournals();
+ $collector = app(GroupCollectorInterface::class);
+ $journals = $collector->setBill($bill)->getExtractedJournals();
// sort the other way around:
usort(
@@ -166,7 +166,7 @@ class BillController extends Controller
if (!array_key_exists($date, $chartData[2]['entries'])) {
$chartData[2]['entries'][$date] = '0';
}
- $amount = bcmul($journal['amount'], '-1');
+ $amount = bcmul($journal['amount'], '-1');
if ($currencyId === $journal['foreign_currency_id']) {
$amount = bcmul($journal['foreign_amount'], '-1');
}
@@ -174,7 +174,7 @@ class BillController extends Controller
$chartData[2]['entries'][$date] = bcadd($chartData[2]['entries'][$date], $amount); // amount of journal
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 031ce9f6a5..63d8051745 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -83,11 +83,11 @@ class BudgetController extends Controller
public function budget(Budget $budget): JsonResponse
{
/** @var Carbon $start */
- $start = $this->repository->firstUseDate($budget) ?? session('start', today(config('app.timezone')));
+ $start = $this->repository->firstUseDate($budget) ?? session('start', today(config('app.timezone')));
/** @var Carbon $end */
- $end = session('end', today(config('app.timezone')));
- $cache = new CacheProperties();
+ $end = session('end', today(config('app.timezone')));
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.budget.budget');
@@ -105,19 +105,19 @@ class BudgetController extends Controller
$defaultEntries = [];
while ($end >= $loopStart) {
/** @var Carbon $loopEnd */
- $loopEnd = app('navigation')->endOfPeriod($loopStart, $step);
- $spent = $this->opsRepository->sumExpenses($loopStart, $loopEnd, null, $collection);
- $label = trim(app('navigation')->periodShow($loopStart, $step));
+ $loopEnd = app('navigation')->endOfPeriod($loopStart, $step);
+ $spent = $this->opsRepository->sumExpenses($loopStart, $loopEnd, null, $collection);
+ $label = trim(app('navigation')->periodShow($loopStart, $step));
foreach ($spent as $row) {
- $currencyId = $row['currency_id'];
+ $currencyId = $row['currency_id'];
$currencies[$currencyId] ??= $row; // don't mind the field 'sum'
// also store this day's sum:
$currencies[$currencyId]['spent'][$label] = $row['sum'];
}
$defaultEntries[$label] = 0;
// set loop start to the next period:
- $loopStart = clone $loopEnd;
+ $loopStart = clone $loopEnd;
$loopStart->addSecond();
}
// loop all currencies:
@@ -133,7 +133,7 @@ class BudgetController extends Controller
$chartData[$currencyId]['entries'][$label] = bcmul($spent, '-1');
}
}
- $data = $this->generator->multiSet(array_values($chartData));
+ $data = $this->generator->multiSet(array_values($chartData));
$cache->store($data);
return response()->json($data);
@@ -150,9 +150,9 @@ class BudgetController extends Controller
throw new FireflyException('This budget limit is not part of this budget.');
}
- $start = clone $budgetLimit->start_date;
- $end = clone $budgetLimit->end_date;
- $cache = new CacheProperties();
+ $start = clone $budgetLimit->start_date;
+ $end = clone $budgetLimit->end_date;
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.budget.budget.limit');
@@ -162,11 +162,11 @@ class BudgetController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
- $locale = app('steam')->getLocale();
- $entries = [];
- $amount = $budgetLimit->amount;
- $budgetCollection = new Collection([$budget]);
- $currency = $budgetLimit->transactionCurrency;
+ $locale = app('steam')->getLocale();
+ $entries = [];
+ $amount = $budgetLimit->amount;
+ $budgetCollection = new Collection([$budget]);
+ $currency = $budgetLimit->transactionCurrency;
while ($start <= $end) {
$current = clone $start;
$expenses = $this->opsRepository->sumExpenses($current, $current, null, $budgetCollection, $currency);
@@ -177,7 +177,7 @@ class BudgetController extends Controller
$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;
@@ -198,8 +198,8 @@ class BudgetController extends Controller
$cache->addProperty($budget->id);
$cache->addProperty($budgetLimitId);
$cache->addProperty('chart.budget.expense-asset');
- $start = session('first', today(config('app.timezone'))->startOfYear());
- $end = today();
+ $start = session('first', today(config('app.timezone'))->startOfYear());
+ $end = today();
if (null !== $budgetLimit) {
$start = $budgetLimit->start_date;
@@ -214,14 +214,14 @@ class BudgetController extends Controller
}
$collector->setRange($start, $end);
$collector->setBudget($budget);
- $journals = $collector->getExtractedJournals();
- $result = [];
- $chartData = [];
+ $journals = $collector->getExtractedJournals();
+ $result = [];
+ $chartData = [];
// group by asset account ID:
foreach ($journals as $journal) {
$key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -230,7 +230,7 @@ class BudgetController extends Controller
$result[$key]['amount'] = bcadd($journal['amount'], $result[$key]['amount']);
}
- $names = $this->getAccountNames(array_keys($result));
+ $names = $this->getAccountNames(array_keys($result));
foreach ($result as $combinedId => $info) {
$parts = explode('-', $combinedId);
$assetId = (int)$parts[0];
@@ -243,7 +243,7 @@ class BudgetController extends Controller
];
}
- $data = $this->generator->multiCurrencyPieChart($chartData);
+ $data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
return response()->json($data);
@@ -261,8 +261,8 @@ class BudgetController extends Controller
$cache->addProperty($budget->id);
$cache->addProperty($budgetLimitId);
$cache->addProperty('chart.budget.expense-category');
- $start = session('first', today(config('app.timezone'))->startOfYear());
- $end = today();
+ $start = session('first', today(config('app.timezone'))->startOfYear());
+ $end = today();
if (null !== $budgetLimit) {
$start = $budgetLimit->start_date;
$end = $budgetLimit->end_date;
@@ -276,12 +276,12 @@ class BudgetController extends Controller
}
$collector->setRange($start, $end);
$collector->setBudget($budget)->withCategoryInformation();
- $journals = $collector->getExtractedJournals();
- $result = [];
- $chartData = [];
+ $journals = $collector->getExtractedJournals();
+ $result = [];
+ $chartData = [];
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -290,7 +290,7 @@ class BudgetController extends Controller
$result[$key]['amount'] = bcadd($journal['amount'], $result[$key]['amount']);
}
- $names = $this->getCategoryNames(array_keys($result));
+ $names = $this->getCategoryNames(array_keys($result));
foreach ($result as $combinedId => $info) {
$parts = explode('-', $combinedId);
$categoryId = (int)$parts[0];
@@ -301,7 +301,7 @@ class BudgetController extends Controller
'currency_code' => $info['currency_code'],
];
}
- $data = $this->generator->multiCurrencyPieChart($chartData);
+ $data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
return response()->json($data);
@@ -319,8 +319,8 @@ class BudgetController extends Controller
$cache->addProperty($budget->id);
$cache->addProperty($budgetLimitId);
$cache->addProperty('chart.budget.expense-expense');
- $start = session('first', today(config('app.timezone'))->startOfYear());
- $end = today();
+ $start = session('first', today(config('app.timezone'))->startOfYear());
+ $end = today();
if (null !== $budgetLimit) {
$start = $budgetLimit->start_date;
$end = $budgetLimit->end_date;
@@ -334,14 +334,14 @@ class BudgetController extends Controller
}
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::WITHDRAWAL])->setBudget($budget)->withAccountInformation();
- $journals = $collector->getExtractedJournals();
- $result = [];
- $chartData = [];
+ $journals = $collector->getExtractedJournals();
+ $result = [];
+ $chartData = [];
/** @var array $journal */
foreach ($journals as $journal) {
$key = sprintf('%d-%d', $journal['destination_account_id'], $journal['currency_id']);
- $result[$key] ??= [
+ $result[$key] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -350,7 +350,7 @@ class BudgetController extends Controller
$result[$key]['amount'] = bcadd($journal['amount'], $result[$key]['amount']);
}
- $names = $this->getAccountNames(array_keys($result));
+ $names = $this->getAccountNames(array_keys($result));
foreach ($result as $combinedId => $info) {
$parts = explode('-', $combinedId);
$opposingId = (int)$parts[0];
@@ -363,7 +363,7 @@ class BudgetController extends Controller
];
}
- $data = $this->generator->multiCurrencyPieChart($chartData);
+ $data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
return response()->json($data);
@@ -374,11 +374,11 @@ class BudgetController extends Controller
*/
public function frontpage(): JsonResponse
{
- $start = session('start', today(config('app.timezone'))->startOfMonth());
- $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $start = session('start', today(config('app.timezone'))->startOfMonth());
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.budget.frontpage');
@@ -391,8 +391,8 @@ class BudgetController extends Controller
$chartGenerator->setStart($start);
$chartGenerator->setEnd($end);
- $chartData = $chartGenerator->generate();
- $data = $this->generator->multiSet($chartData);
+ $chartData = $chartGenerator->generate();
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
@@ -408,7 +408,7 @@ class BudgetController extends Controller
public function period(Budget $budget, TransactionCurrency $currency, Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($accounts);
@@ -437,11 +437,11 @@ class BudgetController extends Controller
],
];
- $currentStart = clone $start;
+ $currentStart = clone $start;
while ($currentStart <= $end) {
- $currentStart = app('navigation')->startOfPeriod($currentStart, $preferredRange);
- $title = $currentStart->isoFormat($titleFormat);
- $currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);
+ $currentStart = app('navigation')->startOfPeriod($currentStart, $preferredRange);
+ $title = $currentStart->isoFormat($titleFormat);
+ $currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);
// default limit is no limit:
$chartData[0]['entries'][$title] = 0;
@@ -450,7 +450,7 @@ class BudgetController extends Controller
$chartData[1]['entries'][$title] = 0;
// get budget limit in this period for this currency.
- $limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd);
+ $limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd);
if (null !== $limit) {
$chartData[1]['entries'][$title] = app('steam')->bcround($limit->amount, $currency->decimal_places);
}
@@ -460,11 +460,11 @@ class BudgetController extends Controller
$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');
$chartData[0]['entries'][$title] = app('steam')->bcround($amount, $currency->decimal_places);
- $currentStart = clone $currentEnd;
+ $currentStart = clone $currentEnd;
$currentStart->addDay()->startOfDay();
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
@@ -476,7 +476,7 @@ class BudgetController extends Controller
public function periodNoBudget(TransactionCurrency $currency, Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($accounts);
@@ -500,7 +500,7 @@ class BudgetController extends Controller
$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.php
index 2d5a3b16dd..9f5260dd8d 100644
--- a/app/Http/Controllers/Chart/BudgetReportController.php
+++ b/app/Http/Controllers/Chart/BudgetReportController.php
@@ -76,7 +76,7 @@ class BudgetReportController extends Controller
// loop expenses.
foreach ($spent as $currency) {
foreach ($currency['budgets'] as $budget) {
- $title = sprintf('%s (%s)', $budget['name'], $currency['currency_name']);
+ $title = sprintf('%s (%s)', $budget['name'], $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -89,7 +89,7 @@ class BudgetReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -105,8 +105,8 @@ class BudgetReportController extends Controller
foreach ($spent as $currency) {
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
- $categoryName = $journal['category_name'] ?? trans('firefly.no_category');
- $title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
+ $categoryName = $journal['category_name'] ?? trans('firefly.no_category');
+ $title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -119,7 +119,7 @@ class BudgetReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -136,7 +136,7 @@ class BudgetReportController extends Controller
foreach ($spent as $currency) {
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
- $title = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
+ $title = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -149,7 +149,7 @@ class BudgetReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -166,7 +166,7 @@ class BudgetReportController extends Controller
// loop expenses.
foreach ($spent as $currency) {
// add things to chart Data for each currency:
- $spentKey = sprintf('%d-spent', $currency['currency_id']);
+ $spentKey = sprintf('%d-spent', $currency['currency_id']);
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
@@ -190,7 +190,7 @@ class BudgetReportController extends Controller
}
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
return response()->json($data);
}
@@ -207,7 +207,7 @@ class BudgetReportController extends Controller
foreach ($spent as $currency) {
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
- $title = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
+ $title = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -220,7 +220,7 @@ class BudgetReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index 1462f2046b..6239ef4d6e 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -71,7 +71,7 @@ class CategoryController extends Controller
public function all(Category $category): JsonResponse
{
// cache results:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('chart.category.all');
$cache->addProperty($category->id);
if ($cache->has()) {
@@ -79,11 +79,11 @@ class CategoryController extends Controller
}
/** @var CategoryRepositoryInterface $repository */
- $repository = app(CategoryRepositoryInterface::class);
- $start = $repository->firstUseDate($category) ?? $this->getDate();
- $range = app('navigation')->getViewRange(false);
- $start = app('navigation')->startOfPeriod($start, $range);
- $end = $this->getDate();
+ $repository = app(CategoryRepositoryInterface::class);
+ $start = $repository->firstUseDate($category) ?? $this->getDate();
+ $range = app('navigation')->getViewRange(false);
+ $start = app('navigation')->startOfPeriod($start, $range);
+ $end = $this->getDate();
/** @var WholePeriodChartGenerator $chartGenerator */
$chartGenerator = app(WholePeriodChartGenerator::class);
@@ -100,10 +100,10 @@ class CategoryController extends Controller
*/
public function frontPage(): JsonResponse
{
- $start = session('start', today(config('app.timezone'))->startOfMonth());
- $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $start = session('start', today(config('app.timezone'))->startOfMonth());
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.category.frontpage');
@@ -134,7 +134,7 @@ class CategoryController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
- $data = $this->reportPeriodChart($accounts, $start, $end, $category);
+ $data = $this->reportPeriodChart($accounts, $start, $end, $category);
$cache->store($data);
@@ -155,7 +155,7 @@ class CategoryController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
- $data = $this->reportPeriodChart($accounts, $start, $end, null);
+ $data = $this->reportPeriodChart($accounts, $start, $end, null);
$cache->store($data);
@@ -170,14 +170,14 @@ class CategoryController extends Controller
*/
public function specificPeriod(Category $category, Carbon $date): JsonResponse
{
- $range = app('navigation')->getViewRange(false);
- $start = app('navigation')->startOfPeriod($date, $range);
- $end = session()->get('end');
+ $range = app('navigation')->getViewRange(false);
+ $start = app('navigation')->startOfPeriod($date, $range);
+ $end = session()->get('end');
if ($end < $start) {
[$end, $start] = [$start, $end];
}
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($category->id);
@@ -214,8 +214,8 @@ class CategoryController extends Controller
$noCatRepository = app(NoCategoryRepositoryInterface::class);
// this gives us all currencies
- $expenses = $noCatRepository->listExpenses($start, $end, $accounts);
- $income = $noCatRepository->listIncome($start, $end, $accounts);
+ $expenses = $noCatRepository->listExpenses($start, $end, $accounts);
+ $income = $noCatRepository->listIncome($start, $end, $accounts);
}
if (null !== $category) {
@@ -223,9 +223,9 @@ class CategoryController extends Controller
$opsRepository = app(OperationsRepositoryInterface::class);
$categoryId = $category->id;
// this gives us all currencies
- $collection = new Collection([$category]);
- $expenses = $opsRepository->listExpenses($start, $end, null, $collection);
- $income = $opsRepository->listIncome($start, $end, null, $collection);
+ $collection = new Collection([$category]);
+ $expenses = $opsRepository->listExpenses($start, $end, null, $collection);
+ $income = $opsRepository->listIncome($start, $end, null, $collection);
}
$currencies = array_unique(array_merge(array_keys($income), array_keys($expenses)));
$periods = app('navigation')->listOfPeriods($start, $end);
@@ -246,7 +246,7 @@ class CategoryController extends Controller
];
$chartData[$inKey]
- = [
+ = [
'label' => sprintf('%s (%s)', (string)trans('firefly.earned'), $currencyInfo['currency_name']),
'entries' => [],
'type' => 'bar',
@@ -259,7 +259,7 @@ class CategoryController extends Controller
$chartData[$inKey]['entries'][$label] = '0';
}
// loop income and expenses for this category.:
- $outSet = $expenses[$currencyId]['categories'][$categoryId] ?? ['transaction_journals' => []];
+ $outSet = $expenses[$currencyId]['categories'][$categoryId] ?? ['transaction_journals' => []];
foreach ($outSet['transaction_journals'] as $journal) {
$amount = app('steam')->positive($journal['amount']);
$date = $journal['date']->isoFormat($format);
@@ -268,7 +268,7 @@ class CategoryController extends Controller
$chartData[$outKey]['entries'][$date] = bcadd($amount, $chartData[$outKey]['entries'][$date]);
}
- $inSet = $income[$currencyId]['categories'][$categoryId] ?? ['transaction_journals' => []];
+ $inSet = $income[$currencyId]['categories'][$categoryId] ?? ['transaction_journals' => []];
foreach ($inSet['transaction_journals'] as $journal) {
$amount = app('steam')->positive($journal['amount']);
$date = $journal['date']->isoFormat($format);
diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php
index dc44a64947..ad0e6555f9 100644
--- a/app/Http/Controllers/Chart/CategoryReportController.php
+++ b/app/Http/Controllers/Chart/CategoryReportController.php
@@ -77,7 +77,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -88,7 +88,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -102,7 +102,7 @@ class CategoryReportController extends Controller
foreach ($spent as $currency) {
/** @var array $category */
foreach ($currency['categories'] as $category) {
- $title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
+ $title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -115,7 +115,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -129,7 +129,7 @@ class CategoryReportController extends Controller
foreach ($earned as $currency) {
/** @var array $category */
foreach ($currency['categories'] as $category) {
- $title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
+ $title = sprintf('%s (%s)', $category['name'], $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -142,7 +142,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -159,7 +159,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -170,7 +170,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -187,7 +187,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -198,7 +198,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -213,7 +213,7 @@ class CategoryReportController extends Controller
// loop expenses.
foreach ($spent as $currency) {
// add things to chart Data for each currency:
- $spentKey = sprintf('%d-spent', $currency['currency_id']);
+ $spentKey = sprintf('%d-spent', $currency['currency_id']);
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
@@ -240,7 +240,7 @@ class CategoryReportController extends Controller
// loop income.
foreach ($earned as $currency) {
// add things to chart Data for each currency:
- $spentKey = sprintf('%d-earned', $currency['currency_id']);
+ $spentKey = sprintf('%d-earned', $currency['currency_id']);
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
@@ -264,7 +264,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
return response()->json($data);
}
@@ -281,7 +281,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -292,7 +292,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -309,7 +309,7 @@ class CategoryReportController extends Controller
foreach ($category['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -320,7 +320,7 @@ class CategoryReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
diff --git a/app/Http/Controllers/Chart/DoubleReportController.php b/app/Http/Controllers/Chart/DoubleReportController.php
index 12e588e416..0e9a9b08e1 100644
--- a/app/Http/Controllers/Chart/DoubleReportController.php
+++ b/app/Http/Controllers/Chart/DoubleReportController.php
@@ -75,7 +75,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -85,7 +85,7 @@ class DoubleReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -102,7 +102,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -112,7 +112,7 @@ class DoubleReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -129,7 +129,7 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -139,7 +139,7 @@ class DoubleReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -148,11 +148,11 @@ class DoubleReportController extends Controller
{
$chartData = [];
- $opposing = $this->repository->expandWithDoubles(new Collection([$account]));
- $accounts = $accounts->merge($opposing);
- $spent = $this->opsRepository->listExpenses($start, $end, $accounts);
- $earned = $this->opsRepository->listIncome($start, $end, $accounts);
- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
+ $opposing = $this->repository->expandWithDoubles(new Collection([$account]));
+ $accounts = $accounts->merge($opposing);
+ $spent = $this->opsRepository->listExpenses($start, $end, $accounts);
+ $earned = $this->opsRepository->listIncome($start, $end, $accounts);
+ $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
// loop expenses.
foreach ($spent as $currency) {
@@ -207,7 +207,7 @@ class DoubleReportController extends Controller
}
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
return response()->json($data);
}
@@ -226,11 +226,11 @@ class DoubleReportController extends Controller
// no tags? also deserves a sport
if (0 === count($journal['tags'])) {
- $includedJournals[] = $journalId;
+ $includedJournals[] = $journalId;
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -245,11 +245,11 @@ class DoubleReportController extends Controller
if (in_array($journalId, $includedJournals, true)) {
continue;
}
- $includedJournals[] = $journalId;
+ $includedJournals[] = $journalId;
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -260,7 +260,7 @@ class DoubleReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -279,11 +279,11 @@ class DoubleReportController extends Controller
// no tags? also deserves a sport
if (0 === count($journal['tags'])) {
- $includedJournals[] = $journalId;
+ $includedJournals[] = $journalId;
// do something
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -298,11 +298,11 @@ class DoubleReportController extends Controller
if (in_array($journalId, $includedJournals, true)) {
continue;
}
- $includedJournals[] = $journalId;
+ $includedJournals[] = $journalId;
// do something
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -313,7 +313,7 @@ class DoubleReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.php
index 7af88f454e..f393f2a09e 100644
--- a/app/Http/Controllers/Chart/ExpenseReportController.php
+++ b/app/Http/Controllers/Chart/ExpenseReportController.php
@@ -72,7 +72,7 @@ class ExpenseReportController extends Controller
*/
public function mainChart(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): JsonResponse
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('chart.expense.report.main');
$cache->addProperty($accounts);
$cache->addProperty($expense);
@@ -100,14 +100,14 @@ class ExpenseReportController extends Controller
foreach ($combined as $name => $combination) {
// first is always expense account:
/** @var Account $exp */
- $exp = $combination->first();
- $chartData[$exp->id.'-in'] = [
+ $exp = $combination->first();
+ $chartData[$exp->id.'-in'] = [
'label' => sprintf('%s (%s)', $name, (string) trans('firefly.income')),
'type' => 'bar',
'yAxisID' => 'y-axis-0',
'entries' => [],
];
- $chartData[$exp->id.'-out'] = [
+ $chartData[$exp->id.'-out'] = [
'label' => sprintf('%s (%s)', $name, (string) trans('firefly.expenses')),
'type' => 'bar',
'yAxisID' => 'y-axis-0',
@@ -134,30 +134,30 @@ class ExpenseReportController extends Controller
$sumOfExpense = [];
while ($currentStart < $end) {
- $currentEnd = clone $currentStart;
- $currentEnd = $currentEnd->{$function}(); // @phpstan-ignore-line
+ $currentEnd = clone $currentStart;
+ $currentEnd = $currentEnd->{$function}(); // @phpstan-ignore-line
// get expenses grouped by opposing name:
- $expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
- $income = $this->groupByName($this->getIncomeForOpposing($accounts, $all, $currentStart, $currentEnd));
- $label = $currentStart->isoFormat($format);
+ $expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
+ $income = $this->groupByName($this->getIncomeForOpposing($accounts, $all, $currentStart, $currentEnd));
+ $label = $currentStart->isoFormat($format);
foreach ($combined as $name => $combination) {
// first is always expense account:
/** @var Account $exp */
- $exp = $combination->first();
- $labelIn = $exp->id.'-in';
- $labelOut = $exp->id.'-out';
- $labelSumIn = $exp->id.'-total-in';
- $labelSumOut = $exp->id.'-total-out';
- $currentIncome = bcmul($income[$name] ?? '0', '-1');
- $currentExpense = $expenses[$name] ?? '0';
+ $exp = $combination->first();
+ $labelIn = $exp->id.'-in';
+ $labelOut = $exp->id.'-out';
+ $labelSumIn = $exp->id.'-total-in';
+ $labelSumOut = $exp->id.'-total-out';
+ $currentIncome = bcmul($income[$name] ?? '0', '-1');
+ $currentExpense = $expenses[$name] ?? '0';
// add to sum:
$sumOfIncome[$exp->id] ??= '0';
$sumOfExpense[$exp->id] ??= '0';
- $sumOfIncome[$exp->id] = bcadd($sumOfIncome[$exp->id], $currentIncome);
- $sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense);
+ $sumOfIncome[$exp->id] = bcadd($sumOfIncome[$exp->id], $currentIncome);
+ $sumOfExpense[$exp->id] = bcadd($sumOfExpense[$exp->id], $currentExpense);
// add to chart:
$chartData[$labelIn]['entries'][$label] = $currentIncome;
@@ -172,7 +172,7 @@ class ExpenseReportController extends Controller
$currentStart->startOfDay();
}
// remove all empty entries to prevent cluttering:
- $newSet = [];
+ $newSet = [];
foreach ($chartData as $key => $entry) {
// TODO not sure, this is a bad comparison.
if (array_sum($entry['entries']) > 0) {
@@ -182,7 +182,7 @@ class ExpenseReportController extends Controller
if (0 === count($newSet)) {
$newSet = $chartData;
}
- $data = $this->generator->multiSet($newSet);
+ $data = $this->generator->multiSet($newSet);
$cache->store($data);
return response()->json($data);
diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php
index c1095d1e09..4bf27e2748 100644
--- a/app/Http/Controllers/Chart/PiggyBankController.php
+++ b/app/Http/Controllers/Chart/PiggyBankController.php
@@ -64,30 +64,30 @@ class PiggyBankController extends Controller
public function history(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank): JsonResponse
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('chart.piggy-bank.history');
$cache->addProperty($piggyBank->id);
if ($cache->has()) {
return response()->json($cache->get());
}
- $set = $repository->getEvents($piggyBank);
- $set = $set->reverse();
- $locale = app('steam')->getLocale();
+ $set = $repository->getEvents($piggyBank);
+ $set = $set->reverse();
+ $locale = app('steam')->getLocale();
// get first event or start date of piggy bank or today
- $startDate = $piggyBank->startdate ?? today(config('app.timezone'));
+ $startDate = $piggyBank->startdate ?? today(config('app.timezone'));
/** @var null|PiggyBankEvent $firstEvent */
- $firstEvent = $set->first();
- $firstDate = null === $firstEvent ? new Carbon() : $firstEvent->date;
+ $firstEvent = $set->first();
+ $firstDate = null === $firstEvent ? new Carbon() : $firstEvent->date;
// which ever is older:
- $oldest = $startDate->lt($firstDate) ? $startDate : $firstDate;
- $today = today(config('app.timezone'));
+ $oldest = $startDate->lt($firstDate) ? $startDate : $firstDate;
+ $today = today(config('app.timezone'));
// depending on diff, do something with range of chart.
- $step = $this->calculateStep($oldest, $today);
+ $step = $this->calculateStep($oldest, $today);
- $chartData = [];
+ $chartData = [];
while ($oldest <= $today) {
$filtered = $set->filter(
static function (PiggyBankEvent $event) use ($oldest) {
@@ -108,7 +108,7 @@ class PiggyBankController extends Controller
$finalLabel = $today->isoFormat((string)trans('config.month_and_day_js', [], $locale));
$chartData[$finalLabel] = $finalSum;
- $data = $this->generator->singleSet($piggyBank->name, $chartData);
+ $data = $this->generator->singleSet($piggyBank->name, $chartData);
$cache->store($data);
return response()->json($data);
diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php
index 0aaff2b61e..6ab91d266b 100644
--- a/app/Http/Controllers/Chart/ReportController.php
+++ b/app/Http/Controllers/Chart/ReportController.php
@@ -64,7 +64,7 @@ class ReportController extends Controller
public function netWorth(Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('chart.report.net-worth');
$cache->addProperty($start);
$cache->addProperty(implode(',', $accounts->pluck('id')->toArray()));
@@ -72,12 +72,12 @@ class ReportController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
- $locale = app('steam')->getLocale();
- $current = clone $start;
- $chartData = [];
+ $locale = app('steam')->getLocale();
+ $current = clone $start;
+ $chartData = [];
/** @var NetWorthInterface $helper */
- $helper = app(NetWorthInterface::class);
+ $helper = app(NetWorthInterface::class);
$helper->setUser(auth()->user());
// filter accounts on having the preference for being included.
@@ -107,8 +107,8 @@ class ReportController extends Controller
if ('native' === $key) {
continue;
}
- $currencyId = $netWorthItem['currency_id'];
- $label = $current->isoFormat((string) trans('config.month_and_day_js', [], $locale));
+ $currencyId = $netWorthItem['currency_id'];
+ $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'],
@@ -123,7 +123,7 @@ class ReportController extends Controller
$current->addDays(7);
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
@@ -137,7 +137,7 @@ class ReportController extends Controller
public function operations(Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('chart.report.operations');
$cache->addProperty($start);
$cache->addProperty($accounts);
@@ -154,17 +154,17 @@ class ReportController extends Controller
$chartData = [];
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->withAccountInformation();
$collector->setXorAccounts($accounts);
$collector->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::RECONCILIATION, TransactionType::TRANSFER]);
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
// loop. group by currency and by period.
/** @var array $journal */
foreach ($journals as $journal) {
- $period = $journal['date']->format($format);
- $currencyId = (int) $journal['currency_id'];
+ $period = $journal['date']->format($format);
+ $currencyId = (int) $journal['currency_id'];
$data[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_symbol' => $journal['currency_symbol'],
@@ -178,8 +178,8 @@ class ReportController extends Controller
'earned' => '0',
];
// in our outgoing?
- $key = 'spent';
- $amount = app('steam')->positive($journal['amount']);
+ $key = 'spent';
+ $amount = app('steam')->positive($journal['amount']);
// deposit = incoming
// transfer or reconcile or opening balance, and these accounts are the destination.
@@ -192,7 +192,7 @@ class ReportController extends Controller
// loop this data, make chart bars for each currency:
/** @var array $currency */
foreach ($data as $currency) {
- $income = [
+ $income = [
'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
'type' => 'bar',
'backgroundColor' => 'rgba(0, 141, 76, 0.5)', // green
@@ -201,7 +201,7 @@ class ReportController extends Controller
'currency_code' => $currency['currency_code'],
'entries' => [],
];
- $expense = [
+ $expense = [
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
'type' => 'bar',
'backgroundColor' => 'rgba(219, 68, 55, 0.5)', // red
@@ -220,11 +220,11 @@ class ReportController extends Controller
$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);
}
- $chartData[] = $income;
- $chartData[] = $expense;
+ $chartData[] = $income;
+ $chartData[] = $expense;
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
$cache->store($data);
return response()->json($data);
diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php
index 0750cf8635..9c1d2fdedc 100644
--- a/app/Http/Controllers/Chart/TagReportController.php
+++ b/app/Http/Controllers/Chart/TagReportController.php
@@ -77,7 +77,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['budget_name'] ?? trans('firefly.no_budget');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -88,7 +88,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -105,7 +105,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -116,7 +116,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -133,7 +133,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -144,7 +144,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -161,7 +161,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -172,7 +172,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -189,7 +189,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['destination_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -200,7 +200,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -218,7 +218,7 @@ class TagReportController extends Controller
// loop expenses.
foreach ($spent as $currency) {
// add things to chart Data for each currency:
- $spentKey = sprintf('%d-spent', $currency['currency_id']);
+ $spentKey = sprintf('%d-spent', $currency['currency_id']);
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
@@ -245,7 +245,7 @@ class TagReportController extends Controller
// loop income.
foreach ($earned as $currency) {
// add things to chart Data for each currency:
- $spentKey = sprintf('%d-earned', $currency['currency_id']);
+ $spentKey = sprintf('%d-earned', $currency['currency_id']);
$chartData[$spentKey] ??= [
'label' => sprintf(
'%s (%s)',
@@ -269,7 +269,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiSet($chartData);
+ $data = $this->generator->multiSet($chartData);
return response()->json($data);
}
@@ -286,7 +286,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -297,7 +297,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -314,7 +314,7 @@ class TagReportController extends Controller
foreach ($tag['transaction_journals'] as $journal) {
$objectName = $journal['source_account_name'] ?? trans('firefly.empty');
$title = sprintf('%s (%s)', $objectName, $currency['currency_name']);
- $result[$title] ??= [
+ $result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
@@ -325,7 +325,7 @@ class TagReportController extends Controller
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -339,7 +339,7 @@ class TagReportController extends Controller
foreach ($spent as $currency) {
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
- $title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
+ $title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -351,7 +351,7 @@ class TagReportController extends Controller
}
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
@@ -365,7 +365,7 @@ class TagReportController extends Controller
foreach ($earned as $currency) {
/** @var array $tag */
foreach ($currency['tags'] as $tag) {
- $title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
+ $title = sprintf('%s (%s)', $tag['name'], $currency['currency_name']);
$result[$title] ??= [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
@@ -377,7 +377,7 @@ class TagReportController extends Controller
}
}
}
- $data = $this->generator->multiCurrencyPieChart($result);
+ $data = $this->generator->multiCurrencyPieChart($result);
return response()->json($data);
}
diff --git a/app/Http/Controllers/Chart/TransactionController.php b/app/Http/Controllers/Chart/TransactionController.php
index 65c73207d4..d587d58024 100644
--- a/app/Http/Controllers/Chart/TransactionController.php
+++ b/app/Http/Controllers/Chart/TransactionController.php
@@ -54,7 +54,7 @@ class TransactionController extends Controller
*/
public function budgets(Carbon $start, Carbon $end)
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.transactions.budgets');
@@ -68,22 +68,22 @@ class TransactionController extends Controller
$collector->withBudgetInformation();
$collector->setTypes([TransactionType::WITHDRAWAL]);
- $result = $collector->getExtractedJournals();
- $data = [];
+ $result = $collector->getExtractedJournals();
+ $data = [];
// group by category.
/** @var array $journal */
foreach ($result as $journal) {
$budget = $journal['budget_name'] ?? (string)trans('firefly.no_budget');
$title = sprintf('%s (%s)', $budget, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
];
$data[$title]['amount'] = bcadd($data[$title]['amount'], $journal['amount']);
}
- $chart = $this->generator->multiCurrencyPieChart($data);
+ $chart = $this->generator->multiCurrencyPieChart($data);
$cache->store($chart);
return response()->json($chart);
@@ -94,7 +94,7 @@ class TransactionController extends Controller
*/
public function categories(string $objectType, Carbon $start, Carbon $end)
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($objectType);
@@ -118,22 +118,22 @@ class TransactionController extends Controller
$collector->setTypes([TransactionType::TRANSFER]);
}
- $result = $collector->getExtractedJournals();
- $data = [];
+ $result = $collector->getExtractedJournals();
+ $data = [];
// group by category.
/** @var array $journal */
foreach ($result as $journal) {
$category = $journal['category_name'] ?? (string)trans('firefly.no_category');
$title = sprintf('%s (%s)', $category, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
];
$data[$title]['amount'] = bcadd($data[$title]['amount'], $journal['amount']);
}
- $chart = $this->generator->multiCurrencyPieChart($data);
+ $chart = $this->generator->multiCurrencyPieChart($data);
$cache->store($chart);
return response()->json($chart);
@@ -144,7 +144,7 @@ class TransactionController extends Controller
*/
public function destinationAccounts(string $objectType, Carbon $start, Carbon $end)
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($objectType);
@@ -168,22 +168,22 @@ class TransactionController extends Controller
$collector->setTypes([TransactionType::TRANSFER]);
}
- $result = $collector->getExtractedJournals();
- $data = [];
+ $result = $collector->getExtractedJournals();
+ $data = [];
// group by category.
/** @var array $journal */
foreach ($result as $journal) {
$name = $journal['destination_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
];
$data[$title]['amount'] = bcadd($data[$title]['amount'], $journal['amount']);
}
- $chart = $this->generator->multiCurrencyPieChart($data);
+ $chart = $this->generator->multiCurrencyPieChart($data);
$cache->store($chart);
return response()->json($chart);
@@ -194,7 +194,7 @@ class TransactionController extends Controller
*/
public function sourceAccounts(string $objectType, Carbon $start, Carbon $end)
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($objectType);
@@ -218,22 +218,22 @@ class TransactionController extends Controller
$collector->setTypes([TransactionType::TRANSFER]);
}
- $result = $collector->getExtractedJournals();
- $data = [];
+ $result = $collector->getExtractedJournals();
+ $data = [];
// group by category.
/** @var array $journal */
foreach ($result as $journal) {
$name = $journal['source_account_name'];
$title = sprintf('%s (%s)', $name, $journal['currency_symbol']);
- $data[$title] ??= [
+ $data[$title] ??= [
'amount' => '0',
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
];
$data[$title]['amount'] = bcadd($data[$title]['amount'], $journal['amount']);
}
- $chart = $this->generator->multiCurrencyPieChart($data);
+ $chart = $this->generator->multiCurrencyPieChart($data);
$cache->store($chart);
return response()->json($chart);
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 108467e35d..2c086c4057 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -66,25 +66,25 @@ abstract class Controller extends BaseController
app('view')->share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === config('firefly.allow_webhooks'));
// share custom auth guard info.
- $authGuard = config('firefly.authentication_guard');
- $logoutUrl = config('firefly.custom_logout_url');
+ $authGuard = config('firefly.authentication_guard');
+ $logoutUrl = config('firefly.custom_logout_url');
app('view')->share('authGuard', $authGuard);
app('view')->share('logoutUrl', $logoutUrl);
// upload size
- $maxFileSize = app('steam')->phpBytes((string)ini_get('upload_max_filesize'));
- $maxPostSize = app('steam')->phpBytes((string)ini_get('post_max_size'));
- $uploadSize = min($maxFileSize, $maxPostSize);
+ $maxFileSize = app('steam')->phpBytes((string)ini_get('upload_max_filesize'));
+ $maxPostSize = app('steam')->phpBytes((string)ini_get('post_max_size'));
+ $uploadSize = min($maxFileSize, $maxPostSize);
app('view')->share('uploadSize', $uploadSize);
// share is alpha, is beta
- $isAlpha = false;
+ $isAlpha = false;
if (str_contains(config('firefly.version'), 'alpha')) {
$isAlpha = true;
}
- $isBeta = false;
+ $isBeta = false;
if (str_contains(config('firefly.version'), 'beta')) {
$isBeta = true;
}
@@ -94,7 +94,7 @@ abstract class Controller extends BaseController
$this->middleware(
function ($request, $next): mixed {
- $locale = app('steam')->getLocale();
+ $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);
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index cf30b5eb2e..18abec5c9d 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -116,14 +116,14 @@ class DebugController extends Controller
*/
public function index()
{
- $table = $this->generateTable();
- $table = str_replace(["\n", "\t", ' '], '', $table);
- $now = now(config('app.timezone'))->format('Y-m-d H:i:s');
+ $table = $this->generateTable();
+ $table = str_replace(["\n", "\t", ' '], '', $table);
+ $now = now(config('app.timezone'))->format('Y-m-d H:i:s');
// get latest log file:
- $logger = Log::driver();
+ $logger = Log::driver();
// PHPstan doesn't recognize the method because of its polymorphic nature.
- $handlers = $logger->getHandlers(); // @phpstan-ignore-line
+ $handlers = $logger->getHandlers(); // @phpstan-ignore-line
$logContent = '';
foreach ($handlers as $handler) {
if ($handler instanceof RotatingFileHandler) {
@@ -227,7 +227,7 @@ class DebugController extends Controller
private function getAppInfo(): array
{
- $userGuard = config('auth.defaults.guard');
+ $userGuard = config('auth.defaults.guard');
$config = app('fireflyconfig')->get('last_rt_job', 0);
$lastTime = (int)$config->data;
@@ -252,24 +252,24 @@ class DebugController extends Controller
// any of the cron jobs will do, they always run at the same time.
// but this job is the oldest, so the biggest chance it ran once
- 'last_cronjob' => $lastCronjob,
- 'last_cronjob_ago' => $lastCronjobAgo,
+ 'last_cronjob' => $lastCronjob,
+ 'last_cronjob_ago' => $lastCronjobAgo,
];
}
private function getuserInfo(): array
{
- $userFlags = $this->getUserFlags();
+ $userFlags = $this->getUserFlags();
// user info
- $userAgent = request()->header('user-agent');
+ $userAgent = request()->header('user-agent');
// set languages, see what happens:
$original = setlocale(LC_ALL, '0');
$localeAttempts = [];
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
foreach ($parts as $code) {
- $code = trim($code);
+ $code = trim($code);
app('log')->debug(sprintf('Trying to set %s', $code));
$result = setlocale(LC_ALL, $code);
$localeAttempts[$code] = $result === $code;
@@ -293,7 +293,7 @@ class DebugController extends Controller
$flags = [];
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
// has liabilities
if ($user->accounts()->accountTypeIn([AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE])->count() > 0) {
@@ -306,7 +306,7 @@ class DebugController extends Controller
}
// has stored reconciliations
- $type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
+ $type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count() > 0) {
$flags[] = ':ledger:';
}
diff --git a/app/Http/Controllers/Export/IndexController.php b/app/Http/Controllers/Export/IndexController.php
index e99532fe21..d0560c9f0c 100644
--- a/app/Http/Controllers/Export/IndexController.php
+++ b/app/Http/Controllers/Export/IndexController.php
@@ -74,19 +74,19 @@ class IndexController extends Controller
// get first transaction in DB:
$firstDate = today(config('app.timezone'));
$firstDate->subYear();
- $journal = $this->journalRepository->firstNull();
+ $journal = $this->journalRepository->firstNull();
if (null !== $journal) {
$firstDate = clone $journal->date;
}
$generator->setStart($firstDate);
- $result = $generator->export();
+ $result = $generator->export();
- $name = sprintf('%s_transaction_export.csv', date('Y_m_d'));
- $quoted = sprintf('"%s"', addcslashes($name, '"\\'));
+ $name = sprintf('%s_transaction_export.csv', date('Y_m_d'));
+ $quoted = sprintf('"%s"', addcslashes($name, '"\\'));
// headers for CSV file.
/** @var LaravelResponse $response */
- $response = response($result['transactions']);
+ $response = response($result['transactions']);
$response
->header('Content-Description', 'File Transfer')
->header('Content-Type', 'text/x-csv')
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 403add26aa..cfda4df609 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -61,8 +61,8 @@ class HomeController extends Controller
*/
public function dateRange(Request $request): JsonResponse
{
- $stringStart = '';
- $stringEnd = '';
+ $stringStart = '';
+ $stringEnd = '';
try {
$stringStart = e((string)$request->get('start'));
@@ -97,7 +97,7 @@ class HomeController extends Controller
app('log')->debug('Range is now marked as "custom".');
}
- $diff = $start->diffInDays($end) + 1;
+ $diff = $start->diffInDays($end) + 1;
if ($diff > 50) {
$request->session()->flash('warning', (string)trans('firefly.warning_much_data', ['days' => $diff]));
@@ -120,8 +120,8 @@ class HomeController extends Controller
*/
public function index(AccountRepositoryInterface $repository): mixed
{
- $types = config('firefly.accountTypesByIdentifier.asset');
- $count = $repository->count($types);
+ $types = config('firefly.accountTypesByIdentifier.asset');
+ $count = $repository->count($types);
Log::channel('audit')->info('User visits homepage.');
if (0 === $count) {
@@ -136,15 +136,15 @@ class HomeController extends Controller
}
/** @var Carbon $start */
- $start = session('start', today(config('app.timezone'))->startOfMonth());
+ $start = session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = session('end', today(config('app.timezone'))->endOfMonth());
- $accounts = $repository->getAccountsById($frontPageArray);
- $today = today(config('app.timezone'));
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $accounts = $repository->getAccountsById($frontPageArray);
+ $today = today(config('app.timezone'));
// sort frontpage accounts by order
- $accounts = $accounts->sortBy('order');
+ $accounts = $accounts->sortBy('order');
app('log')->debug('Frontpage accounts are ', $frontPageArray);
@@ -154,14 +154,14 @@ class HomeController extends Controller
// collect groups for each transaction.
foreach ($accounts as $account) {
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->withAccountInformation()->setRange($start, $end)->setLimit(10)->setPage(1);
$set = $collector->getExtractedJournals();
$transactions[] = ['transactions' => $set, 'account' => $account];
}
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
event(new RequestedVersionCheckStatus($user));
return view('index', compact('count', 'subTitle', 'transactions', 'billCount', 'start', 'end', 'today'));
diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php
index 1de5892e55..f7068f2751 100644
--- a/app/Http/Controllers/JavascriptController.php
+++ b/app/Http/Controllers/JavascriptController.php
@@ -95,8 +95,8 @@ class JavascriptController extends Controller
* */
public function variables(Request $request, AccountRepositoryInterface $repository): Response
{
- $account = $repository->find((int)$request->get('account'));
- $currency = app('amount')->getDefaultCurrency();
+ $account = $repository->find((int)$request->get('account'));
+ $currency = app('amount')->getDefaultCurrency();
if (null !== $account) {
$currency = $repository->getAccountCurrency($account) ?? $currency;
}
@@ -108,7 +108,7 @@ class JavascriptController extends Controller
$dateRange = $this->getDateRangeConfig();
$uid = substr(hash('sha256', sprintf('%s-%s-%s', (string)config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12);
- $data = [
+ $data = [
'currencyCode' => $currency->code,
'currencySymbol' => $currency->symbol,
'accountingLocaleInfo' => $accounting,
@@ -135,9 +135,9 @@ class JavascriptController extends Controller
$start = clone session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = clone session('end', today(config('app.timezone'))->endOfMonth());
+ $end = clone session('end', today(config('app.timezone'))->endOfMonth());
- $data = [
+ $data = [
'start' => $start->format('Y-m-d'),
'end' => $end->format('Y-m-d'),
];
diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php
index 556d844657..d94b3e9173 100644
--- a/app/Http/Controllers/Json/BoxController.php
+++ b/app/Http/Controllers/Json/BoxController.php
@@ -56,22 +56,22 @@ class BoxController extends Controller
app('log')->debug('Now in available()');
/** @var OperationsRepositoryInterface $opsRepository */
- $opsRepository = app(OperationsRepositoryInterface::class);
+ $opsRepository = app(OperationsRepositoryInterface::class);
/** @var AvailableBudgetRepositoryInterface $abRepository */
- $abRepository = app(AvailableBudgetRepositoryInterface::class);
+ $abRepository = app(AvailableBudgetRepositoryInterface::class);
$abRepository->cleanup();
/** @var Carbon $start */
- $start = session('start', today(config('app.timezone'))->startOfMonth());
+ $start = session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = session('end', today(config('app.timezone'))->endOfMonth());
- $today = today(config('app.timezone'));
- $display = 2; // see method docs.
- $boxTitle = (string)trans('firefly.spent');
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $today = today(config('app.timezone'));
+ $display = 2; // see method docs.
+ $boxTitle = (string)trans('firefly.spent');
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($today);
@@ -82,11 +82,11 @@ class BoxController extends Controller
$leftPerDayAmount = '0';
$leftToSpendAmount = '0';
- $currency = app('amount')->getDefaultCurrency();
+ $currency = app('amount')->getDefaultCurrency();
app('log')->debug(sprintf('Default currency is %s', $currency->code));
- $availableBudgets = $abRepository->getAvailableBudgetsByExactDate($start, $end);
+ $availableBudgets = $abRepository->getAvailableBudgetsByExactDate($start, $end);
app('log')->debug(sprintf('Found %d available budget(s)', $availableBudgets->count()));
- $availableBudgets = $availableBudgets->filter(
+ $availableBudgets = $availableBudgets->filter(
static function (AvailableBudget $availableBudget) use ($currency) { // @phpstan-ignore-line
if ($availableBudget->transaction_currency_id === $currency->id) {
app('log')->debug(sprintf(
@@ -106,13 +106,13 @@ class BoxController extends Controller
app('log')->debug(sprintf('Filtered back to %d available budgets', $availableBudgets->count()));
// spent in this period, in budgets, for default currency.
// also calculate spent per day.
- $spent = $opsRepository->sumExpenses($start, $end, null, null, $currency);
- $spentAmount = $spent[$currency->id]['sum'] ?? '0';
+ $spent = $opsRepository->sumExpenses($start, $end, null, null, $currency);
+ $spentAmount = $spent[$currency->id]['sum'] ?? '0';
app('log')->debug(sprintf('Spent for default currency for all budgets in this period: %s', $spentAmount));
- $days = $today->between($start, $end) ? $today->diffInDays($start) + 1 : $end->diffInDays($start) + 1;
+ $days = $today->between($start, $end) ? $today->diffInDays($start) + 1 : $end->diffInDays($start) + 1;
app('log')->debug(sprintf('Number of days left: %d', $days));
- $spentPerDay = bcdiv($spentAmount, (string)$days);
+ $spentPerDay = bcdiv($spentAmount, (string)$days);
app('log')->debug(sprintf('Available to spend per day: %s', $spentPerDay));
if ($availableBudgets->count() > 0) {
$display = 0; // assume user overspent
@@ -132,7 +132,7 @@ class BoxController extends Controller
}
}
- $return = [
+ $return = [
'display' => $display,
'spent_total' => app('amount')->formatAnything($currency, $spentAmount, false),
'spent_per_day' => app('amount')->formatAnything($currency, $spentPerDay, false),
@@ -155,11 +155,11 @@ class BoxController extends Controller
{
// Cache result, return cache if present.
/** @var Carbon $start */
- $start = session('start', today(config('app.timezone'))->startOfMonth());
+ $start = session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
- $end = session('end', today(config('app.timezone'))->endOfMonth());
- $cache = new CacheProperties();
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('box-balance');
@@ -167,10 +167,10 @@ class BoxController extends Controller
return response()->json($cache->get());
}
// prep some arrays:
- $incomes = [];
- $expenses = [];
- $sums = [];
- $currency = app('amount')->getDefaultCurrency();
+ $incomes = [];
+ $expenses = [];
+ $sums = [];
+ $currency = app('amount')->getDefaultCurrency();
// collect income of user:
/** @var GroupCollectorInterface $collector */
@@ -178,7 +178,7 @@ class BoxController extends Controller
$collector->setRange($start, $end)
->setTypes([TransactionType::DEPOSIT])
;
- $set = $collector->getExtractedJournals();
+ $set = $collector->getExtractedJournals();
/** @var array $journal */
foreach ($set as $journal) {
@@ -196,7 +196,7 @@ class BoxController extends Controller
$collector->setRange($start, $end)
->setTypes([TransactionType::WITHDRAWAL])
;
- $set = $collector->getExtractedJournals();
+ $set = $collector->getExtractedJournals();
/** @var array $journal */
foreach ($set as $journal) {
@@ -208,7 +208,7 @@ class BoxController extends Controller
}
// format amounts:
- $keys = array_keys($sums);
+ $keys = array_keys($sums);
foreach ($keys as $currencyId) {
$currency = $repository->find($currencyId);
$sums[$currencyId] = app('amount')->formatAnything($currency, $sums[$currencyId], false);
@@ -222,7 +222,7 @@ class BoxController extends Controller
$expenses[$currency->id] = app('amount')->formatAnything($currency, '0', false);
}
- $response = [
+ $response = [
'incomes' => $incomes,
'expenses' => $expenses,
'sums' => $sums,
@@ -239,7 +239,7 @@ class BoxController extends Controller
*/
public function netWorth(): JsonResponse
{
- $date = today(config('app.timezone'))->endOfDay();
+ $date = today(config('app.timezone'))->endOfDay();
// start and end in the future? use $end
if ($this->notInSessionRange($date)) {
@@ -248,7 +248,7 @@ class BoxController extends Controller
}
/** @var NetWorthInterface $netWorthHelper */
- $netWorthHelper = app(NetWorthInterface::class);
+ $netWorthHelper = app(NetWorthInterface::class);
$netWorthHelper->setUser(auth()->user());
/** @var AccountRepositoryInterface $accountRepository */
@@ -259,7 +259,7 @@ class BoxController extends Controller
app('log')->debug(sprintf('Found %d accounts.', $allAccounts->count()));
// filter list on preference of being included.
- $filtered = $allAccounts->filter(
+ $filtered = $allAccounts->filter(
static function (Account $account) use ($accountRepository) {
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
@@ -271,15 +271,15 @@ class BoxController extends Controller
}
);
- $netWorthSet = $netWorthHelper->byAccounts($filtered, $date);
- $return = [];
+ $netWorthSet = $netWorthHelper->byAccounts($filtered, $date);
+ $return = [];
foreach ($netWorthSet as $key => $data) {
if ('native' === $key) {
continue;
}
$return[$data['currency_id']] = app('amount')->formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false);
}
- $return = [
+ $return = [
'net_worths' => array_values($return),
];
diff --git a/app/Http/Controllers/Json/FrontpageController.php b/app/Http/Controllers/Json/FrontpageController.php
index bd7d756bb5..372ee79425 100644
--- a/app/Http/Controllers/Json/FrontpageController.php
+++ b/app/Http/Controllers/Json/FrontpageController.php
@@ -49,12 +49,12 @@ class FrontpageController extends Controller
$amount = $repository->getCurrentAmount($piggyBank);
if (1 === bccomp($amount, '0')) {
// percentage!
- $pct = 0;
+ $pct = 0;
if (0 !== bccomp($piggyBank->targetamount, '0')) {
$pct = (int)bcmul(bcdiv($amount, $piggyBank->targetamount), '100');
}
- $entry = [
+ $entry = [
'id' => $piggyBank->id,
'name' => $piggyBank->name,
'amount' => $amount,
diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php
index 6ecfcb818c..741455cf9e 100644
--- a/app/Http/Controllers/Json/IntroController.php
+++ b/app/Http/Controllers/Json/IntroController.php
@@ -41,7 +41,7 @@ class IntroController extends Controller
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
app('log')->debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
- $specificPage ??= '';
+ $specificPage ??= '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (0 === count($specificSteps)) {
@@ -55,8 +55,8 @@ class IntroController extends Controller
// remove last step:
array_pop($steps);
// merge arrays and add last step again
- $steps = array_merge($steps, $specificSteps);
- $steps[] = $lastStep;
+ $steps = array_merge($steps, $specificSteps);
+ $steps[] = $lastStep;
}
if (!$this->hasOutroStep($route)) {
$steps = array_merge($steps, $specificSteps);
@@ -77,7 +77,7 @@ class IntroController extends Controller
return false;
}
- $hasStep = array_key_exists('outro', $elements);
+ $hasStep = array_key_exists('outro', $elements);
app('log')->debug('Elements is array', $elements);
app('log')->debug('Keys is', array_keys($elements));
@@ -94,8 +94,8 @@ class IntroController extends Controller
public function postEnable(string $route, string $specialPage = null): JsonResponse
{
$specialPage ??= '';
- $route = str_replace('.', '_', $route);
- $key = 'shown_demo_'.$route;
+ $route = str_replace('.', '_', $route);
+ $key = 'shown_demo_'.$route;
if ('' !== $specialPage) {
$key .= '_'.$specialPage;
}
@@ -114,7 +114,7 @@ class IntroController extends Controller
public function postFinished(string $route, string $specialPage = null): JsonResponse
{
$specialPage ??= '';
- $key = 'shown_demo_'.$route;
+ $key = 'shown_demo_'.$route;
if ('' !== $specialPage) {
$key .= '_'.$specialPage;
}
diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php
index 8b080391fc..51cbdb743e 100644
--- a/app/Http/Controllers/Json/ReconcileController.php
+++ b/app/Http/Controllers/Json/ReconcileController.php
@@ -92,13 +92,13 @@ class ReconcileController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setJournalIds($selectedIds);
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
}
// Collect all journals already reconciled
if (count($clearedIds) > 0) {
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setJournalIds($clearedIds);
$clearedJournals = $collector->getExtractedJournals();
}
@@ -118,11 +118,11 @@ class ReconcileController extends Controller
$clearedAmount = $this->processJournal($account, $accountCurrency, $journal, $clearedAmount);
}
}
- $difference = bcadd(bcadd(bcsub($startBalance, $endBalance), $clearedAmount), $amount);
- $diffCompare = bccomp($difference, '0');
- $countCleared = count($clearedJournals);
+ $difference = bcadd(bcadd(bcsub($startBalance, $endBalance), $clearedAmount), $amount);
+ $diffCompare = bccomp($difference, '0');
+ $countCleared = count($clearedJournals);
- $reconSum = bcadd(bcadd($startBalance, $amount), $clearedAmount);
+ $reconSum = bcadd(bcadd($startBalance, $amount), $clearedAmount);
try {
$view = view(
@@ -151,7 +151,7 @@ class ReconcileController extends Controller
throw new FireflyException($view, 0, $e);
}
- $return = [
+ $return = [
'post_url' => $route,
'html' => $view,
];
@@ -174,29 +174,29 @@ class ReconcileController extends Controller
if ($end->lt($start)) {
[$end, $start] = [$start, $end];
}
- $startDate = clone $start;
+ $startDate = clone $start;
$startDate->subDay();
- $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
- $startBalance = app('steam')->bcround(app('steam')->balance($account, $startDate), $currency->decimal_places);
- $endBalance = app('steam')->bcround(app('steam')->balance($account, $end), $currency->decimal_places);
+ $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
+ $startBalance = app('steam')->bcround(app('steam')->balance($account, $startDate), $currency->decimal_places);
+ $endBalance = app('steam')->bcround(app('steam')->balance($account, $end), $currency->decimal_places);
// get the transactions
$selectionStart = clone $start;
$selectionStart->subDays(3);
- $selectionEnd = clone $end;
+ $selectionEnd = clone $end;
$selectionEnd->addDays(3);
// grab transactions:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))
->setRange($selectionStart, $selectionEnd)
->withBudgetInformation()->withCategoryInformation()->withAccountInformation()
;
- $array = $collector->getExtractedJournals();
- $journals = $this->processTransactions($account, $array);
+ $array = $collector->getExtractedJournals();
+ $journals = $this->processTransactions($account, $array);
try {
$html = view(
@@ -216,7 +216,7 @@ class ReconcileController extends Controller
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
{
- $toAdd = '0';
+ $toAdd = '0';
app('log')->debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
// not much magic below we need to cover using tests.
@@ -254,7 +254,7 @@ class ReconcileController extends Controller
/** @var array $journal */
foreach ($array as $journal) {
- $inverse = false;
+ $inverse = false;
if (TransactionType::DEPOSIT === $journal['transaction_type_type']) {
$inverse = true;
diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.php
index aa6119f518..ba2f9bd7f8 100644
--- a/app/Http/Controllers/Json/RecurrenceController.php
+++ b/app/Http/Controllers/Json/RecurrenceController.php
@@ -66,20 +66,20 @@ class RecurrenceController extends Controller
*/
public function events(Request $request): JsonResponse
{
- $occurrences = [];
- $return = [];
- $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');
- $repetitionType = explode(',', $request->get('type'))[0];
- $repetitions = (int) $request->get('reps');
- $weekend = (int) $request->get('weekend');
- $repetitionMoment = '';
- $skip = (int) $request->get('skip');
- $skip = $skip < 1 || $skip > 31 ? 1 : $skip;
- $weekend = $weekend < 1 || $weekend > 4 ? 1 : $weekend;
+ $occurrences = [];
+ $return = [];
+ $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');
+ $repetitionType = explode(',', $request->get('type'))[0];
+ $repetitions = (int) $request->get('reps');
+ $weekend = (int) $request->get('weekend');
+ $repetitionMoment = '';
+ $skip = (int) $request->get('skip');
+ $skip = $skip < 1 || $skip > 31 ? 1 : $skip;
+ $weekend = $weekend < 1 || $weekend > 4 ? 1 : $weekend;
if (false === $start || false === $end || false === $firstDate || false === $endDate) {
return response()->json();
@@ -92,7 +92,7 @@ class RecurrenceController extends Controller
return response()->json();
}
// if $firstDate is beyond start, use that one:
- $actualStart = clone $firstDate;
+ $actualStart = clone $firstDate;
if ('weekly' === $repetitionType || 'monthly' === $repetitionType) {
$repetitionMoment = explode(',', $request->get('type'))[1] ?? '1';
@@ -147,8 +147,8 @@ class RecurrenceController extends Controller
*/
public function suggest(Request $request): JsonResponse
{
- $string = '' === (string) $request->get('date') ? date('Y-m-d') : (string) $request->get('date');
- $today = today(config('app.timezone'))->startOfDay();
+ $string = '' === (string) $request->get('date') ? date('Y-m-d') : (string) $request->get('date');
+ $today = today(config('app.timezone'))->startOfDay();
try {
$date = Carbon::createFromFormat('Y-m-d', $string, config('app.timezone'));
@@ -165,7 +165,7 @@ class RecurrenceController extends Controller
app('log')->debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
app('log')->debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true)));
- $result = [];
+ $result = [];
if ($date > $today || 'true' === (string) $request->get('past')) {
app('log')->debug('Will fill dropdown.');
$weekly = sprintf('weekly,%s', $date->dayOfWeekIso);
diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php
index e3d87ba255..18b422872b 100644
--- a/app/Http/Controllers/NewUserController.php
+++ b/app/Http/Controllers/NewUserController.php
@@ -69,8 +69,8 @@ class NewUserController extends Controller
app('view')->share('title', (string)trans('firefly.welcome'));
app('view')->share('mainTitleIcon', 'fa-fire');
- $types = config('firefly.accountTypesByIdentifier.asset');
- $count = $this->repository->count($types);
+ $types = config('firefly.accountTypesByIdentifier.asset');
+ $count = $this->repository->count($types);
$languages = [];
@@ -90,7 +90,7 @@ class NewUserController extends Controller
*/
public function submit(NewUserFormRequest $request, CurrencyRepositoryInterface $currencyRepository)
{
- $language = $request->convertString('language');
+ $language = $request->convertString('language');
if (!array_key_exists($language, config('firefly.languages'))) {
$language = 'en_US';
}
@@ -98,7 +98,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) {
@@ -114,7 +114,7 @@ class NewUserController extends Controller
$currencyRepository->makeDefault($currency);
// store frontpage preferences:
- $accounts = $this->repository->getAccountsByType([AccountType::ASSET])->pluck('id')->toArray();
+ $accounts = $this->repository->getAccountsByType([AccountType::ASSET])->pluck('id')->toArray();
app('preferences')->set('frontPageAccounts', $accounts);
// mark.
diff --git a/app/Http/Controllers/ObjectGroup/EditController.php b/app/Http/Controllers/ObjectGroup/EditController.php
index 17322740a5..e85ffac6a6 100644
--- a/app/Http/Controllers/ObjectGroup/EditController.php
+++ b/app/Http/Controllers/ObjectGroup/EditController.php
@@ -91,7 +91,7 @@ class EditController extends Controller
session()->flash('success', (string)trans('firefly.updated_object_group', ['title' => $objectGroup->title]));
app('preferences')->mark();
- $redirect = redirect($this->getPreviousUrl('object-groups.edit.url'));
+ $redirect = redirect($this->getPreviousUrl('object-groups.edit.url'));
if (1 === (int)$request->get('return_to_edit')) {
session()->put('object-groups.edit.fromUpdate', true);
diff --git a/app/Http/Controllers/PiggyBank/AmountController.php b/app/Http/Controllers/PiggyBank/AmountController.php
index 5fba6d7dbf..28085daa06 100644
--- a/app/Http/Controllers/PiggyBank/AmountController.php
+++ b/app/Http/Controllers/PiggyBank/AmountController.php
@@ -76,7 +76,7 @@ class AmountController extends Controller
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
$maxAmount = min($leftOnAccount, $leftToSave);
}
- $currency = $this->accountRepos->getAccountCurrency($piggyBank->account) ?? app('amount')->getDefaultCurrency();
+ $currency = $this->accountRepos->getAccountCurrency($piggyBank->account) ?? app('amount')->getDefaultCurrency();
return view('piggy-banks.add', compact('piggyBank', 'maxAmount', 'currency'));
}
@@ -98,7 +98,7 @@ class AmountController extends Controller
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
$maxAmount = min($leftOnAccount, $leftToSave);
}
- $currency = $this->accountRepos->getAccountCurrency($piggyBank->account) ?? app('amount')->getDefaultCurrency();
+ $currency = $this->accountRepos->getAccountCurrency($piggyBank->account) ?? app('amount')->getDefaultCurrency();
return view('piggy-banks.add-mobile', compact('piggyBank', 'maxAmount', 'currency'));
}
@@ -164,7 +164,7 @@ class AmountController extends Controller
return redirect(route('piggy-banks.index'));
}
- $amount = (string)$request->get('amount');
+ $amount = (string)$request->get('amount');
session()->flash(
'error',
diff --git a/app/Http/Controllers/PiggyBank/CreateController.php b/app/Http/Controllers/PiggyBank/CreateController.php
index 2551dffb4c..55d1a8acfe 100644
--- a/app/Http/Controllers/PiggyBank/CreateController.php
+++ b/app/Http/Controllers/PiggyBank/CreateController.php
@@ -91,7 +91,7 @@ class CreateController extends Controller
*/
public function store(PiggyBankStoreRequest $request)
{
- $data = $request->getPiggyBankData();
+ $data = $request->getPiggyBankData();
if (null === $data['startdate']) {
$data['startdate'] = today(config('app.timezone'));
}
@@ -102,7 +102,7 @@ class CreateController extends Controller
// store attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($piggyBank, $files);
}
@@ -114,7 +114,7 @@ class CreateController extends Controller
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
}
- $redirect = redirect($this->getPreviousUrl('piggy-banks.create.url'));
+ $redirect = redirect($this->getPreviousUrl('piggy-banks.create.url'));
if (1 === (int)$request->get('create_another')) {
session()->put('piggy-banks.create.fromStore', true);
diff --git a/app/Http/Controllers/PiggyBank/EditController.php b/app/Http/Controllers/PiggyBank/EditController.php
index 4d8667bf68..61e729d64c 100644
--- a/app/Http/Controllers/PiggyBank/EditController.php
+++ b/app/Http/Controllers/PiggyBank/EditController.php
@@ -77,14 +77,14 @@ class EditController extends Controller
$subTitleIcon = 'fa-pencil';
$note = $piggyBank->notes()->first();
// Flash some data to fill the form.
- $targetDate = $piggyBank->targetdate?->format('Y-m-d');
- $startDate = $piggyBank->startdate?->format('Y-m-d');
- $currency = $this->accountRepository->getAccountCurrency($piggyBank->account);
+ $targetDate = $piggyBank->targetdate?->format('Y-m-d');
+ $startDate = $piggyBank->startdate?->format('Y-m-d');
+ $currency = $this->accountRepository->getAccountCurrency($piggyBank->account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrency();
}
- $preFilled = [
+ $preFilled = [
'name' => $piggyBank->name,
'account_id' => $piggyBank->account_id,
'targetamount' => app('steam')->bcround($piggyBank->targetamount, $currency->decimal_places),
@@ -122,7 +122,7 @@ class EditController extends Controller
// store new attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($piggyBank, $files);
}
@@ -134,7 +134,7 @@ class EditController extends Controller
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
}
- $redirect = redirect($this->getPreviousUrl('piggy-banks.edit.url'));
+ $redirect = redirect($this->getPreviousUrl('piggy-banks.edit.url'));
if (1 === (int)$request->get('return_to_edit')) {
session()->put('piggy-banks.edit.fromUpdate', true);
diff --git a/app/Http/Controllers/PiggyBank/IndexController.php b/app/Http/Controllers/PiggyBank/IndexController.php
index a41660f1cf..8f909ab59f 100644
--- a/app/Http/Controllers/PiggyBank/IndexController.php
+++ b/app/Http/Controllers/PiggyBank/IndexController.php
@@ -79,21 +79,21 @@ class IndexController extends Controller
{
$this->cleanupObjectGroups();
$this->piggyRepos->resetOrder();
- $collection = $this->piggyRepos->getPiggyBanks();
- $accounts = [];
+ $collection = $this->piggyRepos->getPiggyBanks();
+ $accounts = [];
/** @var Carbon $end */
- $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
// transform piggies using the transformer:
- $parameters = new ParameterBag();
+ $parameters = new ParameterBag();
$parameters->set('end', $end);
// make piggy bank groups:
- $piggyBanks = [];
+ $piggyBanks = [];
/** @var PiggyBankTransformer $transformer */
- $transformer = app(PiggyBankTransformer::class);
+ $transformer = app(PiggyBankTransformer::class);
$transformer->setParameters(new ParameterBag());
/** @var AccountTransformer $accountTransformer */
@@ -102,8 +102,8 @@ class IndexController extends Controller
/** @var PiggyBank $piggy */
foreach ($collection as $piggy) {
- $array = $transformer->transform($piggy);
- $groupOrder = (int)$array['object_group_order'];
+ $array = $transformer->transform($piggy);
+ $groupOrder = (int)$array['object_group_order'];
// make group array if necessary:
$piggyBanks[$groupOrder] ??= [
'object_group_id' => $array['object_group_id'] ?? 0,
@@ -111,12 +111,12 @@ class IndexController extends Controller
'piggy_banks' => [],
];
- $account = $accountTransformer->transform($piggy->account);
- $accountId = (int)$account['id'];
- $array['attachments'] = $this->piggyRepos->getAttachments($piggy);
+ $account = $accountTransformer->transform($piggy->account);
+ $accountId = (int)$account['id'];
+ $array['attachments'] = $this->piggyRepos->getAttachments($piggy);
if (!array_key_exists($accountId, $accounts)) {
// create new:
- $accounts[$accountId] = $account;
+ $accounts[$accountId] = $account;
// add some interesting details:
$accounts[$accountId]['left'] = $accounts[$accountId]['current_balance'];
@@ -134,7 +134,7 @@ class IndexController extends Controller
$piggyBanks[$groupOrder]['piggy_banks'][] = $array;
}
// do a bunch of summaries.
- $piggyBanks = $this->makeSums($piggyBanks);
+ $piggyBanks = $this->makeSums($piggyBanks);
ksort($piggyBanks);
@@ -165,7 +165,7 @@ class IndexController extends Controller
foreach ($piggyBanks as $groupOrder => $group) {
$groupId = $group['object_group_id'];
foreach ($group['piggy_banks'] as $piggy) {
- $currencyId = $piggy['currency_id'];
+ $currencyId = $piggy['currency_id'];
$sums[$groupId][$currencyId] ??= [
'target' => '0',
'saved' => '0',
diff --git a/app/Http/Controllers/PiggyBank/ShowController.php b/app/Http/Controllers/PiggyBank/ShowController.php
index 10da91919f..2fd69286ae 100644
--- a/app/Http/Controllers/PiggyBank/ShowController.php
+++ b/app/Http/Controllers/PiggyBank/ShowController.php
@@ -70,9 +70,9 @@ class ShowController extends Controller
public function show(PiggyBank $piggyBank)
{
/** @var Carbon $end */
- $end = session('end', today(config('app.timezone'))->endOfMonth());
+ $end = session('end', today(config('app.timezone'))->endOfMonth());
// transform piggies using the transformer:
- $parameters = new ParameterBag();
+ $parameters = new ParameterBag();
$parameters->set('end', $end);
/** @var PiggyBankTransformer $transformer */
diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.php
index c321bcb806..1d4ae33507 100644
--- a/app/Http/Controllers/Popup/ReportController.php
+++ b/app/Http/Controllers/Popup/ReportController.php
@@ -49,7 +49,7 @@ class ReportController extends Controller
app('view')->share('start', $attributes['startDate']);
app('view')->share('end', $attributes['endDate']);
- $html = match ($attributes['location']) {
+ $html = match ($attributes['location']) {
default => sprintf('Firefly III cannot handle "%s"-popups.', $attributes['location']),
'budget-spent-amount' => $this->budgetSpentAmount($attributes),
'expense-entry' => $this->expenseEntry($attributes),
diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php
index 6bff371140..f0a587a190 100644
--- a/app/Http/Controllers/PreferencesController.php
+++ b/app/Http/Controllers/PreferencesController.php
@@ -66,14 +66,14 @@ class PreferencesController extends Controller
*/
public function index(AccountRepositoryInterface $repository)
{
- $accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]);
- $isDocker = env('IS_DOCKER', false);
- $groupedAccounts = [];
+ $accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]);
+ $isDocker = env('IS_DOCKER', false);
+ $groupedAccounts = [];
/** @var Account $account */
foreach ($accounts as $account) {
- $type = $account->accountType->type;
- $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role'));
+ $type = $account->accountType->type;
+ $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role'));
if (in_array($type, [AccountType::MORTGAGE, AccountType::DEBT, AccountType::LOAN], true)) {
$role = sprintf('opt_group_l_%s', $type);
@@ -94,23 +94,23 @@ class PreferencesController extends Controller
if (!is_array($frontPageAccounts)) {
$frontPageAccounts = $accountIds;
}
- $language = app('steam')->getLanguage();
- $languages = config('firefly.languages');
- $locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data;
- $listPageSize = app('preferences')->get('listPageSize', 50)->data;
- $darkMode = app('preferences')->get('darkMode', 'browser')->data;
- $slackUrl = app('preferences')->get('slack_webhook_url', '')->data;
- $customFiscalYear = app('preferences')->get('customFiscalYear', 0)->data;
- $fiscalYearStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data;
+ $language = app('steam')->getLanguage();
+ $languages = config('firefly.languages');
+ $locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data;
+ $listPageSize = app('preferences')->get('listPageSize', 50)->data;
+ $darkMode = app('preferences')->get('darkMode', 'browser')->data;
+ $slackUrl = app('preferences')->get('slack_webhook_url', '')->data;
+ $customFiscalYear = app('preferences')->get('customFiscalYear', 0)->data;
+ $fiscalYearStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data;
if (is_array($fiscalYearStartStr)) {
$fiscalYearStartStr = '01-01';
}
- $fiscalYearStart = sprintf('%s-%s', date('Y'), (string) $fiscalYearStartStr);
- $tjOptionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
- $availableDarkModes = config('firefly.available_dark_modes');
+ $fiscalYearStart = sprintf('%s-%s', date('Y'), (string) $fiscalYearStartStr);
+ $tjOptionalFields = app('preferences')->get('transaction_journal_optional_fields', [])->data;
+ $availableDarkModes = config('firefly.available_dark_modes');
// notification preferences (single value for each):
- $notifications = [];
+ $notifications = [];
foreach (config('firefly.available_notifications') as $notification) {
$notifications[$notification] = app('preferences')->get(sprintf('notification_%s', $notification), true)->data;
}
@@ -125,7 +125,7 @@ class PreferencesController extends Controller
app('log')->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 (0 === count($frontPageAccounts)) {
@@ -164,7 +164,7 @@ class PreferencesController extends Controller
}
// extract notifications:
- $all = $request->all();
+ $all = $request->all();
foreach (config('firefly.available_notifications') as $option) {
$key = sprintf('notification_%s', $option);
if (array_key_exists($key, $all)) {
@@ -194,8 +194,8 @@ class PreferencesController extends Controller
}
// 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);
@@ -204,15 +204,15 @@ 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);
}
// language:
/** @var Preference $currentLang */
- $currentLang = app('preferences')->get('language', 'en_US');
- $lang = $request->get('language');
+ $currentLang = app('preferences')->get('language', 'en_US');
+ $lang = $request->get('language');
if (array_key_exists($lang, config('firefly.languages'))) {
app('preferences')->set('language', $lang);
}
@@ -229,8 +229,8 @@ class PreferencesController extends Controller
}
// optional fields for transactions:
- $setOptions = $request->get('tj') ?? [];
- $optionalTj = [
+ $setOptions = $request->get('tj') ?? [];
+ $optionalTj = [
'interest_date' => array_key_exists('interest_date', $setOptions),
'book_date' => array_key_exists('book_date', $setOptions),
'process_date' => array_key_exists('process_date', $setOptions),
@@ -247,7 +247,7 @@ class PreferencesController extends Controller
app('preferences')->set('transaction_journal_optional_fields', $optionalTj);
// dark mode
- $darkMode = $request->get('darkMode') ?? 'browser';
+ $darkMode = $request->get('darkMode') ?? 'browser';
if (in_array($darkMode, config('firefly.available_dark_modes'), true)) {
app('preferences')->set('darkMode', $darkMode);
}
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 6d1ff813c2..6301ceb1de 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -119,7 +119,7 @@ class ProfileController extends Controller
}
// generate recovery codes if not in session:
- $recoveryCodes = '';
+ $recoveryCodes = '';
if (null === $codesPreference) {
// generate codes + store + flash:
@@ -136,9 +136,9 @@ class ProfileController extends Controller
$recoveryCodes = [];
}
- $codes = implode("\r\n", $recoveryCodes);
+ $codes = implode("\r\n", $recoveryCodes);
- $image = \Google2FA::getQRCodeInline($domain, auth()->user()->email, (string)$secret);
+ $image = \Google2FA::getQRCodeInline($domain, auth()->user()->email, (string)$secret);
return view('profile.code', compact('image', 'secret', 'codes'));
}
@@ -209,7 +209,7 @@ class ProfileController extends Controller
$repository = app(UserRepositoryInterface::class);
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
app('preferences')->delete('temp-mfa-secret');
app('preferences')->delete('temp-mfa-codes');
@@ -276,7 +276,7 @@ class ProfileController extends Controller
$repository->createPersonalAccessClient(null, config('app.name').' Personal Access Client', 'http://localhost');
}
- $accessToken = app('preferences')->get('access_token');
+ $accessToken = app('preferences')->get('access_token');
if (null === $accessToken) {
$token = $user->generateAccessToken();
$accessToken = app('preferences')->set('access_token', $token);
@@ -407,7 +407,7 @@ class ProfileController extends Controller
$new = $request->get('new_password');
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
try {
$this->validatePassword($user, $current, $new);
@@ -459,7 +459,7 @@ class ProfileController extends Controller
}
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
@@ -480,7 +480,7 @@ class ProfileController extends Controller
app('preferences')->mark();
// also save the code so replay attack is prevented.
- $mfaCode = $request->get('code');
+ $mfaCode = $request->get('code');
$this->addToMFAHistory($mfaCode);
// save backup codes in preferences:
@@ -592,8 +592,8 @@ class ProfileController extends Controller
}
// find preference with this token value.
- $set = app('preferences')->findByName('email_change_undo_token');
- $user = null;
+ $set = app('preferences')->findByName('email_change_undo_token');
+ $user = null;
/** @var Preference $preference */
foreach ($set as $preference) {
@@ -606,7 +606,7 @@ class ProfileController extends Controller
}
// found user.which email address to return to?
- $set = app('preferences')->beginsWith($user, 'previous_email_');
+ $set = app('preferences')->beginsWith($user, 'previous_email_');
/** @var string $match */
$match = null;
diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php
index 779beada4f..759669936c 100644
--- a/app/Http/Controllers/Recurring/CreateController.php
+++ b/app/Http/Controllers/Recurring/CreateController.php
@@ -93,19 +93,19 @@ class CreateController extends Controller
$this->rememberPreviousUrl('recurring.create.url');
}
$request->session()->forget('recurring.create.fromStore');
- $repetitionEnds = [
+ $repetitionEnds = [
'forever' => (string)trans('firefly.repeat_forever'),
'until_date' => (string)trans('firefly.repeat_until_date'),
'times' => (string)trans('firefly.repeat_times'),
];
- $weekendResponses = [
+ $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'),
];
- $hasOldInput = null !== $request->old('_token'); // flash some data
- $preFilled = [
+ $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,
@@ -138,12 +138,12 @@ class CreateController extends Controller
$this->rememberPreviousUrl('recurring.create.url');
}
$request->session()->forget('recurring.create.fromStore');
- $repetitionEnds = [
+ $repetitionEnds = [
'forever' => (string)trans('firefly.repeat_forever'),
'until_date' => (string)trans('firefly.repeat_until_date'),
'times' => (string)trans('firefly.repeat_times'),
];
- $weekendResponses = [
+ $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'),
@@ -151,18 +151,18 @@ class CreateController extends Controller
];
// fill prefilled with journal info
- $type = strtolower($journal->transactionType->type);
+ $type = strtolower($journal->transactionType->type);
/** @var Transaction $source */
- $source = $journal->transactions()->where('amount', '<', 0)->first();
+ $source = $journal->transactions()->where('amount', '<', 0)->first();
/** @var Transaction $dest */
- $dest = $journal->transactions()->where('amount', '>', 0)->first();
- $category = null !== $journal->categories()->first() ? $journal->categories()->first()->name : '';
- $budget = null !== $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
- $bill = null !== $journal->bill ? $journal->bill->id : 0;
- $hasOldInput = null !== $request->old('_token'); // flash some data
- $preFilled = [];
+ $dest = $journal->transactions()->where('amount', '>', 0)->first();
+ $category = null !== $journal->categories()->first() ? $journal->categories()->first()->name : '';
+ $budget = null !== $journal->budgets()->first() ? $journal->budgets()->first()->id : 0;
+ $bill = null !== $journal->bill ? $journal->bill->id : 0;
+ $hasOldInput = null !== $request->old('_token'); // flash some data
+ $preFilled = [];
if (true === $hasOldInput) {
$preFilled = [
'title' => $request->old('title'),
@@ -222,7 +222,7 @@ class CreateController extends Controller
*/
public function store(RecurrenceFormRequest $request)
{
- $data = $request->getAll();
+ $data = $request->getAll();
try {
$recurrence = $this->recurring->store($data);
@@ -237,7 +237,7 @@ class CreateController extends Controller
// store attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($recurrence, $files);
}
diff --git a/app/Http/Controllers/Recurring/DeleteController.php b/app/Http/Controllers/Recurring/DeleteController.php
index 638c8eaae9..e1495e0995 100644
--- a/app/Http/Controllers/Recurring/DeleteController.php
+++ b/app/Http/Controllers/Recurring/DeleteController.php
@@ -67,7 +67,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->rememberPreviousUrl('recurrences.delete.url');
diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php
index 44d9e66ea2..676d8f206b 100644
--- a/app/Http/Controllers/Recurring/EditController.php
+++ b/app/Http/Controllers/Recurring/EditController.php
@@ -85,22 +85,22 @@ class EditController extends Controller
public function edit(Request $request, Recurrence $recurrence)
{
// TODO this should be in the repository.
- $count = $recurrence->recurrenceTransactions()->count();
+ $count = $recurrence->recurrenceTransactions()->count();
if (0 === $count) {
throw new FireflyException('This recurring transaction has no meta-data. You will have to delete it and recreate it. Sorry!');
}
/** @var RecurrenceTransformer $transformer */
- $transformer = app(RecurrenceTransformer::class);
+ $transformer = app(RecurrenceTransformer::class);
$transformer->setParameters(new ParameterBag());
- $array = $transformer->transform($recurrence);
- $budgets = app('expandedform')->makeSelectListWithEmpty($this->budgetRepos->getActiveBudgets());
- $bills = app('expandedform')->makeSelectListWithEmpty($this->billRepository->getActiveBills());
+ $array = $transformer->transform($recurrence);
+ $budgets = app('expandedform')->makeSelectListWithEmpty($this->budgetRepos->getActiveBudgets());
+ $bills = app('expandedform')->makeSelectListWithEmpty($this->billRepository->getActiveBills());
/** @var RecurrenceRepetition $repetition */
- $repetition = $recurrence->recurrenceRepetitions()->first();
- $currentRepType = $repetition->repetition_type;
+ $repetition = $recurrence->recurrenceRepetitions()->first();
+ $currentRepType = $repetition->repetition_type;
if ('' !== $repetition->repetition_moment) {
$currentRepType .= ','.$repetition->repetition_moment;
}
@@ -111,8 +111,8 @@ class EditController extends Controller
}
$request->session()->forget('recurrences.edit.fromUpdate');
- $repetitionEnd = 'forever';
- $repetitionEnds = [
+ $repetitionEnd = 'forever';
+ $repetitionEnds = [
'forever' => (string)trans('firefly.repeat_forever'),
'until_date' => (string)trans('firefly.repeat_until_date'),
'times' => (string)trans('firefly.repeat_times'),
@@ -124,7 +124,7 @@ class EditController extends Controller
$repetitionEnd = 'times';
}
- $weekendResponses = [
+ $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'),
@@ -168,14 +168,14 @@ class EditController extends Controller
*/
public function update(RecurrenceFormRequest $request, Recurrence $recurrence)
{
- $data = $request->getAll();
+ $data = $request->getAll();
$this->recurring->update($recurrence, $data);
$request->session()->flash('success', (string)trans('firefly.updated_recurrence', ['title' => $recurrence->title]));
// store new attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachments->saveAttachmentsForModel($recurrence, $files);
}
diff --git a/app/Http/Controllers/Recurring/IndexController.php b/app/Http/Controllers/Recurring/IndexController.php
index 4a5237af4c..ed2e3775ba 100644
--- a/app/Http/Controllers/Recurring/IndexController.php
+++ b/app/Http/Controllers/Recurring/IndexController.php
@@ -75,11 +75,11 @@ 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;
- $collection = $this->recurringRepos->get();
- $today = today(config('app.timezone'));
- $year = today(config('app.timezone'));
+ $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'));
// split collection
$total = $collection->count();
@@ -89,7 +89,7 @@ class IndexController extends Controller
$transformer = app(RecurrenceTransformer::class);
$transformer->setParameters(new ParameterBag());
- $recurring = [];
+ $recurring = [];
/** @var Recurrence $recurrence */
foreach ($recurrences as $recurrence) {
@@ -104,7 +104,7 @@ class IndexController extends Controller
$array['repeat_until'] = null === $array['repeat_until'] ? null : new Carbon($array['repeat_until']);
$array['latest_date'] = null === $array['latest_date'] ? null : new Carbon($array['latest_date']);
// lazy but OK
- $array['attachments'] = $recurrence->attachments()->count();
+ $array['attachments'] = $recurrence->attachments()->count();
// make carbon objects out of occurrences
foreach ($array['repetitions'] as $repIndex => $repetition) {
@@ -113,11 +113,11 @@ class IndexController extends Controller
}
}
- $recurring[] = $array;
+ $recurring[] = $array;
}
- $paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);
+ $paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);
$paginator->setPath(route('recurring.index'));
- $today = today(config('app.timezone'));
+ $today = today(config('app.timezone'));
$this->verifyRecurringCronJob();
diff --git a/app/Http/Controllers/Recurring/ShowController.php b/app/Http/Controllers/Recurring/ShowController.php
index 406e819e6d..09863759f1 100644
--- a/app/Http/Controllers/Recurring/ShowController.php
+++ b/app/Http/Controllers/Recurring/ShowController.php
@@ -77,10 +77,10 @@ class ShowController extends Controller
*/
public function show(Recurrence $recurrence)
{
- $repos = app(AttachmentRepositoryInterface::class);
+ $repos = app(AttachmentRepositoryInterface::class);
/** @var RecurrenceTransformer $transformer */
- $transformer = app(RecurrenceTransformer::class);
+ $transformer = app(RecurrenceTransformer::class);
$transformer->setParameters(new ParameterBag());
$array = $transformer->transform($recurrence);
@@ -113,7 +113,7 @@ class ShowController extends Controller
$array['attachments'][] = $item;
}
- $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/Recurring/TriggerController.php b/app/Http/Controllers/Recurring/TriggerController.php
index 714a101a11..77d5357274 100644
--- a/app/Http/Controllers/Recurring/TriggerController.php
+++ b/app/Http/Controllers/Recurring/TriggerController.php
@@ -40,24 +40,24 @@ class TriggerController extends Controller
{
public function trigger(Recurrence $recurrence, TriggerRecurrenceRequest $request): RedirectResponse
{
- $all = $request->getAll();
- $date = $all['date'];
+ $all = $request->getAll();
+ $date = $all['date'];
// grab the date from the last time the recurrence fired:
- $backupDate = $recurrence->latest_date;
+ $backupDate = $recurrence->latest_date;
// fire the recurring cron job on the given date, then post-date the created transaction.
app('log')->info(sprintf('Trigger: will now fire recurring cron job task for date "%s".', $date->format('Y-m-d H:i:s')));
/** @var CreateRecurringTransactions $job */
- $job = app(CreateRecurringTransactions::class);
+ $job = app(CreateRecurringTransactions::class);
$job->setRecurrences(new Collection([$recurrence]));
$job->setDate($date);
$job->setForce(false);
$job->handle();
app('log')->debug('Done with recurrence.');
- $groups = $job->getGroups();
+ $groups = $job->getGroups();
/** @var TransactionGroup $group */
foreach ($groups as $group) {
diff --git a/app/Http/Controllers/Report/AccountController.php b/app/Http/Controllers/Report/AccountController.php
index 444a943c9f..d99ec61237 100644
--- a/app/Http/Controllers/Report/AccountController.php
+++ b/app/Http/Controllers/Report/AccountController.php
@@ -43,7 +43,7 @@ class AccountController extends Controller
public function general(Collection $accounts, Carbon $start, Carbon $end): string
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('account-report');
diff --git a/app/Http/Controllers/Report/BalanceController.php b/app/Http/Controllers/Report/BalanceController.php
index a6943a76ad..1810a47d48 100644
--- a/app/Http/Controllers/Report/BalanceController.php
+++ b/app/Http/Controllers/Report/BalanceController.php
@@ -66,7 +66,7 @@ class BalanceController extends Controller
*/
public function general(Collection $accounts, Carbon $start, Carbon $end)
{
- $report = [
+ $report = [
'budgets' => [],
'accounts' => [],
];
@@ -85,26 +85,26 @@ class BalanceController extends Controller
/** @var Budget $budget */
foreach ($budgets as $budget) {
- $budgetId = $budget->id;
- $report['budgets'][$budgetId] = [
+ $budgetId = $budget->id;
+ $report['budgets'][$budgetId] = [
'budget_id' => $budgetId,
'budget_name' => $budget->name,
'spent' => [], // per account
'sums' => [], // per currency
];
- $spent = [];
+ $spent = [];
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
- $journals = $collector->setRange($start, $end)->setSourceAccounts($accounts)->setTypes([TransactionType::WITHDRAWAL])->setBudget($budget)
+ $collector = app(GroupCollectorInterface::class);
+ $journals = $collector->setRange($start, $end)->setSourceAccounts($accounts)->setTypes([TransactionType::WITHDRAWAL])->setBudget($budget)
->getExtractedJournals()
;
/** @var array $journal */
foreach ($journals as $journal) {
- $sourceAccount = $journal['source_account_id'];
- $currencyId = $journal['currency_id'];
- $spent[$sourceAccount] ??= [
+ $sourceAccount = $journal['source_account_id'];
+ $currencyId = $journal['currency_id'];
+ $spent[$sourceAccount] ??= [
'source_account_id' => $sourceAccount,
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],
@@ -113,10 +113,10 @@ class BalanceController extends Controller
'currency_decimal_places' => $journal['currency_decimal_places'],
'spent' => '0',
];
- $spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']);
+ $spent[$sourceAccount]['spent'] = bcadd($spent[$sourceAccount]['spent'], $journal['amount']);
// also fix sum:
- $report['sums'][$budgetId][$currencyId] ??= [
+ $report['sums'][$budgetId][$currencyId] ??= [
'sum' => '0',
'currency_id' => $journal['currency_id'],
'currency_code' => $journal['currency_code'],
@@ -124,8 +124,8 @@ class BalanceController extends Controller
'currency_symbol' => $journal['currency_symbol'],
'currency_decimal_places' => $journal['currency_decimal_places'],
];
- $report['sums'][$budgetId][$currencyId]['sum'] = bcadd($report['sums'][$budgetId][$currencyId]['sum'], $journal['amount']);
- $report['accounts'][$sourceAccount]['sum'] = bcadd($report['accounts'][$sourceAccount]['sum'], $journal['amount']);
+ $report['sums'][$budgetId][$currencyId]['sum'] = bcadd($report['sums'][$budgetId][$currencyId]['sum'], $journal['amount']);
+ $report['accounts'][$sourceAccount]['sum'] = bcadd($report['accounts'][$sourceAccount]['sum'], $journal['amount']);
// add currency info for account sum
$report['accounts'][$sourceAccount]['currency_id'] = $journal['currency_id'];
diff --git a/app/Http/Controllers/Report/BillController.php b/app/Http/Controllers/Report/BillController.php
index d758f0369f..66c910b904 100644
--- a/app/Http/Controllers/Report/BillController.php
+++ b/app/Http/Controllers/Report/BillController.php
@@ -42,7 +42,7 @@ class BillController extends Controller
*/
public function overview(Collection $accounts, Carbon $start, Carbon $end) // chart properties for cache:
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('bill-report');
diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.php
index 25dd72f4ef..9e95e2ba43 100644
--- a/app/Http/Controllers/Report/BudgetController.php
+++ b/app/Http/Controllers/Report/BudgetController.php
@@ -79,7 +79,7 @@ class BudgetController extends Controller
$generator->setEnd($end);
$generator->accountPerBudget();
- $report = $generator->getReport();
+ $report = $generator->getReport();
return view('reports.budget.partials.account-per-budget', compact('report', 'budgets'));
}
@@ -95,7 +95,7 @@ class BudgetController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
- $accountId = $account->id;
+ $accountId = $account->id;
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
@@ -106,7 +106,7 @@ class BudgetController extends Controller
// loop expenses.
foreach ($spent as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -117,7 +117,7 @@ class BudgetController extends Controller
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -143,14 +143,14 @@ class BudgetController extends Controller
*/
public function avgExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);
- $result = [];
+ $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
- $destinationId = $journal['destination_account_id'];
- $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $destinationId = $journal['destination_account_id'];
+ $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -198,7 +198,7 @@ class BudgetController extends Controller
/** @var Budget $budget */
foreach ($budgets as $budget) {
- $budgetId = $budget->id;
+ $budgetId = $budget->id;
$report[$budgetId] ??= [
'name' => $budget->name,
'id' => $budget->id,
@@ -206,7 +206,7 @@ class BudgetController extends Controller
];
}
foreach ($spent as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -221,7 +221,7 @@ class BudgetController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$budgetId]['currencies'][$currencyId] ??= [
+ $report[$budgetId]['currencies'][$currencyId] ??= [
'sum' => '0',
'sum_pct' => '0',
'currency_id' => $currency['currency_id'],
@@ -238,9 +238,9 @@ class BudgetController extends Controller
// loop again to get percentages.
foreach ($report as $budgetId => $data) {
foreach ($data['currencies'] as $currencyId => $dataX) {
- $sum = $dataX['sum'];
- $total = $sums[$currencyId]['sum'] ?? '0';
- $pct = '0';
+ $sum = $dataX['sum'];
+ $total = $sums[$currencyId]['sum'] ?? '0';
+ $pct = '0';
if (0 !== bccomp($sum, '0') && 0 !== bccomp($total, '9')) {
$pct = round((float)bcmul(bcdiv($sum, $total), '100')); // intentional float
}
@@ -269,7 +269,7 @@ class BudgetController extends Controller
$generator->setEnd($end);
$generator->general();
- $report = $generator->getReport();
+ $report = $generator->getReport();
return view('reports.partials.budgets', compact('report'))->render();
}
@@ -283,7 +283,7 @@ class BudgetController extends Controller
*/
public function period(Collection $accounts, Carbon $start, Carbon $end)
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('budget-period-report');
@@ -295,9 +295,9 @@ class BudgetController extends Controller
$periods = app('navigation')->listOfPeriods($start, $end);
$keyFormat = app('navigation')->preferredCarbonFormat($start, $end);
// list expenses for budgets in account(s)
- $expenses = $this->opsRepository->listExpenses($start, $end, $accounts);
+ $expenses = $this->opsRepository->listExpenses($start, $end, $accounts);
- $report = [];
+ $report = [];
foreach ($expenses as $currency) {
foreach ($currency['budgets'] as $budget) {
$count = 0;
@@ -346,8 +346,8 @@ class BudgetController extends Controller
*/
public function topExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);
- $result = [];
+ $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) {
diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php
index f1e2db294d..907525f85f 100644
--- a/app/Http/Controllers/Report/CategoryController.php
+++ b/app/Http/Controllers/Report/CategoryController.php
@@ -74,7 +74,7 @@ class CategoryController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
- $accountId = $account->id;
+ $accountId = $account->id;
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
@@ -90,8 +90,8 @@ class CategoryController extends Controller
/** @var array $category */
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
- $sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $sourceAccountId = $journal['source_account_id'];
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -167,7 +167,7 @@ class CategoryController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
- $accountId = $account->id;
+ $accountId = $account->id;
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
@@ -178,7 +178,7 @@ class CategoryController extends Controller
// loop expenses.
foreach ($spent as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -191,7 +191,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -216,7 +216,7 @@ class CategoryController extends Controller
// loop income.
foreach ($earned as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -229,7 +229,7 @@ class CategoryController extends Controller
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
- $report[$destinationAccountId]['currencies'][$currencyId] ??= [
+ $report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -262,14 +262,14 @@ class CategoryController extends Controller
*/
public function avgExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);
- $result = [];
+ $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
- $destinationId = $journal['destination_account_id'];
- $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $destinationId = $journal['destination_account_id'];
+ $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -312,13 +312,13 @@ class CategoryController extends Controller
*/
public function avgIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);
- $result = [];
+ $spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
- $sourceId = $journal['source_account_id'];
- $key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
+ $sourceId = $journal['source_account_id'];
+ $key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
@@ -369,7 +369,7 @@ class CategoryController extends Controller
/** @var Category $category */
foreach ($categories as $category) {
- $categoryId = $category->id;
+ $categoryId = $category->id;
$report[$categoryId] ??= [
'name' => $category->name,
'id' => $category->id,
@@ -377,7 +377,7 @@ class CategoryController extends Controller
];
}
foreach ($spent as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -394,7 +394,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$categoryId]['currencies'][$currencyId] ??= [
+ $report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -412,14 +412,14 @@ class CategoryController extends Controller
$journal['amount']
);
- $sums[$currencyId]['spent_sum'] = bcadd($sums[$currencyId]['spent_sum'], $journal['amount']);
- $sums[$currencyId]['total_sum'] = bcadd($sums[$currencyId]['total_sum'], $journal['amount']);
+ $sums[$currencyId]['spent_sum'] = bcadd($sums[$currencyId]['spent_sum'], $journal['amount']);
+ $sums[$currencyId]['total_sum'] = bcadd($sums[$currencyId]['total_sum'], $journal['amount']);
}
}
}
foreach ($earned as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -436,7 +436,7 @@ class CategoryController extends Controller
foreach ($category['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$categoryId]['currencies'][$currencyId] ??= [
+ $report[$categoryId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -454,8 +454,8 @@ class CategoryController extends Controller
$journal['amount']
);
- $sums[$currencyId]['earned_sum'] = bcadd($sums[$currencyId]['earned_sum'], $journal['amount']);
- $sums[$currencyId]['total_sum'] = bcadd($sums[$currencyId]['total_sum'], $journal['amount']);
+ $sums[$currencyId]['earned_sum'] = bcadd($sums[$currencyId]['earned_sum'], $journal['amount']);
+ $sums[$currencyId]['total_sum'] = bcadd($sums[$currencyId]['total_sum'], $journal['amount']);
}
}
}
@@ -472,7 +472,7 @@ class CategoryController extends Controller
*/
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('category-period-expenses-report');
@@ -483,7 +483,7 @@ class CategoryController extends Controller
// depending on the carbon format (a reliable way to determine the general date difference)
// change the "listOfPeriods" call so the entire period gets included correctly.
- $format = app('navigation')->preferredCarbonFormat($start, $end);
+ $format = app('navigation')->preferredCarbonFormat($start, $end);
if ('Y' === $format) {
$start->startOfYear();
@@ -499,7 +499,7 @@ class CategoryController extends Controller
foreach ([$with, $without] as $set) {
foreach ($set as $currencyId => $currencyRow) {
foreach ($currencyRow['categories'] as $categoryId => $categoryRow) {
- $key = sprintf('%d-%d', $currencyId, $categoryId);
+ $key = sprintf('%d-%d', $currencyId, $categoryId);
$data[$key] ??= [
'id' => $categoryRow['id'],
'title' => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']),
@@ -523,7 +523,7 @@ class CategoryController extends Controller
$cache->store($data);
- $report = $data;
+ $report = $data;
try {
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
@@ -546,7 +546,7 @@ class CategoryController extends Controller
*/
public function income(Collection $accounts, Carbon $start, Carbon $end): string
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('category-period-income-report');
@@ -557,7 +557,7 @@ class CategoryController extends Controller
// depending on the carbon format (a reliable way to determine the general date difference)
// change the "listOfPeriods" call so the entire period gets included correctly.
- $format = app('navigation')->preferredCarbonFormat($start, $end);
+ $format = app('navigation')->preferredCarbonFormat($start, $end);
if ('Y' === $format) {
$start->startOfYear();
@@ -573,7 +573,7 @@ class CategoryController extends Controller
foreach ([$with, $without] as $set) {
foreach ($set as $currencyId => $currencyRow) {
foreach ($currencyRow['categories'] as $categoryId => $categoryRow) {
- $key = sprintf('%d-%d', $currencyId, $categoryId);
+ $key = sprintf('%d-%d', $currencyId, $categoryId);
$data[$key] ??= [
'id' => $categoryRow['id'],
'title' => sprintf('%s (%s)', $categoryRow['name'], $currencyRow['currency_name']),
@@ -595,7 +595,7 @@ class CategoryController extends Controller
}
}
- $report = $data;
+ $report = $data;
try {
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
@@ -619,7 +619,7 @@ class CategoryController extends Controller
public function operations(Collection $accounts, Carbon $start, Carbon $end): string
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('category-report');
@@ -634,7 +634,7 @@ class CategoryController extends Controller
$generator->setStart($start);
$generator->setEnd($end);
$generator->operations();
- $report = $generator->getReport();
+ $report = $generator->getReport();
try {
$result = view('reports.partials.categories', compact('report'))->render();
@@ -656,8 +656,8 @@ class CategoryController extends Controller
*/
public function topExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);
- $result = [];
+ $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $categories);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
@@ -704,8 +704,8 @@ class CategoryController extends Controller
*/
public function topIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);
- $result = [];
+ $spent = $this->opsRepository->listIncome($start, $end, $accounts, $categories);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['categories'] as $category) {
foreach ($category['transaction_journals'] as $journal) {
diff --git a/app/Http/Controllers/Report/DoubleController.php b/app/Http/Controllers/Report/DoubleController.php
index f5799e95c9..ce00226bbe 100644
--- a/app/Http/Controllers/Report/DoubleController.php
+++ b/app/Http/Controllers/Report/DoubleController.php
@@ -75,8 +75,8 @@ class DoubleController extends Controller
$result = [];
foreach ($spent as $currency) {
foreach ($currency['transaction_journals'] as $journal) {
- $sourceId = $journal['source_account_id'];
- $key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
+ $sourceId = $journal['source_account_id'];
+ $key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
@@ -97,7 +97,7 @@ class DoubleController extends Controller
}
// sort by amount_float
// sort temp array by amount.
- $amounts = array_column($result, 'avg_float');
+ $amounts = array_column($result, 'avg_float');
array_multisort($amounts, SORT_ASC, $result);
try {
@@ -125,9 +125,9 @@ class DoubleController extends Controller
$result = [];
foreach ($spent as $currency) {
foreach ($currency['transaction_journals'] as $journal) {
- $destinationId = $journal['destination_account_id'];
- $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $destinationId = $journal['destination_account_id'];
+ $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -147,7 +147,7 @@ class DoubleController extends Controller
}
// sort by amount_float
// sort temp array by amount.
- $amounts = array_column($result, 'avg_float');
+ $amounts = array_column($result, 'avg_float');
array_multisort($amounts, SORT_DESC, $result);
try {
@@ -174,8 +174,8 @@ class DoubleController extends Controller
$report = [];
$sums = [];
// see what happens when we collect transactions.
- $spent = $this->opsRepository->listExpenses($start, $end, $together);
- $earned = $this->opsRepository->listIncome($start, $end, $together);
+ $spent = $this->opsRepository->listExpenses($start, $end, $together);
+ $earned = $this->opsRepository->listIncome($start, $end, $together);
// group and list per account name (as long as its not in accounts, only in double)
/** @var array $currency */
@@ -195,11 +195,11 @@ class DoubleController extends Controller
/** @var array $journal */
foreach ($currency['transaction_journals'] as $journal) {
- $destId = $journal['destination_account_id'];
- $destName = $journal['destination_account_name'];
- $destIban = $journal['destination_account_iban'];
- $genericName = $this->getCounterpartName($withCounterpart, $destId, $destName, $destIban);
- $objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
+ $destId = $journal['destination_account_id'];
+ $destName = $journal['destination_account_name'];
+ $destIban = $journal['destination_account_iban'];
+ $genericName = $this->getCounterpartName($withCounterpart, $destId, $destName, $destIban);
+ $objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
$report[$objectName] ??= [
'dest_name' => '',
'dest_iban' => '',
@@ -219,10 +219,10 @@ class DoubleController extends Controller
$report[$objectName]['dest_iban'] = $destIban;
// add amounts:
- $report[$objectName]['spent'] = bcadd($report[$objectName]['spent'], $journal['amount']);
- $report[$objectName]['sum'] = bcadd($report[$objectName]['sum'], $journal['amount']);
- $sums[$currencyId]['spent'] = bcadd($sums[$currencyId]['spent'], $journal['amount']);
- $sums[$currencyId]['sum'] = bcadd($sums[$currencyId]['sum'], $journal['amount']);
+ $report[$objectName]['spent'] = bcadd($report[$objectName]['spent'], $journal['amount']);
+ $report[$objectName]['sum'] = bcadd($report[$objectName]['sum'], $journal['amount']);
+ $sums[$currencyId]['spent'] = bcadd($sums[$currencyId]['spent'], $journal['amount']);
+ $sums[$currencyId]['sum'] = bcadd($sums[$currencyId]['sum'], $journal['amount']);
}
}
@@ -243,11 +243,11 @@ class DoubleController extends Controller
/** @var array $journal */
foreach ($currency['transaction_journals'] as $journal) {
- $sourceId = $journal['source_account_id'];
- $sourceName = $journal['source_account_name'];
- $sourceIban = $journal['source_account_iban'];
- $genericName = $this->getCounterpartName($withCounterpart, $sourceId, $sourceName, $sourceIban);
- $objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
+ $sourceId = $journal['source_account_id'];
+ $sourceName = $journal['source_account_name'];
+ $sourceIban = $journal['source_account_iban'];
+ $genericName = $this->getCounterpartName($withCounterpart, $sourceId, $sourceName, $sourceIban);
+ $objectName = sprintf('%s (%s)', $genericName, $currency['currency_name']);
$report[$objectName] ??= [
'dest_name' => '',
'dest_iban' => '',
@@ -268,10 +268,10 @@ class DoubleController extends Controller
$report[$objectName]['source_iban'] = $sourceIban;
// add amounts:
- $report[$objectName]['earned'] = bcadd($report[$objectName]['earned'], $journal['amount']);
- $report[$objectName]['sum'] = bcadd($report[$objectName]['sum'], $journal['amount']);
- $sums[$currencyId]['earned'] = bcadd($sums[$currencyId]['earned'], $journal['amount']);
- $sums[$currencyId]['sum'] = bcadd($sums[$currencyId]['sum'], $journal['amount']);
+ $report[$objectName]['earned'] = bcadd($report[$objectName]['earned'], $journal['amount']);
+ $report[$objectName]['sum'] = bcadd($report[$objectName]['sum'], $journal['amount']);
+ $sums[$currencyId]['earned'] = bcadd($sums[$currencyId]['earned'], $journal['amount']);
+ $sums[$currencyId]['sum'] = bcadd($sums[$currencyId]['sum'], $journal['amount']);
}
}
@@ -288,8 +288,8 @@ class DoubleController extends Controller
$report = [];
$sums = [];
// see what happens when we collect transactions.
- $spent = $this->opsRepository->listExpenses($start, $end, $together);
- $earned = $this->opsRepository->listIncome($start, $end, $together);
+ $spent = $this->opsRepository->listExpenses($start, $end, $together);
+ $earned = $this->opsRepository->listIncome($start, $end, $together);
// group and list per account name (as long as its not in accounts, only in double)
/** @var array $currency */
@@ -309,7 +309,7 @@ class DoubleController extends Controller
/** @var array $journal */
foreach ($currency['transaction_journals'] as $journal) {
- $objectName = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
+ $objectName = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
$report[$objectName] ??= [
'account_id' => $journal['source_account_id'],
'account_name' => $objectName,
@@ -348,7 +348,7 @@ class DoubleController extends Controller
/** @var array $journal */
foreach ($currency['transaction_journals'] as $journal) {
- $objectName = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
+ $objectName = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
$report[$objectName] ??= [
'account_id' => $journal['destination_account_id'],
'account_name' => $objectName,
@@ -406,7 +406,7 @@ class DoubleController extends Controller
}
// sort by amount_float
// sort temp array by amount.
- $amounts = array_column($result, 'amount_float');
+ $amounts = array_column($result, 'amount_float');
array_multisort($amounts, SORT_ASC, $result);
try {
@@ -454,7 +454,7 @@ class DoubleController extends Controller
}
// sort by amount_float
// sort temp array by amount.
- $amounts = array_column($result, 'amount_float');
+ $amounts = array_column($result, 'amount_float');
array_multisort($amounts, SORT_DESC, $result);
try {
diff --git a/app/Http/Controllers/Report/OperationsController.php b/app/Http/Controllers/Report/OperationsController.php
index ced490bb3f..de27b13d04 100644
--- a/app/Http/Controllers/Report/OperationsController.php
+++ b/app/Http/Controllers/Report/OperationsController.php
@@ -65,7 +65,7 @@ class OperationsController extends Controller
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('expense-report');
@@ -99,7 +99,7 @@ class OperationsController extends Controller
public function income(Collection $accounts, Carbon $start, Carbon $end): string
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('income-report');
@@ -135,7 +135,7 @@ class OperationsController extends Controller
public function operations(Collection $accounts, Carbon $start, Carbon $end)
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('inc-exp-report');
@@ -152,7 +152,7 @@ class OperationsController extends Controller
/** @var int $currencyId */
foreach ($keys as $currencyId) {
$currencyInfo = $incomes['sums'][$currencyId] ?? $expenses['sums'][$currencyId];
- $sums[$currencyId] ??= [
+ $sums[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_name' => $currencyInfo['currency_name'],
'currency_code' => $currencyInfo['currency_code'],
diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.php
index 996a5c773e..c561a92881 100644
--- a/app/Http/Controllers/Report/TagController.php
+++ b/app/Http/Controllers/Report/TagController.php
@@ -68,7 +68,7 @@ class TagController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
- $accountId = $account->id;
+ $accountId = $account->id;
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
@@ -85,8 +85,8 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
$tagId = $tag['id'];
foreach ($tag['transaction_journals'] as $journal) {
- $sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $sourceAccountId = $journal['source_account_id'];
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -163,7 +163,7 @@ class TagController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
- $accountId = $account->id;
+ $accountId = $account->id;
$report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
@@ -174,7 +174,7 @@ class TagController extends Controller
// loop expenses.
foreach ($spent as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -187,7 +187,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
- $report[$sourceAccountId]['currencies'][$currencyId] ??= [
+ $report[$sourceAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -212,7 +212,7 @@ class TagController extends Controller
// loop income.
foreach ($earned as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -225,7 +225,7 @@ class TagController extends Controller
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
- $report[$destinationAccountId]['currencies'][$currencyId] ??= [
+ $report[$destinationAccountId]['currencies'][$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
'currency_name' => $currency['currency_name'],
@@ -258,14 +258,14 @@ class TagController extends Controller
*/
public function avgExpenses(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags);
- $result = [];
+ $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
- $destinationId = $journal['destination_account_id'];
- $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
- $result[$key] ??= [
+ $destinationId = $journal['destination_account_id'];
+ $key = sprintf('%d-%d', $destinationId, $currency['currency_id']);
+ $result[$key] ??= [
'transactions' => 0,
'sum' => '0',
'avg' => '0',
@@ -308,13 +308,13 @@ class TagController extends Controller
*/
public function avgIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags);
- $result = [];
+ $spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
- $sourceId = $journal['source_account_id'];
- $key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
+ $sourceId = $journal['source_account_id'];
+ $key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
$result[$key] ??= [
'transactions' => 0,
'sum' => '0',
@@ -365,7 +365,7 @@ class TagController extends Controller
/** @var Tag $tag */
foreach ($tags as $tag) {
- $tagId = $tag->id;
+ $tagId = $tag->id;
$report[$tagId] ??= [
'name' => $tag->tag,
'id' => $tag->id,
@@ -373,7 +373,7 @@ class TagController extends Controller
];
}
foreach ($spent as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -392,7 +392,7 @@ class TagController extends Controller
}
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$tagId]['currencies'][$currencyId] ??= [
+ $report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
$tagId => $tagId,
@@ -411,7 +411,7 @@ class TagController extends Controller
}
foreach ($earned as $currency) {
- $currencyId = $currency['currency_id'];
+ $currencyId = $currency['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -430,7 +430,7 @@ class TagController extends Controller
}
foreach ($tag['transaction_journals'] as $journal) {
// add currency info to report array:
- $report[$tagId]['currencies'][$currencyId] ??= [
+ $report[$tagId]['currencies'][$currencyId] ??= [
'spent' => '0',
'earned' => '0',
'sum' => '0',
@@ -458,8 +458,8 @@ class TagController extends Controller
*/
public function topExpenses(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags);
- $result = [];
+ $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
@@ -506,8 +506,8 @@ class TagController extends Controller
*/
public function topIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
- $spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags);
- $result = [];
+ $spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags);
+ $result = [];
foreach ($spent as $currency) {
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 8c9e51a5f8..67d8344fee 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -246,12 +246,12 @@ class ReportController extends Controller
);
// group accounts by role:
- $groupedAccounts = [];
+ $groupedAccounts = [];
/** @var Account $account */
foreach ($accounts as $account) {
- $type = $account->accountType->type;
- $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role'));
+ $type = $account->accountType->type;
+ $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role'));
if (in_array($type, [AccountType::MORTGAGE, AccountType::DEBT, AccountType::LOAN], true)) {
$role = sprintf('opt_group_l_%s', $type);
@@ -264,7 +264,7 @@ class ReportController extends Controller
}
ksort($groupedAccounts);
- $accountList = implode(',', $accounts->pluck('id')->toArray());
+ $accountList = implode(',', $accounts->pluck('id')->toArray());
$this->repository->cleanupBudgets();
return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'groupedAccounts', 'customFiscalYear'));
@@ -342,7 +342,7 @@ class ReportController extends Controller
return view('error')->with('message', (string)trans('firefly.end_after_start_date'));
}
- $url = match ($reportType) {
+ $url = match ($reportType) {
default => route('reports.report.default', [$accounts, $start, $end]),
'category' => route('reports.report.category', [$accounts, $categories, $start, $end]),
'audit' => route('reports.report.audit', [$accounts, $start, $end]),
diff --git a/app/Http/Controllers/Rule/CreateController.php b/app/Http/Controllers/Rule/CreateController.php
index c7e491836e..59d2c48ced 100644
--- a/app/Http/Controllers/Rule/CreateController.php
+++ b/app/Http/Controllers/Rule/CreateController.php
@@ -79,19 +79,19 @@ class CreateController extends Controller
public function create(Request $request, RuleGroup $ruleGroup = null)
{
$this->createDefaultRuleGroup();
- $preFilled = [
+ $preFilled = [
'strict' => true,
];
- $oldTriggers = [];
- $oldActions = [];
+ $oldTriggers = [];
+ $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 = app(SearchInterface::class);
$search->parseQuery($query);
- $words = $search->getWordsAsString();
- $operators = $search->getOperators()->toArray();
+ $words = $search->getWordsAsString();
+ $operators = $search->getOperators()->toArray();
if ('' !== $words) {
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words]));
$operators[] = [
@@ -114,7 +114,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');
if (null !== $ruleGroup) {
$subTitle = (string)trans('firefly.make_new_rule', ['title' => $ruleGroup->title]);
}
@@ -146,7 +146,7 @@ class CreateController extends Controller
$request->session()->flash('info', (string)trans('firefly.instructions_rule_from_bill', ['name' => e($bill->name)]));
$this->createDefaultRuleGroup();
- $preFilled = [
+ $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]),
@@ -155,8 +155,8 @@ class CreateController extends Controller
// make triggers and actions from the bill itself.
// get triggers and actions for bill:
- $oldTriggers = $this->getTriggersForBill($bill);
- $oldActions = $this->getActionsForBill($bill);
+ $oldTriggers = $this->getTriggersForBill($bill);
+ $oldActions = $this->getActionsForBill($bill);
// restore actions and triggers from old input:
if (null !== $request->old()) {
@@ -169,7 +169,7 @@ class CreateController extends Controller
$subTitleIcon = 'fa-clone';
// title depends on whether 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);
@@ -199,13 +199,13 @@ class CreateController extends Controller
$subTitle = (string)trans('firefly.make_new_rule_no_group');
// get triggers and actions for journal.
- $oldTriggers = $this->getTriggersForJournal($journal);
- $oldActions = [];
+ $oldTriggers = $this->getTriggersForJournal($journal);
+ $oldActions = [];
$this->createDefaultRuleGroup();
// collect pre-filled information:
- $preFilled = [
+ $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]),
@@ -253,9 +253,9 @@ class CreateController extends Controller
*/
public function store(RuleFormRequest $request)
{
- $data = $request->getRuleData();
+ $data = $request->getRuleData();
- $rule = $this->ruleRepos->store($data);
+ $rule = $this->ruleRepos->store($data);
session()->flash('success', (string)trans('firefly.stored_new_rule', ['title' => $rule->title]));
app('preferences')->mark();
diff --git a/app/Http/Controllers/Rule/EditController.php b/app/Http/Controllers/Rule/EditController.php
index 9b7b927194..f9e3c65bbd 100644
--- a/app/Http/Controllers/Rule/EditController.php
+++ b/app/Http/Controllers/Rule/EditController.php
@@ -76,18 +76,18 @@ class EditController extends Controller
*/
public function edit(Request $request, Rule $rule)
{
- $triggerCount = 0;
- $actionCount = 0;
- $oldActions = [];
- $oldTriggers = [];
+ $triggerCount = 0;
+ $actionCount = 0;
+ $oldActions = [];
+ $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 = app(SearchInterface::class);
$search->parseQuery($query);
- $words = $search->getWordsAsString();
- $operators = $search->getOperators()->toArray();
+ $words = $search->getWordsAsString();
+ $operators = $search->getOperators()->toArray();
if ('' !== $words) {
session()->flash('warning', trans('firefly.rule_from_search_words', ['string' => $words]));
$operators[] = ['type' => 'description_contains', 'value' => $words];
@@ -99,8 +99,8 @@ class EditController extends Controller
$oldTriggers = $this->getPreviousTriggers($request);
$oldActions = $this->getPreviousActions($request);
}
- $triggerCount = count($oldTriggers);
- $actionCount = count($oldActions);
+ $triggerCount = count($oldTriggers);
+ $actionCount = count($oldActions);
// overrule old input and query data when it has no rule data:
if (0 === $triggerCount && 0 === $actionCount) {
@@ -110,8 +110,8 @@ class EditController extends Controller
$actionCount = count($oldActions);
}
- $hasOldInput = null !== $request->old('_token');
- $preFilled = [
+ $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,
@@ -139,7 +139,7 @@ class EditController extends Controller
*/
public function update(RuleFormRequest $request, Rule $rule)
{
- $data = $request->getRuleData();
+ $data = $request->getRuleData();
$this->ruleRepos->update($rule, $data);
@@ -171,7 +171,7 @@ class EditController extends Controller
}
asort($triggers);
- $index = 0;
+ $index = 0;
foreach ($submittedOperators as $operator) {
try {
$renderedEntries[] = view(
diff --git a/app/Http/Controllers/Rule/SelectController.php b/app/Http/Controllers/Rule/SelectController.php
index d879355c1c..bf850652f1 100644
--- a/app/Http/Controllers/Rule/SelectController.php
+++ b/app/Http/Controllers/Rule/SelectController.php
@@ -70,10 +70,10 @@ class SelectController extends Controller
{
// Get parameters specified by the user
/** @var User $user */
- $user = auth()->user();
- $accounts = implode(',', $request->get('accounts'));
- $startDate = new Carbon($request->get('start'));
- $endDate = new Carbon($request->get('end'));
+ $user = auth()->user();
+ $accounts = implode(',', $request->get('accounts'));
+ $startDate = new Carbon($request->get('start'));
+ $endDate = new Carbon($request->get('end'));
// create new rule engine:
$newRuleEngine = app(RuleEngineInterface::class);
@@ -87,7 +87,7 @@ class SelectController extends Controller
// set rules:
$newRuleEngine->setRules(new Collection([$rule]));
$newRuleEngine->fire();
- $resultCount = $newRuleEngine->getResults();
+ $resultCount = $newRuleEngine->getResults();
session()->flash('success', trans_choice('firefly.applied_rule_selection', $resultCount, ['title' => $rule->title]));
@@ -121,14 +121,14 @@ class SelectController extends Controller
public function testTriggers(TestRuleFormRequest $request): JsonResponse
{
// build fake rule
- $rule = new Rule();
+ $rule = new Rule();
/** @var \Illuminate\Database\Eloquent\Collection $triggers */
- $triggers = new Collection();
- $rule->strict = '1' === $request->get('strict');
+ $triggers = new Collection();
+ $rule->strict = '1' === $request->get('strict');
// build trigger array from response
- $textTriggers = $this->getValidTriggerList($request);
+ $textTriggers = $this->getValidTriggerList($request);
// warn if nothing.
if (0 === count($textTriggers)) {
@@ -150,22 +150,22 @@ class SelectController extends Controller
// create new rule engine:
/** @var RuleEngineInterface $newRuleEngine */
- $newRuleEngine = app(RuleEngineInterface::class);
+ $newRuleEngine = app(RuleEngineInterface::class);
// set rules:
$newRuleEngine->setRules(new Collection([$rule]));
$newRuleEngine->setRefreshTriggers(false);
- $collection = $newRuleEngine->find();
- $collection = $collection->slice(0, 20);
+ $collection = $newRuleEngine->find();
+ $collection = $collection->slice(0, 20);
// Warn the user if only a subset of transactions is returned
- $warning = '';
+ $warning = '';
if (0 === count($collection)) {
$warning = (string)trans('firefly.warning_no_matching_transactions');
}
// Return json response
- $view = 'ERROR, see logs.';
+ $view = 'ERROR, see logs.';
try {
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
@@ -188,7 +188,7 @@ class SelectController extends Controller
*/
public function testTriggersByRule(Rule $rule): JsonResponse
{
- $triggers = $rule->ruleTriggers;
+ $triggers = $rule->ruleTriggers;
if (0 === count($triggers)) {
return response()->json(['html' => '', 'warning' => (string)trans('firefly.warning_no_valid_triggers')]);
@@ -198,16 +198,16 @@ class SelectController extends Controller
// set rules:
$newRuleEngine->setRules(new Collection([$rule]));
- $collection = $newRuleEngine->find();
- $collection = $collection->slice(0, 20);
+ $collection = $newRuleEngine->find();
+ $collection = $collection->slice(0, 20);
- $warning = '';
+ $warning = '';
if (0 === count($collection)) {
$warning = (string)trans('firefly.warning_no_matching_transactions');
}
// Return json response
- $view = 'ERROR, see logs.';
+ $view = 'ERROR, see logs.';
try {
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
diff --git a/app/Http/Controllers/RuleGroup/CreateController.php b/app/Http/Controllers/RuleGroup/CreateController.php
index add430dd97..c8f5bd7810 100644
--- a/app/Http/Controllers/RuleGroup/CreateController.php
+++ b/app/Http/Controllers/RuleGroup/CreateController.php
@@ -90,7 +90,7 @@ class CreateController extends Controller
session()->flash('success', (string)trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title]));
app('preferences')->mark();
- $redirect = redirect($this->getPreviousUrl('rule-groups.create.url'));
+ $redirect = redirect($this->getPreviousUrl('rule-groups.create.url'));
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.php
index e8b81c7e1d..0b42b5eee3 100644
--- a/app/Http/Controllers/RuleGroup/DeleteController.php
+++ b/app/Http/Controllers/RuleGroup/DeleteController.php
@@ -81,7 +81,7 @@ class DeleteController extends Controller
*/
public function destroy(Request $request, RuleGroup $ruleGroup)
{
- $title = $ruleGroup->title;
+ $title = $ruleGroup->title;
/** @var RuleGroup $moveTo */
$moveTo = $this->repository->find((int)$request->get('move_rules_before_delete'));
diff --git a/app/Http/Controllers/RuleGroup/EditController.php b/app/Http/Controllers/RuleGroup/EditController.php
index 70064887c3..67c18f8467 100644
--- a/app/Http/Controllers/RuleGroup/EditController.php
+++ b/app/Http/Controllers/RuleGroup/EditController.php
@@ -67,7 +67,7 @@ class EditController extends Controller
*/
public function edit(Request $request, RuleGroup $ruleGroup)
{
- $subTitle = (string)trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);
+ $subTitle = (string)trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);
$hasOldInput = null !== $request->old('_token');
$preFilled = [
@@ -119,7 +119,7 @@ class EditController extends Controller
*/
public function update(RuleGroupFormRequest $request, RuleGroup $ruleGroup)
{
- $data = [
+ $data = [
'title' => $request->convertString('title'),
'description' => $request->stringWithNewlines('description'),
'active' => 1 === (int)$request->input('active'),
diff --git a/app/Http/Controllers/RuleGroup/ExecutionController.php b/app/Http/Controllers/RuleGroup/ExecutionController.php
index fa85478f57..bf8e67759a 100644
--- a/app/Http/Controllers/RuleGroup/ExecutionController.php
+++ b/app/Http/Controllers/RuleGroup/ExecutionController.php
@@ -69,11 +69,11 @@ class ExecutionController extends Controller
{
// Get parameters specified by the user
/** @var User $user */
- $user = auth()->user();
- $accounts = implode(',', $request->get('accounts'));
- $startDate = new Carbon($request->get('start'));
- $endDate = new Carbon($request->get('end'));
- $rules = $this->ruleGroupRepository->getActiveRules($ruleGroup);
+ $user = auth()->user();
+ $accounts = implode(',', $request->get('accounts'));
+ $startDate = new Carbon($request->get('start'));
+ $endDate = new Carbon($request->get('end'));
+ $rules = $this->ruleGroupRepository->getActiveRules($ruleGroup);
// create new rule engine:
$newRuleEngine = app(RuleEngineInterface::class);
$newRuleEngine->setUser($user);
diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php
index 08bec489b0..b68d9de8a7 100644
--- a/app/Http/Controllers/SearchController.php
+++ b/app/Http/Controllers/SearchController.php
@@ -61,18 +61,18 @@ class SearchController extends Controller
public function index(Request $request, SearchInterface $searcher)
{
// search params:
- $fullQuery = $request->get('search');
+ $fullQuery = $request->get('search');
if (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');
- $ruleChanged = false;
+ $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.
- $ruleRepository = app(RuleRepositoryInterface::class);
- $rule = $ruleRepository->find($ruleId);
+ $ruleRepository = app(RuleRepositoryInterface::class);
+ $rule = $ruleRepository->find($ruleId);
if (null !== $rule) {
$originalQuery = $ruleRepository->getSearchQuery($rule);
if ($originalQuery !== $fullQuery) {
@@ -98,12 +98,12 @@ class SearchController extends Controller
*/
public function search(Request $request, SearchInterface $searcher): JsonResponse
{
- $entry = $request->get('query');
+ $entry = $request->get('query');
if (!is_scalar($entry)) {
$entry = '';
}
- $fullQuery = (string)$entry;
- $page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
+ $fullQuery = (string)$entry;
+ $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.php
index 81ba395305..a00e46f58c 100644
--- a/app/Http/Controllers/System/InstallController.php
+++ b/app/Http/Controllers/System/InstallController.php
@@ -67,7 +67,7 @@ class InstallController extends Controller
'firefly-iii:verify-security-alerts' => [],
];
- $this->lastError = '';
+ $this->lastError = '';
}
/**
@@ -99,10 +99,10 @@ class InstallController extends Controller
];
app('log')->debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
- $indexes = array_values(array_keys($this->upgradeCommands));
+ $indexes = array_values(array_keys($this->upgradeCommands));
if (array_key_exists($requestIndex, $indexes)) {
- $command = $indexes[$requestIndex];
- $parameters = $this->upgradeCommands[$command];
+ $command = $indexes[$requestIndex];
+ $parameters = $this->upgradeCommands[$command];
app('log')->debug(sprintf('Will now execute command "%s" with parameters', $command), $parameters);
try {
@@ -134,7 +134,7 @@ class InstallController extends Controller
*/
public function keys(): void
{
- $key = RSA::createKey(4096);
+ $key = RSA::createKey(4096);
[$publicKey, $privateKey] = [
Passport::keyPath('oauth-public.key'),
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index 2d785e4000..0b6a39b884 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -79,8 +79,8 @@ class TagController extends Controller
$subTitleIcon = 'fa-tag';
// location info:
- $hasOldInput = null !== $request->old('_token');
- $locations = [
+ $hasOldInput = null !== $request->old('_token');
+ $locations = [
'location' => [
'latitude' => $hasOldInput ? old('location_latitude') : config('firefly.default_location.latitude'),
'longitude' => $hasOldInput ? old('location_longitude') : config('firefly.default_location.longitude'),
@@ -123,12 +123,12 @@ class TagController extends Controller
$subTitle = (string)trans('firefly.edit_tag', ['tag' => $tag->tag]);
$subTitleIcon = 'fa-tag';
- $location = $this->repository->getLocation($tag);
- $latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
- $longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
- $zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
- $hasLocation = null !== $location;
- $locations = [
+ $location = $this->repository->getLocation($tag);
+ $latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
+ $longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
+ $zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
+ $hasLocation = null !== $location;
+ $locations = [
'location' => [
'latitude' => old('location_latitude') ?? $latitude,
'longitude' => old('location_longitude') ?? $longitude,
@@ -154,9 +154,9 @@ class TagController extends Controller
public function index(TagRepositoryInterface $repository)
{
// start with oldest tag
- $first = session('first', today()) ?? today();
- $oldestTagDate = null === $repository->oldestTag() ? clone $first : $repository->oldestTag()->date;
- $newestTagDate = null === $repository->newestTag() ? today() : $repository->newestTag()->date;
+ $first = session('first', today()) ?? today();
+ $oldestTagDate = null === $repository->oldestTag() ? clone $first : $repository->oldestTag()->date;
+ $newestTagDate = null === $repository->newestTag() ? today() : $repository->newestTag()->date;
$oldestTagDate->startOfYear();
$newestTagDate->endOfYear();
$tags = [];
@@ -167,14 +167,14 @@ class TagController extends Controller
$tags[$year] = $repository->getTagsInYear($year);
$newestTagDate->subYear();
}
- $count = $repository->count();
+ $count = $repository->count();
return view('tags.index', compact('tags', 'count'));
}
public function massDestroy(Request $request): RedirectResponse
{
- $tags = $request->get('tags');
+ $tags = $request->get('tags');
if (null === $tags || !is_array($tags)) {
session()->flash('info', (string)trans('firefly.select_tags_to_delete'));
@@ -221,8 +221,8 @@ class TagController extends Controller
$subTitleIcon = 'fa-tag';
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
- $start ??= session('start');
- $end ??= session('end');
+ $start ??= session('start');
+ $end ??= session('end');
$location = $this->repository->getLocation($tag);
$attachments = $this->repository->getAttachments($tag);
$subTitle = trans(
@@ -234,21 +234,21 @@ class TagController extends Controller
]
);
- $startPeriod = $this->repository->firstUseDate($tag);
+ $startPeriod = $this->repository->firstUseDate($tag);
$startPeriod ??= today(config('app.timezone'));
- $endPeriod = clone $end;
- $periods = $this->getTagPeriodOverview($tag, $startPeriod, $endPeriod);
- $path = route('tags.show', [$tag->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
+ $endPeriod = clone $end;
+ $periods = $this->getTagPeriodOverview($tag, $startPeriod, $endPeriod);
+ $path = route('tags.show', [$tag->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withAccountInformation()
->setTag($tag)->withBudgetInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath($path);
- $sums = $this->repository->sumsOfTag($tag, $start, $end);
+ $sums = $this->repository->sumsOfTag($tag, $start, $end);
return view('tags.show', compact('tag', 'attachments', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'groups', 'start', 'end', 'location'));
}
@@ -273,13 +273,13 @@ class TagController extends Controller
$location = $this->repository->getLocation($tag);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withAccountInformation()
->setTag($tag)->withBudgetInformation()->withCategoryInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath($path);
- $sums = $this->repository->sumsOfTag($tag, $start, $end);
+ $sums = $this->repository->sumsOfTag($tag, $start, $end);
return view('tags.show', compact('tag', 'attachments', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'groups', 'start', 'end', 'location'));
}
@@ -289,10 +289,10 @@ class TagController extends Controller
*/
public function store(TagFormRequest $request): RedirectResponse
{
- $data = $request->collectTagData();
+ $data = $request->collectTagData();
app('log')->debug('Data from request', $data);
- $result = $this->repository->store($data);
+ $result = $this->repository->store($data);
app('log')->debug('Data after storage', $result->toArray());
session()->flash('success', (string)trans('firefly.created_tag', ['tag' => $data['tag']]));
@@ -300,7 +300,7 @@ class TagController extends Controller
// store attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachmentsHelper->saveAttachmentsForModel($result, $files);
}
@@ -327,15 +327,15 @@ class TagController extends Controller
*/
public function update(TagFormRequest $request, Tag $tag): RedirectResponse
{
- $data = $request->collectTagData();
- $tag = $this->repository->update($tag, $data);
+ $data = $request->collectTagData();
+ $tag = $this->repository->update($tag, $data);
session()->flash('success', (string)trans('firefly.updated_tag', ['tag' => $data['tag']]));
app('preferences')->mark();
// store new attachment(s):
/** @var null|array $files */
- $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
+ $files = $request->hasFile('attachments') ? $request->file('attachments') : null;
if (null !== $files && !auth()->user()->hasRole('demo')) {
$this->attachmentsHelper->saveAttachmentsForModel($tag, $files);
}
diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.php
index a765ec1f5a..79d58cfda2 100644
--- a/app/Http/Controllers/Transaction/BulkController.php
+++ b/app/Http/Controllers/Transaction/BulkController.php
@@ -71,7 +71,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->rememberPreviousUrl('transactions.bulk-edit.url');
diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php
index be15b5c1e2..9c256c1b41 100644
--- a/app/Http/Controllers/Transaction/ConvertController.php
+++ b/app/Http/Controllers/Transaction/ConvertController.php
@@ -87,16 +87,16 @@ class ConvertController extends Controller
}
/** @var TransactionGroupTransformer $transformer */
- $transformer = app(TransactionGroupTransformer::class);
+ $transformer = app(TransactionGroupTransformer::class);
/** @var TransactionJournal $first */
- $first = $group->transactionJournals()->first();
- $sourceType = $first->transactionType;
+ $first = $group->transactionJournals()->first();
+ $sourceType = $first->transactionType;
- $groupTitle = $group->title ?? $first->description;
- $groupArray = $transformer->transformObject($group);
- $subTitle = (string)trans('firefly.convert_to_'.$destinationType->type, ['description' => $groupTitle]);
- $subTitleIcon = 'fa-exchange';
+ $groupTitle = $group->title ?? $first->description;
+ $groupArray = $transformer->transformObject($group);
+ $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:
$validDepositSources = $this->getValidDepositSources();
@@ -105,7 +105,7 @@ class ConvertController extends Controller
$assets = $this->getAssetAccounts();
// old input variables:
- $preFilled = [
+ $preFilled = [
'source_name' => old('source_name'),
];
@@ -179,8 +179,8 @@ class ConvertController extends Controller
// group accounts:
/** @var Account $account */
foreach ($accountList as $account) {
- $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
- $name = $account->name;
+ $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
+ $name = $account->name;
if ('' === $role) {
$role = 'no_account_type';
}
@@ -216,8 +216,8 @@ class ConvertController extends Controller
// group accounts:
/** @var Account $account */
foreach ($accountList as $account) {
- $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
- $name = $account->name;
+ $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
+ $name = $account->name;
if ('' === $role) {
$role = 'no_account_type';
}
@@ -277,9 +277,9 @@ class ConvertController extends Controller
// group accounts:
/** @var Account $account */
foreach ($accountList as $account) {
- $balance = app('steam')->balance($account, today());
- $currency = $this->accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
- $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
+ $balance = app('steam')->balance($account, today());
+ $currency = $this->accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
+ $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
if ('' === $role) {
$role = 'no_account_type';
}
@@ -297,14 +297,14 @@ class ConvertController extends Controller
private function convertJournal(TransactionJournal $journal, TransactionType $transactionType, array $data): TransactionJournal
{
/** @var AccountValidator $validator */
- $validator = app(AccountValidator::class);
+ $validator = app(AccountValidator::class);
$validator->setUser(auth()->user());
$validator->setTransactionType($transactionType->type);
- $sourceId = $data['source_id'][$journal->id] ?? null;
- $sourceName = $data['source_name'][$journal->id] ?? null;
- $destinationId = $data['destination_id'][$journal->id] ?? null;
- $destinationName = $data['destination_name'][$journal->id] ?? null;
+ $sourceId = $data['source_id'][$journal->id] ?? null;
+ $sourceName = $data['source_name'][$journal->id] ?? null;
+ $destinationId = $data['destination_id'][$journal->id] ?? null;
+ $destinationName = $data['destination_name'][$journal->id] ?? null;
// double check its not an empty string.
$sourceId = '' === $sourceId || null === $sourceId ? null : (int)$sourceId;
@@ -323,7 +323,7 @@ class ConvertController extends Controller
// TODO typeOverrule: the account validator may have another opinion on the transaction type.
- $update = [
+ $update = [
'source_id' => $sourceId,
'source_name' => $sourceName,
'destination_id' => $destinationId,
@@ -332,7 +332,7 @@ class ConvertController extends Controller
];
/** @var JournalUpdateService $service */
- $service = app(JournalUpdateService::class);
+ $service = app(JournalUpdateService::class);
$service->setTransactionJournal($journal);
$service->setData($update);
$service->update();
diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php
index 99a79a895c..cd2d6a0288 100644
--- a/app/Http/Controllers/Transaction/CreateController.php
+++ b/app/Http/Controllers/Transaction/CreateController.php
@@ -74,8 +74,8 @@ class CreateController extends Controller
app('preferences')->mark();
- $title = $newGroup->title ?? $newGroup->transactionJournals->first()->description;
- $link = route('transactions.show', [$newGroup->id]);
+ $title = $newGroup->title ?? $newGroup->transactionJournals->first()->description;
+ $link = route('transactions.show', [$newGroup->id]);
session()->flash('success', trans('firefly.stored_journal', ['description' => $title]));
session()->flash('success_url', $link);
@@ -101,8 +101,8 @@ 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);
diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.php
index 67a50e9c61..1519027067 100644
--- a/app/Http/Controllers/Transaction/DeleteController.php
+++ b/app/Http/Controllers/Transaction/DeleteController.php
@@ -76,7 +76,7 @@ class DeleteController extends Controller
app('log')->debug(sprintf('Start of delete view for group #%d', $group->id));
- $journal = $group->transactionJournals->first();
+ $journal = $group->transactionJournals->first();
if (null === $journal) {
throw new NotFoundHttpException();
}
@@ -100,7 +100,7 @@ class DeleteController extends Controller
return $this->redirectGroupToAccount($group);
}
- $journal = $group->transactionJournals->first();
+ $journal = $group->transactionJournals->first();
if (null === $journal) {
throw new NotFoundHttpException();
}
@@ -108,7 +108,7 @@ class DeleteController extends Controller
session()->flash('success', (string)trans('firefly.deleted_'.strtolower($objectType), ['description' => $group->title ?? $journal->description]));
// grab asset account(s) from group:
- $accounts = [];
+ $accounts = [];
/** @var TransactionJournal $currentJournal */
foreach ($group->transactionJournals as $currentJournal) {
diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php
index 3c7d819095..cac86c79a5 100644
--- a/app/Http/Controllers/Transaction/EditController.php
+++ b/app/Http/Controllers/Transaction/EditController.php
@@ -79,12 +79,12 @@ class EditController extends Controller
$expectedSourceTypes = config('firefly.expected_source_types');
$allowedSourceDests = config('firefly.source_dests');
- $defaultCurrency = app('amount')->getDefaultCurrency();
- $cash = $repository->getCashAccount();
- $previousUrl = $this->rememberPreviousUrl('transactions.edit.url');
- $parts = parse_url($previousUrl);
- $search = sprintf('?%s', $parts['query'] ?? '');
- $previousUrl = str_replace($search, '', $previousUrl);
+ $defaultCurrency = app('amount')->getDefaultCurrency();
+ $cash = $repository->getCashAccount();
+ $previousUrl = $this->rememberPreviousUrl('transactions.edit.url');
+ $parts = parse_url($previousUrl);
+ $search = sprintf('?%s', $parts['query'] ?? '');
+ $previousUrl = str_replace($search, '', $previousUrl);
return view(
'transactions.edit',
diff --git a/app/Http/Controllers/Transaction/IndexController.php b/app/Http/Controllers/Transaction/IndexController.php
index b2219ebcf6..f51ef06aa4 100644
--- a/app/Http/Controllers/Transaction/IndexController.php
+++ b/app/Http/Controllers/Transaction/IndexController.php
@@ -75,10 +75,10 @@ class IndexController extends Controller
$objectType = 'transfer';
}
- $subTitleIcon = config('firefly.transactionIconsByType.'.$objectType);
- $types = config('firefly.transactionTypesByType.'.$objectType);
- $page = (int)$request->get('page');
- $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
+ $subTitleIcon = config('firefly.transactionIconsByType.'.$objectType);
+ $types = config('firefly.transactionTypesByType.'.$objectType);
+ $page = (int)$request->get('page');
+ $pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
if (null === $start) {
$start = session('start');
$end = session('end');
@@ -90,18 +90,18 @@ class IndexController extends Controller
}
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
- $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]);
+ $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]);
- $firstJournal = $this->repository->firstNull();
- $startPeriod = null === $firstJournal ? new Carbon() : $firstJournal->date;
- $endPeriod = clone $end;
- $periods = $this->getTransactionPeriodOverview($objectType, $startPeriod, $endPeriod);
+ $firstJournal = $this->repository->firstNull();
+ $startPeriod = null === $firstJournal ? new Carbon() : $firstJournal->date;
+ $endPeriod = clone $end;
+ $periods = $this->getTransactionPeriodOverview($objectType, $startPeriod, $endPeriod);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)
->setTypes($types)
@@ -112,7 +112,7 @@ class IndexController extends Controller
->withAccountInformation()
->withAttachmentInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath($path);
return view('transactions.index', compact('subTitle', 'objectType', 'subTitleIcon', 'groups', 'periods', 'start', 'end'));
@@ -137,7 +137,7 @@ class IndexController extends Controller
$subTitle = (string)trans('firefly.all_'.$objectType);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)
->setTypes($types)
@@ -148,7 +148,7 @@ class IndexController extends Controller
->withCategoryInformation()
->withAttachmentInformation()
;
- $groups = $collector->getPaginatedGroups();
+ $groups = $collector->getPaginatedGroups();
$groups->setPath($path);
return view('transactions.index', compact('subTitle', 'objectType', 'subTitleIcon', 'groups', 'start', 'end'));
diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.php
index 7c3935bc77..49a2e27dc8 100644
--- a/app/Http/Controllers/Transaction/LinkController.php
+++ b/app/Http/Controllers/Transaction/LinkController.php
@@ -109,10 +109,10 @@ class LinkController extends Controller
*/
public function store(JournalLinkRequest $request, TransactionJournal $journal)
{
- $linkInfo = $request->getLinkInfo();
+ $linkInfo = $request->getLinkInfo();
app('log')->debug('We are here (store)');
- $other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
+ $other = $this->journalRepository->find($linkInfo['transaction_journal_id']);
if (null === $other) {
session()->flash('error', (string)trans('firefly.invalid_link_selection'));
diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php
index ce07434149..af7f14e87e 100644
--- a/app/Http/Controllers/Transaction/MassController.php
+++ b/app/Http/Controllers/Transaction/MassController.php
@@ -121,22 +121,22 @@ 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);
+ $accountRepository = app(AccountRepositoryInterface::class);
// valid withdrawal sources:
- $array = array_keys(config(sprintf('firefly.source_dests.%s', TransactionType::WITHDRAWAL)));
- $withdrawalSources = $accountRepository->getAccountsByType($array);
+ $array = array_keys(config(sprintf('firefly.source_dests.%s', TransactionType::WITHDRAWAL)));
+ $withdrawalSources = $accountRepository->getAccountsByType($array);
// valid deposit destinations:
$array = config(sprintf('firefly.source_dests.%s.%s', TransactionType::DEPOSIT, AccountType::REVENUE));
$depositDestinations = $accountRepository->getAccountsByType($array);
/** @var BudgetRepositoryInterface $budgetRepository */
- $budgetRepository = app(BudgetRepositoryInterface::class);
- $budgets = $budgetRepository->getBudgets();
+ $budgetRepository = app(BudgetRepositoryInterface::class);
+ $budgets = $budgetRepository->getBudgets();
// reverse amounts
foreach ($journals as $index => $journal) {
@@ -164,7 +164,7 @@ class MassController extends Controller
// TODO this is a weird error, should be caught.
throw new FireflyException('This is not an array.');
}
- $count = 0;
+ $count = 0;
/** @var string $journalId */
foreach ($journalIds as $journalId) {
@@ -198,7 +198,7 @@ class MassController extends Controller
// for each field, call the update service.
$service->setTransactionJournal($journal);
- $data = [
+ $data = [
'date' => $this->getDateFromRequest($request, $journal->id, 'date'),
'description' => $this->getStringFromRequest($request, $journal->id, 'description'),
'source_id' => $this->getIntFromRequest($request, $journal->id, 'source_id'),
diff --git a/app/Http/Controllers/Transaction/ShowController.php b/app/Http/Controllers/Transaction/ShowController.php
index 0569eef271..b0f4f870ac 100644
--- a/app/Http/Controllers/Transaction/ShowController.php
+++ b/app/Http/Controllers/Transaction/ShowController.php
@@ -80,25 +80,25 @@ class ShowController extends Controller
public function show(TransactionGroup $transactionGroup)
{
/** @var null|TransactionJournal $first */
- $first = $transactionGroup->transactionJournals()->first(['transaction_journals.*']);
- $splits = $transactionGroup->transactionJournals()->count();
+ $first = $transactionGroup->transactionJournals()->first(['transaction_journals.*']);
+ $splits = $transactionGroup->transactionJournals()->count();
if (null === $first) {
throw new FireflyException('This transaction is broken :(.');
}
- $type = (string)trans(sprintf('firefly.%s', $first->transactionType->type));
- $title = 1 === $splits ? $first->description : $transactionGroup->title;
- $subTitle = sprintf('%s: "%s"', $type, $title);
+ $type = (string)trans(sprintf('firefly.%s', $first->transactionType->type));
+ $title = 1 === $splits ? $first->description : $transactionGroup->title;
+ $subTitle = sprintf('%s: "%s"', $type, $title);
/** @var TransactionGroupTransformer $transformer */
- $transformer = app(TransactionGroupTransformer::class);
+ $transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters(new ParameterBag());
- $groupArray = $transformer->transformObject($transactionGroup);
+ $groupArray = $transformer->transformObject($transactionGroup);
// do some calculations:
- $amounts = $this->getAmounts($groupArray);
- $accounts = $this->getAccounts($groupArray);
+ $amounts = $this->getAmounts($groupArray);
+ $accounts = $this->getAccounts($groupArray);
foreach (array_keys($groupArray['transactions']) as $index) {
$groupArray['transactions'][$index]['tags'] = $this->repository->getTagObjects(
@@ -113,9 +113,9 @@ class ShowController extends Controller
$logEntries[$journal->id] = $this->aleRepository->getForObject($journal);
}
- $events = $this->repository->getPiggyEvents($transactionGroup);
- $attachments = $this->repository->getAttachments($transactionGroup);
- $links = $this->repository->getLinks($transactionGroup);
+ $events = $this->repository->getPiggyEvents($transactionGroup);
+ $attachments = $this->repository->getAttachments($transactionGroup);
+ $links = $this->repository->getLinks($transactionGroup);
return view(
'transactions.show',
@@ -141,7 +141,7 @@ class ShowController extends Controller
{
$amounts = [];
foreach ($group['transactions'] as $transaction) {
- $symbol = $transaction['currency_symbol'];
+ $symbol = $transaction['currency_symbol'];
if (!array_key_exists($symbol, $amounts)) {
$amounts[$symbol] = [
'amount' => '0',
@@ -156,7 +156,7 @@ class ShowController extends Controller
$transaction['foreign_amount']
)) {
// same for foreign currency:
- $foreignSymbol = $transaction['foreign_currency_symbol'];
+ $foreignSymbol = $transaction['foreign_currency_symbol'];
if (!array_key_exists($foreignSymbol, $amounts)) {
$amounts[$foreignSymbol] = [
'amount' => '0',
@@ -176,7 +176,7 @@ class ShowController extends Controller
private function getAccounts(array $group): array
{
- $accounts = [
+ $accounts = [
'source' => [],
'destination' => [],
];
diff --git a/app/Http/Controllers/TransactionCurrency/CreateController.php b/app/Http/Controllers/TransactionCurrency/CreateController.php
index 8e6c199261..ca96f20a5d 100644
--- a/app/Http/Controllers/TransactionCurrency/CreateController.php
+++ b/app/Http/Controllers/TransactionCurrency/CreateController.php
@@ -72,7 +72,7 @@ class CreateController extends Controller
public function create(Request $request)
{
/** @var User $user */
- $user = auth()->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'))]));
@@ -101,8 +101,8 @@ class CreateController extends Controller
public function store(CurrencyFormRequest $request)
{
/** @var User $user */
- $user = auth()->user();
- $data = $request->getCurrencyData();
+ $user = auth()->user();
+ $data = $request->getCurrencyData();
if (!$this->userRepository->hasRole($user, 'owner')) {
app('log')->error('User '.auth()->user()->id.' is not admin, but tried to store a currency.');
Log::channel('audit')->info('Tried to create (POST) currency without admin rights.', $data);
@@ -120,7 +120,7 @@ class CreateController extends Controller
$request->session()->flash('error', (string)trans('firefly.could_not_store_currency'));
$currency = null;
}
- $redirect = redirect($this->getPreviousUrl('currencies.create.url'));
+ $redirect = redirect($this->getPreviousUrl('currencies.create.url'));
if (null !== $currency) {
$request->session()->flash('success', (string)trans('firefly.created_currency', ['name' => $currency->name]));
diff --git a/app/Http/Controllers/TransactionCurrency/DeleteController.php b/app/Http/Controllers/TransactionCurrency/DeleteController.php
index c1e1dd7969..ccad32a82e 100644
--- a/app/Http/Controllers/TransactionCurrency/DeleteController.php
+++ b/app/Http/Controllers/TransactionCurrency/DeleteController.php
@@ -71,7 +71,7 @@ class DeleteController extends Controller
public function delete(Request $request, TransactionCurrency $currency)
{
/** @var User $user */
- $user = auth()->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'))]));
Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code));
diff --git a/app/Http/Controllers/TransactionCurrency/EditController.php b/app/Http/Controllers/TransactionCurrency/EditController.php
index aa42eac591..45e3bde766 100644
--- a/app/Http/Controllers/TransactionCurrency/EditController.php
+++ b/app/Http/Controllers/TransactionCurrency/EditController.php
@@ -69,7 +69,7 @@ class EditController extends Controller
public function edit(Request $request, TransactionCurrency $currency)
{
/** @var User $user */
- $user = auth()->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'))]));
Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code));
@@ -82,12 +82,12 @@ class EditController extends Controller
$currency->symbol = htmlentities($currency->symbol);
// is currently enabled (for this user?)
- $userCurrencies = $this->repository->get()->pluck('id')->toArray();
- $enabled = in_array($currency->id, $userCurrencies, true);
+ $userCurrencies = $this->repository->get()->pluck('id')->toArray();
+ $enabled = in_array($currency->id, $userCurrencies, true);
// code to handle active-checkboxes
- $hasOldInput = null !== $request->old('_token');
- $preFilled = [
+ $hasOldInput = null !== $request->old('_token');
+ $preFilled = [
'enabled' => $hasOldInput ? (bool)$request->old('enabled') : $enabled,
];
@@ -111,8 +111,8 @@ class EditController extends Controller
public function update(CurrencyFormRequest $request, TransactionCurrency $currency)
{
/** @var User $user */
- $user = auth()->user();
- $data = $request->getCurrencyData();
+ $user = auth()->user();
+ $data = $request->getCurrencyData();
if (false === $data['enabled'] && $this->repository->currencyInUse($currency)) {
$data['enabled'] = true;
diff --git a/app/Http/Controllers/TransactionCurrency/IndexController.php b/app/Http/Controllers/TransactionCurrency/IndexController.php
index 581f73ae18..3dc9fb739f 100644
--- a/app/Http/Controllers/TransactionCurrency/IndexController.php
+++ b/app/Http/Controllers/TransactionCurrency/IndexController.php
@@ -85,7 +85,7 @@ class IndexController extends Controller
$currencies = new LengthAwarePaginator($collection, $total, $pageSize, $page);
$currencies->setPath(route('currencies.index'));
- $isOwner = true;
+ $isOwner = true;
if (!$this->userRepository->hasRole($user, 'owner')) {
$request->session()->flash('info', (string)trans('firefly.ask_site_owner', ['owner' => config('firefly.site_owner')]));
$isOwner = false;
diff --git a/app/Http/Middleware/AcceptHeaders.php b/app/Http/Middleware/AcceptHeaders.php
index 915c5432f6..8c525a4a52 100644
--- a/app/Http/Middleware/AcceptHeaders.php
+++ b/app/Http/Middleware/AcceptHeaders.php
@@ -64,7 +64,7 @@ class AcceptHeaders
}
// throw bad request if trace id is not a UUID
- $uuid = $request->header('X-Trace-Id');
+ $uuid = $request->header('X-Trace-Id');
if (is_string($uuid) && '' !== trim($uuid) && (1 !== preg_match('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', trim($uuid)))) {
throw new BadRequestHttpException('Bad X-Trace-Id header.');
}
diff --git a/app/Http/Middleware/InterestingMessage.php b/app/Http/Middleware/InterestingMessage.php
index ff07fb2c3c..1d8a284aa0 100644
--- a/app/Http/Middleware/InterestingMessage.php
+++ b/app/Http/Middleware/InterestingMessage.php
@@ -94,20 +94,20 @@ class InterestingMessage
// send message about newly created transaction group.
/** @var null|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;
}
- $count = $group->transactionJournals->count();
+ $count = $group->transactionJournals->count();
/** @var null|TransactionJournal $journal */
- $journal = $group->transactionJournals->first();
+ $journal = $group->transactionJournals->first();
if (null === $journal) {
return;
}
- $title = $count > 1 ? $group->title : $journal->description;
+ $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]));
@@ -140,7 +140,7 @@ class InterestingMessage
$message = $request->get('message');
/** @var null|Account $account */
- $account = auth()->user()->accounts()->withTrashed()->find($accountId);
+ $account = auth()->user()->accounts()->withTrashed()->find($accountId);
if (null === $account) {
return;
@@ -172,7 +172,7 @@ class InterestingMessage
$message = $request->get('message');
/** @var null|Bill $bill */
- $bill = auth()->user()->bills()->withTrashed()->find($billId);
+ $bill = auth()->user()->bills()->withTrashed()->find($billId);
if (null === $bill) {
return;
@@ -201,7 +201,7 @@ class InterestingMessage
$message = $request->get('message');
/** @var null|Webhook $webhook */
- $webhook = auth()->user()->webhooks()->withTrashed()->find($webhookId);
+ $webhook = auth()->user()->webhooks()->withTrashed()->find($webhookId);
if (null === $webhook) {
return;
@@ -230,8 +230,8 @@ class InterestingMessage
{
// params:
// get parameters from request.
- $code = $request->get('code');
- $message = $request->get('message');
+ $code = $request->get('code');
+ $message = $request->get('message');
/** @var null|TransactionCurrency $currency */
$currency = TransactionCurrency::whereCode($code)->first();
diff --git a/app/Http/Middleware/IsAdmin.php b/app/Http/Middleware/IsAdmin.php
index ab5aee6a5e..c992713911 100644
--- a/app/Http/Middleware/IsAdmin.php
+++ b/app/Http/Middleware/IsAdmin.php
@@ -51,7 +51,7 @@ class IsAdmin
}
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
diff --git a/app/Http/Middleware/IsDemoUser.php b/app/Http/Middleware/IsDemoUser.php
index c26e9ed60f..0cc04ddc18 100644
--- a/app/Http/Middleware/IsDemoUser.php
+++ b/app/Http/Middleware/IsDemoUser.php
@@ -40,7 +40,7 @@ class IsDemoUser
public function handle(Request $request, \Closure $next)
{
/** @var null|User $user */
- $user = $request->user();
+ $user = $request->user();
if (null === $user) {
return $next($request);
}
diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php
index f98960fb68..2a46678f6a 100644
--- a/app/Http/Middleware/Range.php
+++ b/app/Http/Middleware/Range.php
@@ -68,9 +68,9 @@ class Range
$viewRange = '1M';
}
- $today = today(config('app.timezone'));
- $start = app('navigation')->updateStartDate((string)$viewRange, $today);
- $end = app('navigation')->updateEndDate((string)$viewRange, $start);
+ $today = today(config('app.timezone'));
+ $start = app('navigation')->updateStartDate((string)$viewRange, $today);
+ $end = app('navigation')->updateEndDate((string)$viewRange, $start);
app('session')->put('start', $start);
app('session')->put('end', $end);
@@ -94,15 +94,15 @@ class Range
private function configureView(): void
{
// get locale preference:
- $language = app('steam')->getLanguage();
- $locale = app('steam')->getLocale();
+ $language = app('steam')->getLanguage();
+ $locale = app('steam')->getLocale();
\App::setLocale($language);
Carbon::setLocale(substr($locale, 0, 2));
- $localeArray = app('steam')->getLocaleArray($locale);
+ $localeArray = app('steam')->getLocaleArray($locale);
setlocale(LC_TIME, $localeArray);
- $moneyResult = setlocale(LC_MONETARY, $localeArray);
+ $moneyResult = setlocale(LC_MONETARY, $localeArray);
// send error to view, if could not set money format
if (false === $moneyResult) {
@@ -116,7 +116,7 @@ class Range
$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.php
index 0db3a4066d..d5d29d02c6 100644
--- a/app/Http/Middleware/SecureHeaders.php
+++ b/app/Http/Middleware/SecureHeaders.php
@@ -41,13 +41,13 @@ class SecureHeaders
public function handle(Request $request, \Closure $next)
{
// generate and share nonce.
- $nonce = base64_encode(random_bytes(16));
+ $nonce = base64_encode(random_bytes(16));
Vite::useCspNonce($nonce);
app('view')->share('JS_NONCE', $nonce);
- $response = $next($request);
- $trackingScriptSrc = $this->getTrackingScriptSource();
- $csp = [
+ $response = $next($request);
+ $trackingScriptSrc = $this->getTrackingScriptSource();
+ $csp = [
"default-src 'none'",
"object-src 'none'",
sprintf("script-src 'unsafe-eval' 'strict-dynamic' 'self' 'unsafe-inline' 'nonce-%1s' %2s", $nonce, $trackingScriptSrc),
@@ -59,10 +59,10 @@ class SecureHeaders
"manifest-src 'self'",
];
- $route = $request->route();
- $customUrl = '';
- $authGuard = (string)config('firefly.authentication_guard');
- $logoutUrl = (string)config('firefly.custom_logout_url');
+ $route = $request->route();
+ $customUrl = '';
+ $authGuard = (string)config('firefly.authentication_guard');
+ $logoutUrl = (string)config('firefly.custom_logout_url');
if ('remote_user_guard' === $authGuard && '' !== $logoutUrl) {
$customUrl = $logoutUrl;
}
@@ -71,7 +71,7 @@ class SecureHeaders
$csp[] = sprintf("form-action 'self' %s", $customUrl);
}
- $featurePolicies = [
+ $featurePolicies = [
"geolocation 'none'",
"midi 'none'",
// "notifications 'none'",
diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php
index 8f56d1b9b6..7095db6a26 100644
--- a/app/Http/Requests/AccountFormRequest.php
+++ b/app/Http/Requests/AccountFormRequest.php
@@ -120,7 +120,7 @@ class AccountFormRequest extends FormRequest
$rules = Location::requestRules($rules);
/** @var null|Account $account */
- $account = $this->route()->parameter('account');
+ $account = $this->route()->parameter('account');
if (null !== $account) {
// add rules:
$rules['id'] = 'belongsToUser:accounts';
diff --git a/app/Http/Requests/BudgetFormUpdateRequest.php b/app/Http/Requests/BudgetFormUpdateRequest.php
index e60cedf738..3c25e55306 100644
--- a/app/Http/Requests/BudgetFormUpdateRequest.php
+++ b/app/Http/Requests/BudgetFormUpdateRequest.php
@@ -62,7 +62,7 @@ class BudgetFormUpdateRequest extends FormRequest
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name';
/** @var null|Budget $budget */
- $budget = $this->route()->parameter('budget');
+ $budget = $this->route()->parameter('budget');
if (null !== $budget) {
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,'.$budget->id;
diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php
index e71d06804c..e070446503 100644
--- a/app/Http/Requests/CurrencyFormRequest.php
+++ b/app/Http/Requests/CurrencyFormRequest.php
@@ -56,7 +56,7 @@ class CurrencyFormRequest extends FormRequest
public function rules(): array
{
// fixed
- $rules = [
+ $rules = [
'name' => 'required|max:48|min:1|uniqueCurrencyName',
'code' => 'required|min:3|max:51|uniqueCurrencyCode',
'symbol' => 'required|min:1|max:51|uniqueCurrencySymbol',
diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php
index bf95953a35..eaea1fab4d 100644
--- a/app/Http/Requests/JournalLinkRequest.php
+++ b/app/Http/Requests/JournalLinkRequest.php
@@ -66,7 +66,7 @@ class JournalLinkRequest extends FormRequest
$combinations[] = sprintf('%d_inward', $type->id);
$combinations[] = sprintf('%d_outward', $type->id);
}
- $string = implode(',', $combinations);
+ $string = implode(',', $combinations);
// fixed
return [
diff --git a/app/Http/Requests/LinkTypeFormRequest.php b/app/Http/Requests/LinkTypeFormRequest.php
index 8d65dfc666..9bb6e31968 100644
--- a/app/Http/Requests/LinkTypeFormRequest.php
+++ b/app/Http/Requests/LinkTypeFormRequest.php
@@ -45,7 +45,7 @@ class LinkTypeFormRequest extends FormRequest
$idRule = '';
// get parameter link:
- $link = $this->route()->parameter('linkType');
+ $link = $this->route()->parameter('linkType');
if (null !== $link) {
$idRule = 'exists:link_types,id';
diff --git a/app/Http/Requests/ReconciliationStoreRequest.php b/app/Http/Requests/ReconciliationStoreRequest.php
index 70e9c42a15..f02bdb365a 100644
--- a/app/Http/Requests/ReconciliationStoreRequest.php
+++ b/app/Http/Requests/ReconciliationStoreRequest.php
@@ -45,7 +45,7 @@ class ReconciliationStoreRequest extends FormRequest
if (!is_array($transactions)) {
$transactions = [];
}
- $data = [
+ $data = [
'start' => $this->getCarbonDate('start'),
'end' => $this->getCarbonDate('end'),
'start_balance' => $this->convertString('startBalance'),
diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php
index e16cd94a42..c6921aba68 100644
--- a/app/Http/Requests/RecurrenceFormRequest.php
+++ b/app/Http/Requests/RecurrenceFormRequest.php
@@ -52,8 +52,8 @@ class RecurrenceFormRequest extends FormRequest
*/
public function getAll(): array
{
- $repetitionData = $this->parseRepetitionData();
- $return = [
+ $repetitionData = $this->parseRepetitionData();
+ $return = [
'recurrence' => [
'type' => $this->convertString('transaction_type'),
'title' => $this->convertString('title'),
@@ -128,7 +128,7 @@ class RecurrenceFormRequest extends FormRequest
}
// replace category name with a new category:
- $factory = app(CategoryFactory::class);
+ $factory = app(CategoryFactory::class);
$factory->setUser(auth()->user());
/**
@@ -153,9 +153,9 @@ class RecurrenceFormRequest extends FormRequest
*/
public function rules(): array
{
- $today = today(config('app.timezone'));
- $tomorrow = today(config('app.timezone'))->addDay();
- $rules = [
+ $today = today(config('app.timezone'));
+ $tomorrow = today(config('app.timezone'))->addDay();
+ $rules = [
// mandatory info for recurrence.
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
'first_date' => 'required|date|after:'.$today->format('Y-m-d'),
@@ -206,7 +206,7 @@ class RecurrenceFormRequest extends FormRequest
}
// switch on type to expand rules for source and destination accounts:
- $type = strtolower($this->convertString('transaction_type'));
+ $type = strtolower($this->convertString('transaction_type'));
if (strtolower(TransactionType::WITHDRAWAL) === $type) {
$rules['source_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
$rules['destination_name'] = 'between:1,255|nullable';
@@ -263,13 +263,13 @@ class RecurrenceFormRequest extends FormRequest
$accountValidator->setTransactionType($transactionType);
// default values:
- $sourceId = null;
- $destinationId = null;
+ $sourceId = null;
+ $destinationId = null;
// TODO typeOverrule: the account validator may have another opinion the transaction type.
// TODO either use 'withdrawal' or the strtolower() variant, not both.
- $type = $this->convertString('transaction_type');
- $throwError = true;
+ $type = $this->convertString('transaction_type');
+ $throwError = true;
if ('withdrawal' === $type) {
$throwError = false;
$sourceId = (int) $data['source_id'];
@@ -290,7 +290,7 @@ class RecurrenceFormRequest extends FormRequest
}
// validate source account.
- $validSource = $accountValidator->validateSource(['id' => $sourceId]);
+ $validSource = $accountValidator->validateSource(['id' => $sourceId]);
// do something with result:
if (false === $validSource) {
diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php
index 3dd638af6f..0dd6049add 100644
--- a/app/Http/Requests/ReportFormRequest.php
+++ b/app/Http/Requests/ReportFormRequest.php
@@ -137,7 +137,7 @@ class ReportFormRequest extends FormRequest
$range = $this->get('daterange');
$parts = explode(' - ', (string) $range);
if (2 === count($parts)) {
- $string = $parts[1];
+ $string = $parts[1];
// validate as date
// if regex for YYYY-MM-DD:
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
@@ -155,7 +155,7 @@ class ReportFormRequest extends FormRequest
return $date;
}
- $error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
+ $error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
app('log')->error($error);
throw new FireflyException($error, 0);
@@ -175,7 +175,7 @@ class ReportFormRequest extends FormRequest
$range = $this->get('daterange');
$parts = explode(' - ', (string) $range);
if (2 === count($parts)) {
- $string = $parts[0];
+ $string = $parts[0];
// validate as date
// if regex for YYYY-MM-DD:
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
@@ -193,7 +193,7 @@ class ReportFormRequest extends FormRequest
return $date;
}
- $error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
+ $error = sprintf('"%s" is not a valid date range: %s', $range, 'invalid format :(');
app('log')->error($error);
throw new FireflyException($error, 0);
diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php
index e46f9a8e8c..8460775da4 100644
--- a/app/Http/Requests/RuleFormRequest.php
+++ b/app/Http/Requests/RuleFormRequest.php
@@ -86,17 +86,17 @@ class RuleFormRequest extends FormRequest
*/
public function rules(): array
{
- $validTriggers = $this->getTriggers();
- $validActions = array_keys(config('firefly.rule-actions'));
+ $validTriggers = $this->getTriggers();
+ $validActions = array_keys(config('firefly.rule-actions'));
// some actions require text (aka context):
- $contextActions = implode(',', config('firefly.context-rule-actions'));
+ $contextActions = implode(',', config('firefly.context-rule-actions'));
// some triggers require text (aka context):
$contextTriggers = implode(',', $this->getTriggersWithContext());
// initial set of rules:
- $rules = [
+ $rules = [
'title' => 'required|between:1,100|uniqueObjectForUser:rules,title',
'description' => 'between:1,5000|nullable',
'stop_processing' => 'boolean',
@@ -110,7 +110,7 @@ class RuleFormRequest extends FormRequest
];
/** @var null|Rule $rule */
- $rule = $this->route()->parameter('rule');
+ $rule = $this->route()->parameter('rule');
if (null !== $rule) {
$rules['title'] = 'required|between:1,100|uniqueObjectForUser:rules,title,'.$rule->id;
diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php
index c2fd77886e..ea1b5a267f 100644
--- a/app/Http/Requests/TagFormRequest.php
+++ b/app/Http/Requests/TagFormRequest.php
@@ -58,7 +58,7 @@ class TagFormRequest extends FormRequest
*/
public function rules(): array
{
- $idRule = '';
+ $idRule = '';
/** @var null|Tag $tag */
$tag = $this->route()->parameter('tag');
@@ -68,7 +68,7 @@ class TagFormRequest extends FormRequest
$tagRule = 'required|max:1024|min:1|uniqueObjectForUser:tags,tag,'.$tag->id;
}
- $rules = [
+ $rules = [
'tag' => $tagRule,
'id' => $idRule,
'description' => 'max:65536|min:1|nullable',
diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php
index a023d9c0a9..ed9d24c042 100644
--- a/app/Jobs/CreateAutoBudgetLimits.php
+++ b/app/Jobs/CreateAutoBudgetLimits.php
@@ -55,7 +55,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
public function __construct(?Carbon $date)
{
if (null !== $date) {
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
app('log')->debug(sprintf('Created new CreateAutoBudgetLimits("%s")', $this->date->format('Y-m-d')));
@@ -79,7 +79,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
public function setDate(Carbon $date): void
{
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -127,8 +127,8 @@ class CreateAutoBudgetLimits implements ShouldQueue
);
// get date range for budget limit, based on range in auto-budget
- $start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
- $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
+ $start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
+ $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
// find budget limit:
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $start, $end);
@@ -221,7 +221,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
if (null !== $amount) {
app('log')->debug(sprintf('Amount is overruled and will be set to %s', $amount));
}
- $budgetLimit = new BudgetLimit();
+ $budgetLimit = new BudgetLimit();
$budgetLimit->budget()->associate($autoBudget->budget);
$budgetLimit->transactionCurrency()->associate($autoBudget->transactionCurrency);
$budgetLimit->start_date = $start;
@@ -241,8 +241,8 @@ class CreateAutoBudgetLimits implements ShouldQueue
{
app('log')->debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
// current period:
- $start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
- $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
+ $start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
+ $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
// which means previous period:
$previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);
@@ -259,7 +259,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
);
// has budget limit in previous period?
- $budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
+ $budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
if (null === $budgetLimit) {
app('log')->debug('No budget limit exists in previous period, so create one.');
@@ -271,17 +271,17 @@ class CreateAutoBudgetLimits implements ShouldQueue
}
app('log')->debug('Budget limit exists for previous period.');
// if has one, calculate expenses and use that as a base.
- $repository = app(OperationsRepositoryInterface::class);
+ $repository = app(OperationsRepositoryInterface::class);
$repository->setUser($autoBudget->budget->user);
- $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
- $currencyId = $autoBudget->transaction_currency_id;
- $spentAmount = $spent[$currencyId]['sum'] ?? '0';
+ $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
+ $currencyId = $autoBudget->transaction_currency_id;
+ $spentAmount = $spent[$currencyId]['sum'] ?? '0';
app('log')->debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
// if you spent more in previous budget period, than whatever you had previous budget period, the amount resets
// previous budget limit + spent
- $budgetLeft = bcadd($budgetLimit->amount, $spentAmount);
- $totalAmount = $autoBudget->amount;
+ $budgetLeft = bcadd($budgetLimit->amount, $spentAmount);
+ $totalAmount = $autoBudget->amount;
app('log')->debug(sprintf('Total amount left for previous budget period is %s', $budgetLeft));
if (-1 !== bccomp('0', $budgetLeft)) {
@@ -301,12 +301,12 @@ class CreateAutoBudgetLimits implements ShouldQueue
{
app('log')->debug(sprintf('Will now manage rollover for auto budget #%d', $autoBudget->id));
// current period:
- $start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
- $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
+ $start = app('navigation')->startOfPeriod($this->date, $autoBudget->period);
+ $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
// which means previous period:
- $previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);
- $previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);
+ $previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);
+ $previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);
app('log')->debug(
sprintf(
@@ -319,7 +319,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
);
// has budget limit in previous period?
- $budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
+ $budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
if (null === $budgetLimit) {
app('log')->debug('No budget limit exists in previous period, so create one.');
@@ -331,11 +331,11 @@ class CreateAutoBudgetLimits implements ShouldQueue
app('log')->debug('Budget limit exists for previous period.');
// if has one, calculate expenses and use that as a base.
- $repository = app(OperationsRepositoryInterface::class);
+ $repository = app(OperationsRepositoryInterface::class);
$repository->setUser($autoBudget->budget->user);
- $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
- $currencyId = $autoBudget->transaction_currency_id;
- $spentAmount = $spent[$currencyId]['sum'] ?? '0';
+ $spent = $repository->sumExpenses($previousStart, $previousEnd, null, new Collection([$autoBudget->budget]), $autoBudget->transactionCurrency);
+ $currencyId = $autoBudget->transaction_currency_id;
+ $spentAmount = $spent[$currencyId]['sum'] ?? '0';
app('log')->debug(sprintf('Spent in previous budget period (%s-%s) is %s', $previousStart->format('Y-m-d'), $previousEnd->format('Y-m-d'), $spentAmount));
// what you spent in previous period PLUS the amount for the current period,
diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php
index 74eafbaf96..3b0a6371a9 100644
--- a/app/Jobs/CreateRecurringTransactions.php
+++ b/app/Jobs/CreateRecurringTransactions.php
@@ -69,12 +69,12 @@ class CreateRecurringTransactions implements ShouldQueue
*/
public function __construct(?Carbon $date)
{
- $newDate = new Carbon();
+ $newDate = new Carbon();
$newDate->startOfDay();
- $this->date = $newDate;
+ $this->date = $newDate;
if (null !== $date) {
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -118,7 +118,7 @@ class CreateRecurringTransactions implements ShouldQueue
app('log')->debug(sprintf('Count of collection is %d', $count));
// filter recurrences:
- $filtered = $this->filterRecurrences($this->recurrences);
+ $filtered = $this->filterRecurrences($this->recurrences);
app('log')->debug(sprintf('Left after filtering is %d', $filtered->count()));
/** @var Recurrence $recurrence */
@@ -134,7 +134,7 @@ class CreateRecurringTransactions implements ShouldQueue
app('preferences')->setForUser($recurrence->user, 'lastActivity', microtime());
app('log')->debug(sprintf('Now at recurrence #%d of user #%d', $recurrence->id, $recurrence->user_id));
- $createdReps = $this->handleRepetitions($recurrence);
+ $createdReps = $this->handleRepetitions($recurrence);
app('log')->debug(sprintf('Done with recurrence #%d', $recurrence->id));
$result[$recurrence->user_id] = $result[$recurrence->user_id]->merge($createdReps);
++$this->executed;
@@ -154,7 +154,7 @@ class CreateRecurringTransactions implements ShouldQueue
public function setDate(Carbon $date): void
{
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -313,12 +313,12 @@ class CreateRecurringTransactions implements ShouldQueue
// add two days to $this->date, so we always include the weekend.
$includeWeekend = clone $this->date;
$includeWeekend->addDays(2);
- $occurrences = $this->repository->getOccurrencesInRange($repetition, $recurrence->first_date, $includeWeekend);
+ $occurrences = $this->repository->getOccurrencesInRange($repetition, $recurrence->first_date, $includeWeekend);
unset($includeWeekend);
- $result = $this->handleOccurrences($recurrence, $repetition, $occurrences);
- $collection = $collection->merge($result);
+ $result = $this->handleOccurrences($recurrence, $repetition, $occurrences);
+ $collection = $collection->merge($result);
}
return $collection;
@@ -358,7 +358,7 @@ class CreateRecurringTransactions implements ShouldQueue
app('log')->debug(sprintf('%s IS today (%s)', $date->format('Y-m-d'), $this->date->format('Y-m-d')));
// count created journals on THIS day.
- $journalCount = $this->repository->getJournalCount($recurrence, $date, $date);
+ $journalCount = $this->repository->getJournalCount($recurrence, $date, $date);
if ($journalCount > 0 && false === $this->force) {
app('log')->info(sprintf('Already created %d journal(s) for date %s', $journalCount, $date->format('Y-m-d')));
@@ -376,8 +376,8 @@ class CreateRecurringTransactions implements ShouldQueue
}
// create transaction array and send to factory.
- $groupTitle = null;
- $count = $recurrence->recurrenceTransactions->count();
+ $groupTitle = null;
+ $count = $recurrence->recurrenceTransactions->count();
if ($count > 1) {
/** @var RecurrenceTransaction $first */
$first = $recurrence->recurrenceTransactions()->first();
@@ -389,14 +389,14 @@ class CreateRecurringTransactions implements ShouldQueue
return null;
}
- $array = [
+ $array = [
'user' => $recurrence->user_id,
'group_title' => $groupTitle,
'transactions' => $this->getTransactionData($recurrence, $repetition, $date),
];
/** @var TransactionGroup $group */
- $group = $this->groupRepository->store($array);
+ $group = $this->groupRepository->store($array);
++$this->created;
app('log')->info(sprintf('Created new transaction group #%d', $group->id));
@@ -422,8 +422,8 @@ class CreateRecurringTransactions implements ShouldQueue
$transactions = $recurrence->recurrenceTransactions()->get();
/** @var RecurrenceTransaction $first */
- $first = $transactions->first();
- $return = [];
+ $first = $transactions->first();
+ $return = [];
/** @var RecurrenceTransaction $transaction */
foreach ($transactions as $index => $transaction) {
diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.php
index 524faaf83f..4519c4d509 100644
--- a/app/Jobs/DownloadExchangeRates.php
+++ b/app/Jobs/DownloadExchangeRates.php
@@ -63,11 +63,11 @@ class DownloadExchangeRates implements ShouldQueue
// get all users:
/** @var UserRepositoryInterface $userRepository */
- $userRepository = app(UserRepositoryInterface::class);
- $this->users = $userRepository->all();
+ $userRepository = app(UserRepositoryInterface::class);
+ $this->users = $userRepository->all();
if (null !== $date) {
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
app('log')->debug(sprintf('Created new DownloadExchangeRates("%s")', $this->date->format('Y-m-d')));
@@ -90,7 +90,7 @@ class DownloadExchangeRates implements ShouldQueue
public function setDate(Carbon $date): void
{
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -101,9 +101,9 @@ class DownloadExchangeRates implements ShouldQueue
private function downloadRates(TransactionCurrency $currency): void
{
app('log')->debug(sprintf('Now downloading new exchange rates for currency %s.', $currency->code));
- $base = sprintf('%s/%s/%s', (string)config('cer.url'), $this->date->year, $this->date->isoWeek);
- $client = new Client();
- $url = sprintf('%s/%s.json', $base, $currency->code);
+ $base = sprintf('%s/%s/%s', (string)config('cer.url'), $this->date->year, $this->date->isoWeek);
+ $client = new Client();
+ $url = sprintf('%s/%s.json', $base, $currency->code);
try {
$res = $client->get($url);
@@ -118,14 +118,14 @@ class DownloadExchangeRates implements ShouldQueue
return;
}
- $body = (string)$res->getBody();
- $json = json_decode($body, true);
+ $body = (string)$res->getBody();
+ $json = json_decode($body, true);
if (false === $json || null === $json) {
app('log')->warning(sprintf('Trying to grab "%s" resulted in bad JSON.', $url));
return;
}
- $date = Carbon::createFromFormat('Y-m-d', $json['date'], config('app.timezone'));
+ $date = Carbon::createFromFormat('Y-m-d', $json['date'], config('app.timezone'));
if (false === $date) {
return;
}
@@ -155,7 +155,7 @@ class DownloadExchangeRates implements ShouldQueue
return $this->active[$code];
}
// find it in the database.
- $currency = $this->repository->findByCode($code);
+ $currency = $this->repository->findByCode($code);
if (null === $currency) {
app('log')->debug(sprintf('Did not find currency %s.', $code));
$this->active[$code] = null;
diff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.php
index a127da6888..970ef96448 100644
--- a/app/Jobs/WarnAboutBills.php
+++ b/app/Jobs/WarnAboutBills.php
@@ -51,12 +51,12 @@ class WarnAboutBills implements ShouldQueue
*/
public function __construct(?Carbon $date)
{
- $newDate = new Carbon();
+ $newDate = new Carbon();
$newDate->startOfDay();
- $this->date = $newDate;
+ $this->date = $newDate;
if (null !== $date) {
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
@@ -94,7 +94,7 @@ class WarnAboutBills implements ShouldQueue
public function setDate(Carbon $date): void
{
- $newDate = clone $date;
+ $newDate = clone $date;
$newDate->startOfDay();
$this->date = $newDate;
}
diff --git a/app/Models/Account.php b/app/Models/Account.php
index b1a7a7b3b0..c6ed9908e7 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -121,7 +121,7 @@ class Account extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'user_id' => 'integer',
@@ -130,9 +130,9 @@ class Account extends Model
'encrypted' => 'boolean',
];
- protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
+ protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];
- protected $hidden = ['encrypted'];
+ protected $hidden = ['encrypted'];
private bool $joinedAccountTypes = false;
/**
@@ -146,10 +146,10 @@ class Account extends Model
$accountId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Account $account */
- $account = $user->accounts()->with(['accountType'])->find($accountId);
+ $account = $user->accounts()->with(['accountType'])->find($accountId);
if (null !== $account) {
return $account;
}
@@ -240,7 +240,7 @@ class Account extends Model
public function setVirtualBalanceAttribute(mixed $value): void
{
- $value = (string)$value;
+ $value = (string)$value;
if ('' === $value) {
$value = null;
}
diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php
index 54b7b93f8b..a3c37ed271 100644
--- a/app/Models/AccountMeta.php
+++ b/app/Models/AccountMeta.php
@@ -58,7 +58,7 @@ class AccountMeta extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
@@ -66,7 +66,7 @@ class AccountMeta extends Model
protected $fillable = ['account_id', 'name', 'data'];
/** @var string The table to store the data in */
- protected $table = 'account_meta';
+ protected $table = 'account_meta';
public function account(): BelongsTo
{
diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php
index 2ccfe765b9..c2a942460a 100644
--- a/app/Models/AccountType.php
+++ b/app/Models/AccountType.php
@@ -71,12 +71,12 @@ class AccountType extends Model
public const string REVENUE = 'Revenue account';
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
- protected $fillable = ['type'];
+ protected $fillable = ['type'];
public function accounts(): HasMany
{
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index d4493d324c..e2ef680150 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -96,7 +96,7 @@ class Attachment extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -116,10 +116,10 @@ class Attachment extends Model
$attachmentId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Attachment $attachment */
- $attachment = $user->attachments()->find($attachmentId);
+ $attachment = $user->attachments()->find($attachmentId);
if (null !== $attachment) {
return $attachment;
}
diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php
index cd95c02856..ba274a2f32 100644
--- a/app/Models/AutoBudget.php
+++ b/app/Models/AutoBudget.php
@@ -74,7 +74,7 @@ class AutoBudget extends Model
public const int AUTO_BUDGET_ADJUSTED = 3;
public const int AUTO_BUDGET_RESET = 1;
public const int AUTO_BUDGET_ROLLOVER = 2;
- protected $fillable = ['budget_id', 'amount', 'period'];
+ protected $fillable = ['budget_id', 'amount', 'period'];
public function budget(): BelongsTo
{
diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php
index 939f054342..8a3d8c7e91 100644
--- a/app/Models/AvailableBudget.php
+++ b/app/Models/AvailableBudget.php
@@ -79,7 +79,7 @@ class AvailableBudget extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -101,10 +101,10 @@ class AvailableBudget extends Model
$availableBudgetId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|AvailableBudget $availableBudget */
- $availableBudget = $user->availableBudgets()->find($availableBudgetId);
+ $availableBudget = $user->availableBudgets()->find($availableBudgetId);
if (null !== $availableBudget) {
return $availableBudget;
}
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 10e5ff1c18..5b7e65ce61 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -113,7 +113,7 @@ class Bill extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -128,7 +128,7 @@ class Bill extends Model
];
protected $fillable
- = [
+ = [
'name',
'match',
'amount_min',
@@ -158,10 +158,10 @@ class Bill extends Model
$billId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Bill $bill */
- $bill = $user->bills()->find($billId);
+ $bill = $user->bills()->find($billId);
if (null !== $bill) {
return $bill;
}
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index 62155710b8..3c13dba221 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -96,7 +96,7 @@ class Budget extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -106,7 +106,7 @@ class Budget extends Model
protected $fillable = ['user_id', 'name', 'active', 'order', 'user_group_id'];
- protected $hidden = ['encrypted'];
+ protected $hidden = ['encrypted'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
@@ -119,10 +119,10 @@ class Budget extends Model
$budgetId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Budget $budget */
- $budget = $user->budgets()->find($budgetId);
+ $budget = $user->budgets()->find($budgetId);
if (null !== $budget) {
return $budget;
}
diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php
index 9ffe1acc30..58bc881614 100644
--- a/app/Models/BudgetLimit.php
+++ b/app/Models/BudgetLimit.php
@@ -73,7 +73,7 @@ class BudgetLimit extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'start_date' => 'date',
@@ -81,7 +81,7 @@ class BudgetLimit extends Model
'auto_budget' => 'boolean',
];
protected $dispatchesEvents
- = [
+ = [
'created' => Created::class,
'updated' => Updated::class,
'deleted' => Deleted::class,
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 905d53c484..007d95d0f5 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -85,7 +85,7 @@ class Category extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -94,7 +94,7 @@ class Category extends Model
protected $fillable = ['user_id', 'user_group_id', 'name'];
- protected $hidden = ['encrypted'];
+ protected $hidden = ['encrypted'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
@@ -107,10 +107,10 @@ class Category extends Model
$categoryId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Category $category */
- $category = $user->categories()->find($categoryId);
+ $category = $user->categories()->find($categoryId);
if (null !== $category) {
return $category;
}
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index bbb5d17225..9d07d927f0 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -61,7 +61,7 @@ class Configuration extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
diff --git a/app/Models/InvitedUser.php b/app/Models/InvitedUser.php
index 124a4e2528..2ef0a11f7b 100644
--- a/app/Models/InvitedUser.php
+++ b/app/Models/InvitedUser.php
@@ -84,7 +84,7 @@ class InvitedUser extends Model
$attemptId = (int)$value;
/** @var null|InvitedUser $attempt */
- $attempt = self::find($attemptId);
+ $attempt = self::find($attemptId);
if (null !== $attempt) {
return $attempt;
}
diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php
index 6a5c80077f..eb3f5f9f15 100644
--- a/app/Models/LinkType.php
+++ b/app/Models/LinkType.php
@@ -71,7 +71,7 @@ class LinkType extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
diff --git a/app/Models/Location.php b/app/Models/Location.php
index c6634cad71..885e5449de 100644
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -70,7 +70,7 @@ class Location extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
diff --git a/app/Models/Note.php b/app/Models/Note.php
index 9a0699046a..d1fb218940 100644
--- a/app/Models/Note.php
+++ b/app/Models/Note.php
@@ -68,7 +68,7 @@ class Note extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
diff --git a/app/Models/ObjectGroup.php b/app/Models/ObjectGroup.php
index 4f89dcb12f..bd5d2ba832 100644
--- a/app/Models/ObjectGroup.php
+++ b/app/Models/ObjectGroup.php
@@ -97,7 +97,7 @@ class ObjectGroup extends Model
$objectGroupId = (int)$value;
/** @var null|ObjectGroup $objectGroup */
- $objectGroup = self::where('object_groups.id', $objectGroupId)
+ $objectGroup = self::where('object_groups.id', $objectGroupId)
->where('object_groups.user_id', auth()->user()->id)->first()
;
if (null !== $objectGroup) {
diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php
index 7d07479778..0ae5b7432d 100644
--- a/app/Models/PiggyBank.php
+++ b/app/Models/PiggyBank.php
@@ -91,7 +91,7 @@ class PiggyBank extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -104,7 +104,7 @@ class PiggyBank extends Model
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate', 'active'];
- protected $hidden = ['targetamount_encrypted', 'encrypted'];
+ protected $hidden = ['targetamount_encrypted', 'encrypted'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php
index f97a1c11fb..0fc4268c03 100644
--- a/app/Models/PiggyBankEvent.php
+++ b/app/Models/PiggyBankEvent.php
@@ -62,7 +62,7 @@ class PiggyBankEvent extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'date' => 'date',
@@ -70,7 +70,7 @@ class PiggyBankEvent extends Model
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
- protected $hidden = ['amount_encrypted'];
+ protected $hidden = ['amount_encrypted'];
public function piggyBank(): BelongsTo
{
diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php
index 1c11f8d264..5ef34f96ad 100644
--- a/app/Models/PiggyBankRepetition.php
+++ b/app/Models/PiggyBankRepetition.php
@@ -63,7 +63,7 @@ class PiggyBankRepetition extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'startdate' => 'date',
diff --git a/app/Models/Preference.php b/app/Models/Preference.php
index e5cfaf1a02..82758bf0b8 100644
--- a/app/Models/Preference.php
+++ b/app/Models/Preference.php
@@ -62,7 +62,7 @@ class Preference extends Model
use ReturnsIntegerUserIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'data' => 'array',
@@ -79,7 +79,7 @@ class Preference extends Model
{
if (auth()->check()) {
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Preference $preference */
$preference = $user->preferences()->where('name', $value)->first();
@@ -89,7 +89,7 @@ class Preference extends Model
if (null !== $preference) {
return $preference;
}
- $default = config('firefly.default_preferences');
+ $default = config('firefly.default_preferences');
if (array_key_exists($value, $default)) {
$preference = new self();
$preference->name = $value;
diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php
index f5864f7071..e6a1d8fed1 100644
--- a/app/Models/Recurrence.php
+++ b/app/Models/Recurrence.php
@@ -103,7 +103,7 @@ class Recurrence extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -119,7 +119,7 @@ class Recurrence extends Model
];
protected $fillable
- = ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active'];
+ = ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active'];
/** @var string The table to store the data in */
protected $table = 'recurrences';
@@ -135,10 +135,10 @@ class Recurrence extends Model
$recurrenceId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Recurrence $recurrence */
- $recurrence = $user->recurrences()->find($recurrenceId);
+ $recurrence = $user->recurrences()->find($recurrenceId);
if (null !== $recurrence) {
return $recurrence;
}
diff --git a/app/Models/RecurrenceMeta.php b/app/Models/RecurrenceMeta.php
index d74db3261d..d3d34abf10 100644
--- a/app/Models/RecurrenceMeta.php
+++ b/app/Models/RecurrenceMeta.php
@@ -66,7 +66,7 @@ class RecurrenceMeta extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -77,7 +77,7 @@ class RecurrenceMeta extends Model
protected $fillable = ['recurrence_id', 'name', 'value'];
/** @var string The table to store the data in */
- protected $table = 'recurrences_meta';
+ protected $table = 'recurrences_meta';
public function recurrence(): BelongsTo
{
diff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.php
index dfbaf72be3..c63a456434 100644
--- a/app/Models/RecurrenceRepetition.php
+++ b/app/Models/RecurrenceRepetition.php
@@ -75,7 +75,7 @@ class RecurrenceRepetition extends Model
public const int WEEKEND_TO_MONDAY = 4;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -85,10 +85,10 @@ class RecurrenceRepetition extends Model
'weekend' => 'int',
];
- protected $fillable = ['recurrence_id', 'weekend', 'repetition_type', 'repetition_moment', 'repetition_skip'];
+ protected $fillable = ['recurrence_id', 'weekend', 'repetition_type', 'repetition_moment', 'repetition_skip'];
/** @var string The table to store the data in */
- protected $table = 'recurrences_repetitions';
+ protected $table = 'recurrences_repetitions';
public function recurrence(): BelongsTo
{
diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.php
index 044fbc34ef..0d4364e8c7 100644
--- a/app/Models/RecurrenceTransaction.php
+++ b/app/Models/RecurrenceTransaction.php
@@ -90,7 +90,7 @@ class RecurrenceTransaction extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -100,7 +100,7 @@ class RecurrenceTransaction extends Model
];
protected $fillable
- = [
+ = [
'recurrence_id',
'transaction_currency_id',
'foreign_currency_id',
diff --git a/app/Models/RecurrenceTransactionMeta.php b/app/Models/RecurrenceTransactionMeta.php
index 4500f71d05..6bb4eea372 100644
--- a/app/Models/RecurrenceTransactionMeta.php
+++ b/app/Models/RecurrenceTransactionMeta.php
@@ -66,7 +66,7 @@ class RecurrenceTransactionMeta extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -77,7 +77,7 @@ class RecurrenceTransactionMeta extends Model
protected $fillable = ['rt_id', 'name', 'value'];
/** @var string The table to store the data in */
- protected $table = 'rt_meta';
+ protected $table = 'rt_meta';
public function recurrenceTransaction(): BelongsTo
{
diff --git a/app/Models/Role.php b/app/Models/Role.php
index eee321ec09..39a6216f1f 100644
--- a/app/Models/Role.php
+++ b/app/Models/Role.php
@@ -61,7 +61,7 @@ class Role extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index c154383062..befb9640b1 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -94,7 +94,7 @@ class Rule extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -118,10 +118,10 @@ class Rule extends Model
$ruleId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Rule $rule */
- $rule = $user->rules()->find($ruleId);
+ $rule = $user->rules()->find($ruleId);
if (null !== $rule) {
return $rule;
}
diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.php
index 0750c47f14..a8756a5d50 100644
--- a/app/Models/RuleAction.php
+++ b/app/Models/RuleAction.php
@@ -65,7 +65,7 @@ class RuleAction extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'active' => 'boolean',
diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php
index 74ba367200..a363e72919 100644
--- a/app/Models/RuleGroup.php
+++ b/app/Models/RuleGroup.php
@@ -84,7 +84,7 @@ class RuleGroup extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -106,10 +106,10 @@ class RuleGroup extends Model
$ruleGroupId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|RuleGroup $ruleGroup */
- $ruleGroup = $user->ruleGroups()->find($ruleGroupId);
+ $ruleGroup = $user->ruleGroups()->find($ruleGroupId);
if (null !== $ruleGroup) {
return $ruleGroup;
}
diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.php
index cc88693cc5..6d14358ebd 100644
--- a/app/Models/RuleTrigger.php
+++ b/app/Models/RuleTrigger.php
@@ -65,7 +65,7 @@ class RuleTrigger extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'active' => 'boolean',
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index e851b2e862..c5fa90814f 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -92,7 +92,7 @@ class Tag extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -104,7 +104,7 @@ class Tag extends Model
protected $fillable = ['user_id', 'user_group_id', 'tag', 'date', 'description', 'tagMode'];
- protected $hidden = ['zoomLevel', 'latitude', 'longitude'];
+ protected $hidden = ['zoomLevel', 'latitude', 'longitude'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
@@ -117,10 +117,10 @@ class Tag extends Model
$tagId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Tag $tag */
- $tag = $user->tags()->find($tagId);
+ $tag = $user->tags()->find($tagId);
if (null !== $tag) {
return $tag;
}
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index 70eb2e187b..6d955d77ec 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -98,7 +98,7 @@ class Transaction extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -109,7 +109,7 @@ class Transaction extends Model
];
protected $fillable
- = [
+ = [
'account_id',
'transaction_journal_id',
'description',
diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php
index b59bc18acb..8d0c58d319 100644
--- a/app/Models/TransactionCurrency.php
+++ b/app/Models/TransactionCurrency.php
@@ -88,7 +88,7 @@ class TransactionCurrency extends Model
public ?bool $userGroupDefault;
public ?bool $userGroupEnabled;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php
index fe63cc8a08..6922513c49 100644
--- a/app/Models/TransactionGroup.php
+++ b/app/Models/TransactionGroup.php
@@ -77,7 +77,7 @@ class TransactionGroup extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'id' => 'integer',
'created_at' => 'datetime',
'updated_at' => 'datetime',
@@ -100,11 +100,11 @@ class TransactionGroup extends Model
$groupId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
app('log')->debug(sprintf('User authenticated as %s', $user->email));
/** @var null|TransactionGroup $group */
- $group = $user->transactionGroups()
+ $group = $user->transactionGroups()
->with(['transactionJournals', 'transactionJournals.transactions'])
->where('transaction_groups.id', $groupId)->first(['transaction_groups.*'])
;
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 315bd11f4b..fd26fbcc05 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -137,7 +137,7 @@ class TransactionJournal extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -152,7 +152,7 @@ class TransactionJournal extends Model
];
protected $fillable
- = [
+ = [
'user_id',
'user_group_id',
'transaction_type_id',
@@ -178,10 +178,10 @@ class TransactionJournal extends Model
$journalId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|TransactionJournal $journal */
- $journal = $user->transactionJournals()->where('transaction_journals.id', $journalId)->first(['transaction_journals.*']);
+ $journal = $user->transactionJournals()->where('transaction_journals.id', $journalId)->first(['transaction_journals.*']);
if (null !== $journal) {
return $journal;
}
diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php
index f284fbfb44..01923e8318 100644
--- a/app/Models/TransactionJournalLink.php
+++ b/app/Models/TransactionJournalLink.php
@@ -70,7 +70,7 @@ class TransactionJournalLink extends Model
use ReturnsIntegerIdTrait;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index 378e81e3e1..767eccd314 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -68,7 +68,7 @@ class TransactionJournalMeta extends Model
use SoftDeletes;
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -77,7 +77,7 @@ class TransactionJournalMeta extends Model
protected $fillable = ['transaction_journal_id', 'name', 'data', 'hash'];
/** @var string The table to store the data in */
- protected $table = 'journal_meta';
+ protected $table = 'journal_meta';
/**
* @param mixed $value
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index 14d1c9d5a1..e888294824 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -72,12 +72,12 @@ class TransactionType extends Model
public const string WITHDRAWAL = 'Withdrawal';
protected $casts
- = [
+ = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
];
- protected $fillable = ['type'];
+ protected $fillable = ['type'];
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).
diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php
index 614767c7d2..34cf18f84e 100644
--- a/app/Models/UserGroup.php
+++ b/app/Models/UserGroup.php
@@ -111,16 +111,16 @@ class UserGroup extends Model
$userGroupId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|UserGroup $userGroup */
- $userGroup = self::find($userGroupId);
+ $userGroup = self::find($userGroupId);
if (null === $userGroup) {
throw new NotFoundHttpException();
}
// need at least ready only to be aware of the user group's existence,
// but owner/full role (in the group) or global owner role may overrule this.
- $access = $user->hasRoleInGroupOrOwner($userGroup, UserRoleEnum::READ_ONLY) || $user->hasRole('owner');
+ $access = $user->hasRoleInGroupOrOwner($userGroup, UserRoleEnum::READ_ONLY) || $user->hasRole('owner');
if ($access) {
return $userGroup;
}
diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php
index 19e344b05d..e33059a0d4 100644
--- a/app/Models/Webhook.php
+++ b/app/Models/Webhook.php
@@ -180,10 +180,10 @@ class Webhook extends Model
$webhookId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|Webhook $webhook */
- $webhook = $user->webhooks()->find($webhookId);
+ $webhook = $user->webhooks()->find($webhookId);
if (null !== $webhook) {
return $webhook;
}
diff --git a/app/Models/WebhookAttempt.php b/app/Models/WebhookAttempt.php
index 46194902db..76d1a110b4 100644
--- a/app/Models/WebhookAttempt.php
+++ b/app/Models/WebhookAttempt.php
@@ -80,10 +80,10 @@ class WebhookAttempt extends Model
$attemptId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|WebhookAttempt $attempt */
- $attempt = self::find($attemptId);
+ $attempt = self::find($attemptId);
if (null !== $attempt && $attempt->webhookMessage->webhook->user_id === $user->id) {
return $attempt;
}
diff --git a/app/Models/WebhookMessage.php b/app/Models/WebhookMessage.php
index cc9d9e6da2..8b27dde551 100644
--- a/app/Models/WebhookMessage.php
+++ b/app/Models/WebhookMessage.php
@@ -95,10 +95,10 @@ class WebhookMessage extends Model
$messageId = (int)$value;
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
/** @var null|WebhookMessage $message */
- $message = self::find($messageId);
+ $message = self::find($messageId);
if (null !== $message && $message->webhook->user_id === $user->id) {
return $message;
}
diff --git a/app/Notifications/User/BillReminder.php b/app/Notifications/User/BillReminder.php
index abadbbc6cb..36d93b84e6 100644
--- a/app/Notifications/User/BillReminder.php
+++ b/app/Notifications/User/BillReminder.php
@@ -105,8 +105,8 @@ class BillReminder extends Notification
if (0 === $this->diff) {
$message = (string)trans(sprintf('email.bill_warning_subject_now_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
}
- $bill = $this->bill;
- $url = route('bills.show', [$bill->id]);
+ $bill = $this->bill;
+ $url = route('bills.show', [$bill->id]);
return (new SlackMessage())
->warning()
diff --git a/app/Notifications/User/RuleActionFailed.php b/app/Notifications/User/RuleActionFailed.php
index 067fe79fef..5c704c5e1e 100644
--- a/app/Notifications/User/RuleActionFailed.php
+++ b/app/Notifications/User/RuleActionFailed.php
@@ -49,11 +49,11 @@ class RuleActionFailed extends Notification
public function __construct(array $params)
{
[$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink] = $params;
- $this->message = $mainMessage;
- $this->groupTitle = $groupTitle;
- $this->groupLink = $groupLink;
- $this->ruleTitle = $ruleTitle;
- $this->ruleLink = $ruleLink;
+ $this->message = $mainMessage;
+ $this->groupTitle = $groupTitle;
+ $this->groupLink = $groupLink;
+ $this->ruleTitle = $ruleTitle;
+ $this->ruleLink = $ruleLink;
}
/**
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index f13e19afd8..4382229f44 100644
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -32,7 +32,7 @@ use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
public const string HOME = '/';
- protected $namespace = '';
+ protected $namespace = '';
/**
* Define the routes for the application.
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index c521d0c3cb..90ea3ceaf5 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -136,7 +136,7 @@ class AccountRepository implements AccountRepositoryInterface
public function findByName(string $name, array $types): ?Account
{
- $query = $this->user->accounts();
+ $query = $this->user->accounts();
if (0 !== count($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
@@ -203,7 +203,7 @@ class AccountRepository implements AccountRepositoryInterface
public function getAttachments(Account $account): Collection
{
- $set = $account->attachments()->get();
+ $set = $account->attachments()->get();
/** @var \Storage $disk */
$disk = \Storage::disk('upload');
@@ -225,7 +225,7 @@ class AccountRepository implements AccountRepositoryInterface
public function getCashAccount(): Account
{
/** @var AccountType $type */
- $type = AccountType::where('type', AccountType::CASH)->first();
+ $type = AccountType::where('type', AccountType::CASH)->first();
/** @var AccountFactory $factory */
$factory = app(AccountFactory::class);
@@ -291,7 +291,7 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function getOpeningBalanceAmount(Account $account): ?string
{
- $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
+ $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transactions.account_id', $account->id)
->transactionTypes([TransactionType::OPENING_BALANCE, TransactionType::LIABILITY_CREDIT])
->first(['transaction_journals.*'])
@@ -352,10 +352,10 @@ class AccountRepository implements AccountRepositoryInterface
$name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]);
/** @var AccountType $type */
- $type = AccountType::where('type', AccountType::RECONCILIATION)->first();
+ $type = AccountType::where('type', AccountType::RECONCILIATION)->first();
/** @var null|Account $current */
- $current = $this->user->accounts()->where('account_type_id', $type->id)
+ $current = $this->user->accounts()->where('account_type_id', $type->id)
->where('name', $name)
->first()
;
@@ -364,7 +364,7 @@ class AccountRepository implements AccountRepositoryInterface
return $current;
}
- $data = [
+ $data = [
'account_type_id' => null,
'account_type_name' => AccountType::RECONCILIATION,
'active' => true,
@@ -374,7 +374,7 @@ class AccountRepository implements AccountRepositoryInterface
];
/** @var AccountFactory $factory */
- $factory = app(AccountFactory::class);
+ $factory = app(AccountFactory::class);
$factory->setUser($account->user);
return $factory->create($data);
@@ -382,8 +382,8 @@ class AccountRepository implements AccountRepositoryInterface
public function getAccountCurrency(Account $account): ?TransactionCurrency
{
- $type = $account->accountType->type;
- $list = config('firefly.valid_currency_account_types');
+ $type = $account->accountType->type;
+ $list = config('firefly.valid_currency_account_types');
// return null if not in this list.
if (!in_array($type, $list, true)) {
@@ -447,7 +447,7 @@ class AccountRepository implements AccountRepositoryInterface
public function maxOrder(string $type): int
{
- $sets = [
+ $sets = [
AccountType::ASSET => [AccountType::DEFAULT, AccountType::ASSET],
AccountType::EXPENSE => [AccountType::EXPENSE, AccountType::BENEFICIARY],
AccountType::REVENUE => [AccountType::REVENUE],
@@ -463,7 +463,7 @@ class AccountRepository implements AccountRepositoryInterface
}
$specials = [AccountType::CASH, AccountType::INITIAL_BALANCE, AccountType::IMPORT, AccountType::RECONCILIATION];
- $order = (int)$this->getAccountsByType($specials)->max('order');
+ $order = (int)$this->getAccountsByType($specials)->max('order');
app('log')->debug(sprintf('Return max order of "%s" set (specials!): %d', $type, $order));
return $order;
diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php
index 47cd075aca..a4d3201ad9 100644
--- a/app/Repositories/Account/AccountTasker.php
+++ b/app/Repositories/Account/AccountTasker.php
@@ -45,25 +45,25 @@ class AccountTasker implements AccountTaskerInterface
*/
public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array
{
- $yesterday = clone $start;
+ $yesterday = clone $start;
$yesterday->subDay();
- $startSet = app('steam')->balancesByAccounts($accounts, $yesterday);
- $endSet = app('steam')->balancesByAccounts($accounts, $end);
+ $startSet = app('steam')->balancesByAccounts($accounts, $yesterday);
+ $endSet = app('steam')->balancesByAccounts($accounts, $end);
app('log')->debug('Start of accountreport');
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
- $return = [
+ $return = [
'accounts' => [],
'sums' => [],
];
/** @var Account $account */
foreach ($accounts as $account) {
- $id = $account->id;
- $currency = $repository->getAccountCurrency($account) ?? $defaultCurrency;
+ $id = $account->id;
+ $currency = $repository->getAccountCurrency($account) ?? $defaultCurrency;
$return['sums'][$currency->id] ??= [
'start' => '0',
'end' => '0',
@@ -74,7 +74,7 @@ class AccountTasker implements AccountTaskerInterface
'currency_name' => $currency->name,
'currency_decimal_places' => $currency->decimal_places,
];
- $entry = [
+ $entry = [
'name' => $account->name,
'id' => $account->id,
'currency_id' => $currency->id,
@@ -85,9 +85,9 @@ class AccountTasker implements AccountTaskerInterface
];
// get first journal date:
- $first = $repository->oldestJournal($account);
- $entry['start_balance'] = $startSet[$account->id] ?? '0';
- $entry['end_balance'] = $endSet[$account->id] ?? '0';
+ $first = $repository->oldestJournal($account);
+ $entry['start_balance'] = $startSet[$account->id] ?? '0';
+ $entry['end_balance'] = $endSet[$account->id] ?? '0';
// first journal exists, and is on start, then this is the actual opening balance:
if (null !== $first && $first->date->isSameDay($start) && TransactionType::OPENING_BALANCE === $first->transactionType->type) {
@@ -122,13 +122,13 @@ class AccountTasker implements AccountTaskerInterface
$collector->setSourceAccounts($accounts)->setRange($start, $end);
$collector->excludeDestinationAccounts($accounts);
$collector->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])->withAccountInformation();
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
- $report = $this->groupExpenseByDestination($journals);
+ $report = $this->groupExpenseByDestination($journals);
// sort the result
// Obtain a list of columns
- $sum = [];
+ $sum = [];
foreach ($report['accounts'] as $accountId => $row) {
$sum[$accountId] = (float)$row['sum']; // intentional float
}
@@ -152,11 +152,11 @@ class AccountTasker implements AccountTaskerInterface
$collector->setDestinationAccounts($accounts)->setRange($start, $end);
$collector->excludeSourceAccounts($accounts);
$collector->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])->withAccountInformation();
- $report = $this->groupIncomeBySource($collector->getExtractedJournals());
+ $report = $this->groupIncomeBySource($collector->getExtractedJournals());
// sort the result
// Obtain a list of columns
- $sum = [];
+ $sum = [];
foreach ($report['accounts'] as $accountId => $row) {
$sum[$accountId] = (float)$row['sum']; // intentional float
}
@@ -181,9 +181,9 @@ class AccountTasker implements AccountTaskerInterface
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
/** @var CurrencyRepositoryInterface $currencyRepos */
- $currencyRepos = app(CurrencyRepositoryInterface::class);
- $currencies = [$defaultCurrency->id => $defaultCurrency];
- $report = [
+ $currencyRepos = app(CurrencyRepositoryInterface::class);
+ $currencies = [$defaultCurrency->id => $defaultCurrency];
+ $report = [
'accounts' => [],
'sums' => [],
];
@@ -193,8 +193,8 @@ class AccountTasker implements AccountTaskerInterface
$sourceId = (int)$journal['destination_account_id'];
$currencyId = (int)$journal['currency_id'];
$key = sprintf('%s-%s', $sourceId, $currencyId);
- $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
- $report['accounts'][$key] ??= [
+ $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
+ $report['accounts'][$key] ??= [
'id' => $sourceId,
'name' => $journal['destination_account_name'],
'sum' => '0',
@@ -219,7 +219,7 @@ class AccountTasker implements AccountTaskerInterface
$report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string)$report['accounts'][$key]['count']);
}
$currencyId = $report['accounts'][$key]['currency_id'];
- $report['sums'][$currencyId] ??= [
+ $report['sums'][$currencyId] ??= [
'sum' => '0',
'currency_id' => $report['accounts'][$key]['currency_id'],
'currency_name' => $report['accounts'][$key]['currency_name'],
@@ -241,20 +241,20 @@ class AccountTasker implements AccountTaskerInterface
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
/** @var CurrencyRepositoryInterface $currencyRepos */
- $currencyRepos = app(CurrencyRepositoryInterface::class);
- $currencies = [$defaultCurrency->id => $defaultCurrency];
- $report = [
+ $currencyRepos = app(CurrencyRepositoryInterface::class);
+ $currencies = [$defaultCurrency->id => $defaultCurrency];
+ $report = [
'accounts' => [],
'sums' => [],
];
/** @var array $journal */
foreach ($array as $journal) {
- $sourceId = (int)$journal['source_account_id'];
- $currencyId = (int)$journal['currency_id'];
- $key = sprintf('%s-%s', $sourceId, $currencyId);
+ $sourceId = (int)$journal['source_account_id'];
+ $currencyId = (int)$journal['currency_id'];
+ $key = sprintf('%s-%s', $sourceId, $currencyId);
if (!array_key_exists($key, $report['accounts'])) {
- $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
+ $currencies[$currencyId] ??= $currencyRepos->find($currencyId);
$report['accounts'][$key] = [
'id' => $sourceId,
'name' => $journal['source_account_name'],
@@ -278,7 +278,7 @@ class AccountTasker implements AccountTaskerInterface
$report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string)$report['accounts'][$key]['count']);
}
$currencyId = $report['accounts'][$key]['currency_id'];
- $report['sums'][$currencyId] ??= [
+ $report['sums'][$currencyId] ??= [
'sum' => '0',
'currency_id' => $report['accounts'][$key]['currency_id'],
'currency_name' => $report['accounts'][$key]['currency_name'],
diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php
index b63ea91817..71d33fb175 100644
--- a/app/Repositories/Account/OperationsRepository.php
+++ b/app/Repositories/Account/OperationsRepository.php
@@ -184,8 +184,8 @@ class OperationsRepository implements OperationsRepositoryInterface
{
$array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $journalId = (int)$journal['transaction_journal_id'];
+ $currencyId = (int)$journal['currency_id'];
+ $journalId = (int)$journal['transaction_journal_id'];
$array[$currencyId] ??= [
'currency_id' => $journal['currency_id'],
'currency_name' => $journal['currency_name'],
@@ -260,7 +260,7 @@ class OperationsRepository implements OperationsRepositoryInterface
if (null !== $currency) {
$collector->setCurrency($currency);
}
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
// same but for foreign currencies:
if (null !== $currency) {
@@ -286,10 +286,10 @@ class OperationsRepository implements OperationsRepositoryInterface
}
}
- $result = $collector->getExtractedJournals();
+ $result = $collector->getExtractedJournals();
// do not use array_merge because you want keys to overwrite (otherwise you get double results):
- $journals = $result + $journals;
+ $journals = $result + $journals;
}
return $journals;
@@ -301,7 +301,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -312,9 +312,9 @@ class OperationsRepository implements OperationsRepositoryInterface
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$direction}($journal['amount'])); // @phpstan-ignore-line
// also do foreign amount:
- $foreignId = (int)$journal['foreign_currency_id'];
+ $foreignId = (int)$journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'sum' => '0',
'currency_id' => $foreignId,
'currency_name' => $journal['foreign_currency_name'],
@@ -337,7 +337,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$key = sprintf('%s-%s', $journal[$idKey], $journal['currency_id']);
- $array[$key] ??= [
+ $array[$key] ??= [
'id' => $journal[$idKey],
'name' => $journal[$nameKey],
'sum' => '0',
@@ -352,7 +352,7 @@ class OperationsRepository implements OperationsRepositoryInterface
// also do foreign amount:
if (0 !== (int)$journal['foreign_currency_id']) {
$key = sprintf('%s-%s', $journal[$idKey], $journal['foreign_currency_id']);
- $array[$key] ??= [
+ $array[$key] ??= [
'id' => $journal[$idKey],
'name' => $journal[$nameKey],
'sum' => '0',
@@ -377,7 +377,7 @@ class OperationsRepository implements OperationsRepositoryInterface
foreach ($journals as $journal) {
$return = $this->groupByEitherJournal($return, $journal);
}
- $final = [];
+ $final = [];
foreach ($return as $array) {
$array['difference_float'] = (float)$array['difference'];
$array['in_float'] = (float)$array['in'];
@@ -390,12 +390,12 @@ class OperationsRepository implements OperationsRepositoryInterface
private function groupByEitherJournal(array $return, array $journal): array
{
- $sourceId = $journal['source_account_id'];
- $destinationId = $journal['destination_account_id'];
- $currencyId = $journal['currency_id'];
- $sourceKey = sprintf('%d-%d', $currencyId, $sourceId);
- $destKey = sprintf('%d-%d', $currencyId, $destinationId);
- $amount = app('steam')->positive($journal['amount']);
+ $sourceId = $journal['source_account_id'];
+ $destinationId = $journal['destination_account_id'];
+ $currencyId = $journal['currency_id'];
+ $sourceKey = sprintf('%d-%d', $currencyId, $sourceId);
+ $destKey = sprintf('%d-%d', $currencyId, $destinationId);
+ $amount = app('steam')->positive($journal['amount']);
// source first
$return[$sourceKey] ??= [
@@ -412,7 +412,7 @@ class OperationsRepository implements OperationsRepositoryInterface
];
// dest next:
- $return[$destKey] ??= [
+ $return[$destKey] ??= [
'id' => (string)$destinationId,
'name' => $journal['destination_account_name'],
'difference' => '0',
@@ -430,15 +430,15 @@ class OperationsRepository implements OperationsRepositoryInterface
$return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], $return[$sourceKey]['in']);
// destination account? money comes in:
- $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount);
- $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']);
+ $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount);
+ $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']);
// foreign currency
if (null !== $journal['foreign_currency_id'] && null !== $journal['foreign_amount']) {
- $currencyId = $journal['foreign_currency_id'];
- $sourceKey = sprintf('%d-%d', $currencyId, $sourceId);
- $destKey = sprintf('%d-%d', $currencyId, $destinationId);
- $amount = app('steam')->positive($journal['foreign_amount']);
+ $currencyId = $journal['foreign_currency_id'];
+ $sourceKey = sprintf('%d-%d', $currencyId, $sourceId);
+ $destKey = sprintf('%d-%d', $currencyId, $destinationId);
+ $amount = app('steam')->positive($journal['foreign_amount']);
// same as above:
// source first
@@ -456,7 +456,7 @@ class OperationsRepository implements OperationsRepositoryInterface
];
// dest next:
- $return[$destKey] ??= [
+ $return[$destKey] ??= [
'id' => (string)$destinationId,
'name' => $journal['destination_account_name'],
'difference' => '0',
@@ -473,8 +473,8 @@ class OperationsRepository implements OperationsRepositoryInterface
$return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], $return[$sourceKey]['in']);
// destination account? money comes in:
- $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount);
- $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']);
+ $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount);
+ $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']);
}
return $return;
diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php
index 13bd2b1638..98d0af2961 100644
--- a/app/Repositories/Attachment/AttachmentRepository.php
+++ b/app/Repositories/Attachment/AttachmentRepository.php
@@ -51,7 +51,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
/** @var AttachmentHelperInterface $helper */
$helper = app(AttachmentHelperInterface::class);
- $path = $helper->getAttachmentLocation($attachment);
+ $path = $helper->getAttachmentLocation($attachment);
try {
Storage::disk('upload')->delete($path);
@@ -118,7 +118,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
/** @var AttachmentFactory $factory */
$factory = app(AttachmentFactory::class);
$factory->setUser($this->user);
- $result = $factory->create($data);
+ $result = $factory->create($data);
if (null === $result) {
throw new FireflyException('Could not store attachment.');
}
@@ -172,7 +172,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
return true;
}
- $dbNote = $attachment->notes()->first();
+ $dbNote = $attachment->notes()->first();
if (null === $dbNote) {
$dbNote = new Note();
$dbNote->noteable()->associate($attachment);
diff --git a/app/Repositories/AuditLogEntry/ALERepository.php b/app/Repositories/AuditLogEntry/ALERepository.php
index f97d16639e..92b84f9e37 100644
--- a/app/Repositories/AuditLogEntry/ALERepository.php
+++ b/app/Repositories/AuditLogEntry/ALERepository.php
@@ -41,7 +41,7 @@ class ALERepository implements ALERepositoryInterface
public function store(array $data): AuditLogEntry
{
- $auditLogEntry = new AuditLogEntry();
+ $auditLogEntry = new AuditLogEntry();
$auditLogEntry->auditable()->associate($data['auditable']);
$auditLogEntry->changer()->associate($data['changer']);
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 2e5479b9dd..1c5ded5333 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -155,7 +155,7 @@ class BillRepository implements BillRepositoryInterface
*/
public function getAttachments(Bill $bill): Collection
{
- $set = $bill->attachments()->get();
+ $set = $bill->attachments()->get();
/** @var \Storage $disk */
$disk = \Storage::disk('upload');
@@ -244,7 +244,7 @@ class BillRepository implements BillRepositoryInterface
public function getOverallAverage(Bill $bill): array
{
/** @var JournalRepositoryInterface $repos */
- $repos = app(JournalRepositoryInterface::class);
+ $repos = app(JournalRepositoryInterface::class);
$repos->setUser($this->user);
// get and sort on currency
@@ -257,7 +257,7 @@ class BillRepository implements BillRepositoryInterface
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
$currencyId = (int) $journal->transaction_currency_id;
$currency = $journal->transactionCurrency;
- $result[$currencyId] ??= [
+ $result[$currencyId] ??= [
'sum' => '0',
'count' => 0,
'avg' => '0',
@@ -336,16 +336,16 @@ class BillRepository implements BillRepositoryInterface
*/
public function getRulesForBills(Collection $collection): array
{
- $rules = $this->user->rules()
+ $rules = $this->user->rules()
->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id')
->where('rule_actions.action_type', 'link_to_bill')
->get(['rules.id', 'rules.title', 'rule_actions.action_value', 'rules.active'])
;
- $array = [];
+ $array = [];
/** @var Rule $rule */
foreach ($rules as $rule) {
- $array[$rule->action_value] ??= [];
+ $array[$rule->action_value] ??= [];
$array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title, 'active' => $rule->active];
}
$return = [];
@@ -359,11 +359,11 @@ class BillRepository implements BillRepositoryInterface
public function getYearAverage(Bill $bill, Carbon $date): array
{
/** @var JournalRepositoryInterface $repos */
- $repos = app(JournalRepositoryInterface::class);
+ $repos = app(JournalRepositoryInterface::class);
$repos->setUser($this->user);
// get and sort on currency
- $result = [];
+ $result = [];
$journals = $bill->transactionJournals()
->where('date', '>=', $date->year.'-01-01 00:00:00')
@@ -374,13 +374,13 @@ class BillRepository implements BillRepositoryInterface
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
/** @var null|Transaction $transaction */
- $transaction = $journal->transactions()->where('amount', '<', 0)->first();
+ $transaction = $journal->transactions()->where('amount', '<', 0)->first();
if (null === $transaction) {
continue;
}
$currencyId = (int) $journal->transaction_currency_id;
$currency = $journal->transactionCurrency;
- $result[$currencyId] ??= [
+ $result[$currencyId] ??= [
'sum' => '0',
'count' => 0,
'avg' => '0',
@@ -424,7 +424,7 @@ class BillRepository implements BillRepositoryInterface
*/
public function nextExpectedMatch(Bill $bill, Carbon $date): Carbon
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($bill->id);
$cache->addProperty('nextExpectedMatch');
$cache->addProperty($date);
@@ -432,7 +432,7 @@ class BillRepository implements BillRepositoryInterface
return $cache->get();
}
// find the most recent date for this bill NOT in the future. Cache this date:
- $start = clone $bill->date;
+ $start = clone $bill->date;
app('log')->debug('nextExpectedMatch: Start is '.$start->format('Y-m-d'));
while ($start < $date) {
@@ -441,7 +441,7 @@ class BillRepository implements BillRepositoryInterface
app('log')->debug('Start is now '.$start->format('Y-m-d'));
}
- $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
+ $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);
// see if the bill was paid in this period.
$journalCount = $bill->transactionJournals()->before($end)->after($start)->count();
@@ -527,7 +527,7 @@ class BillRepository implements BillRepositoryInterface
/** @var null|Transaction $sourceTransaction */
$sourceTransaction = $transactionJournal->transactions()->where('amount', '<', 0)->first();
if (null !== $sourceTransaction) {
- $amount = $sourceTransaction->amount;
+ $amount = $sourceTransaction->amount;
if ((int) $sourceTransaction->foreign_currency_id === $currency->id) {
// use foreign amount instead!
$amount = (string) $sourceTransaction->foreign_amount;
@@ -567,7 +567,7 @@ class BillRepository implements BillRepositoryInterface
if ($total > 0) {
$currency = $bill->transactionCurrency;
$average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2');
- $return[$currency->id] ??= [
+ $return[$currency->id] ??= [
'id' => (string) $currency->id,
'name' => $currency->name,
'symbol' => $currency->symbol,
@@ -605,7 +605,7 @@ class BillRepository implements BillRepositoryInterface
// app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
- $currentStart = clone $nextExpectedMatch;
+ $currentStart = clone $nextExpectedMatch;
}
return $set;
diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php
index a98f454556..237b4faea4 100644
--- a/app/Repositories/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/Budget/AvailableBudgetRepository.php
@@ -45,9 +45,9 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
/** @var AvailableBudget $availableBudget */
foreach ($availableBudgets as $availableBudget) {
- $start = $availableBudget->start_date->format('Y-m-d');
- $end = $availableBudget->end_date->format('Y-m-d');
- $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end);
+ $start = $availableBudget->start_date->format('Y-m-d');
+ $end = $availableBudget->end_date->format('Y-m-d');
+ $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end);
if (array_key_exists($key, $exists)) {
app('log')->debug(sprintf('Found duplicate AB: %s %s, %s-%s. Has been deleted', $availableBudget->transaction_currency_id, $availableBudget->amount, $start, $end));
$availableBudget->delete();
@@ -107,7 +107,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string
{
- $amount = '0';
+ $amount = '0';
/** @var null|AvailableBudget $availableBudget */
$availableBudget = $this->user->availableBudgets()
@@ -190,13 +190,13 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
*/
public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): AvailableBudget
{
- $availableBudget = $this->user->availableBudgets()
+ $availableBudget = $this->user->availableBudgets()
->where('transaction_currency_id', $currency->id)
->where('start_date', $start->format('Y-m-d'))
->where('end_date', $end->format('Y-m-d'))->first()
;
if (null === $availableBudget) {
- $availableBudget = new AvailableBudget();
+ $availableBudget = new AvailableBudget();
$availableBudget->user()->associate($this->user);
$availableBudget->transactionCurrency()->associate($currency);
$availableBudget->start_date = $start->startOfDay();
@@ -221,7 +221,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
if ($start instanceof Carbon) {
$start = $data['start']->startOfDay();
}
- $end = $data['end'];
+ $end = $data['end'];
if ($end instanceof Carbon) {
$end = $data['end']->endOfDay();
}
diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php
index ce882676aa..db41011401 100644
--- a/app/Repositories/Budget/BudgetLimitRepository.php
+++ b/app/Repositories/Budget/BudgetLimitRepository.php
@@ -47,7 +47,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
*/
public function budgeted(Carbon $start, Carbon $end, TransactionCurrency $currency, ?Collection $budgets = null): string
{
- $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
+ $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
// same complex where query as below.
->where(
@@ -266,22 +266,22 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
{
// if no currency has been provided, use the user's default currency:
/** @var TransactionCurrencyFactory $factory */
- $factory = app(TransactionCurrencyFactory::class);
- $currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null);
+ $factory = app(TransactionCurrencyFactory::class);
+ $currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
}
- $currency->enabled = true;
+ $currency->enabled = true;
$currency->save();
// find the budget:
- $budget = $this->user->budgets()->find((int)$data['budget_id']);
+ $budget = $this->user->budgets()->find((int)$data['budget_id']);
if (null === $budget) {
throw new FireflyException('200004: Budget does not exist.');
}
// find limit with same date range and currency.
- $limit = $budget->budgetlimits()
+ $limit = $budget->budgetlimits()
->where('budget_limits.start_date', $data['start_date']->format('Y-m-d'))
->where('budget_limits.end_date', $data['end_date']->format('Y-m-d'))
->where('budget_limits.transaction_currency_id', $currency->id)
@@ -293,7 +293,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
app('log')->debug('No existing budget limit, create a new one');
// or create one and return it.
- $limit = new BudgetLimit();
+ $limit = new BudgetLimit();
$limit->budget()->associate($budget);
$limit->start_date = $data['start_date']->format('Y-m-d');
$limit->end_date = $data['end_date']->format('Y-m-d');
@@ -319,13 +319,13 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
*/
public function update(BudgetLimit $budgetLimit, array $data): BudgetLimit
{
- $budgetLimit->amount = array_key_exists('amount', $data) ? $data['amount'] : $budgetLimit->amount;
- $budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id;
- $budgetLimit->start_date = array_key_exists('start', $data) ? $data['start']->format('Y-m-d 00:00:00') : $budgetLimit->start_date;
- $budgetLimit->end_date = array_key_exists('end', $data) ? $data['end']->format('Y-m-d 23:59:59') : $budgetLimit->end_date;
+ $budgetLimit->amount = array_key_exists('amount', $data) ? $data['amount'] : $budgetLimit->amount;
+ $budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id;
+ $budgetLimit->start_date = array_key_exists('start', $data) ? $data['start']->format('Y-m-d 00:00:00') : $budgetLimit->start_date;
+ $budgetLimit->end_date = array_key_exists('end', $data) ? $data['end']->format('Y-m-d 23:59:59') : $budgetLimit->end_date;
// if no currency has been provided, use the user's default currency:
- $currency = null;
+ $currency = null;
// update if relevant:
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
@@ -337,7 +337,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
if (null === $currency) {
$currency = $budgetLimit->transactionCurrency ?? app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
}
- $currency->enabled = true;
+ $currency->enabled = true;
$currency->save();
$budgetLimit->transaction_currency_id = $currency->id;
@@ -349,7 +349,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): ?BudgetLimit
{
// count the limits:
- $limits = $budget->budgetlimits()
+ $limits = $budget->budgetlimits()
->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
->count('budget_limits.*')
@@ -358,7 +358,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// there might be a budget limit for these dates:
/** @var null|BudgetLimit $limit */
- $limit = $budget->budgetlimits()
+ $limit = $budget->budgetlimits()
->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00'))
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
->first(['budget_limits.*'])
@@ -393,7 +393,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
}
app('log')->debug('No existing budget limit, create a new one');
// or create one and return it.
- $limit = new BudgetLimit();
+ $limit = new BudgetLimit();
$limit->budget()->associate($budget);
$limit->start_date = $start->startOfDay();
$limit->end_date = $end->startOfDay();
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index 4a46767980..4d556a2d0a 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -82,7 +82,7 @@ class BudgetRepository implements BudgetRepositoryInterface
public function budgetedInPeriod(Carbon $start, Carbon $end): array
{
app('log')->debug(sprintf('Now in budgetedInPeriod("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d')));
- $return = [];
+ $return = [];
/** @var BudgetLimitRepository $limitRepository */
$limitRepository = app(BudgetLimitRepository::class);
@@ -99,9 +99,9 @@ class BudgetRepository implements BudgetRepositoryInterface
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
app('log')->debug(sprintf('Budget limit #%d', $limit->id));
- $currency = $limit->transactionCurrency;
- $rate = $converter->getCurrencyRate($currency, $defaultCurrency, $end);
- $currencyCode = $currency->code;
+ $currency = $limit->transactionCurrency;
+ $rate = $converter->getCurrencyRate($currency, $defaultCurrency, $end);
+ $currencyCode = $currency->code;
$return[$currencyCode] ??= [
'currency_id' => (string) $currency->id,
'currency_name' => $currency->name,
@@ -172,19 +172,19 @@ class BudgetRepository implements BudgetRepositoryInterface
public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array
{
app('log')->debug(sprintf('Now in budgetedInPeriod(#%d, "%s", "%s")', $budget->id, $start->format('Y-m-d'), $end->format('Y-m-d')));
- $return = [];
+ $return = [];
/** @var BudgetLimitRepository $limitRepository */
$limitRepository = app(BudgetLimitRepository::class);
$limitRepository->setUser($this->user);
app('log')->debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name));
- $limits = $limitRepository->getBudgetLimits($budget, $start, $end);
+ $limits = $limitRepository->getBudgetLimits($budget, $start, $end);
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
app('log')->debug(sprintf('Budget limit #%d', $limit->id));
- $currency = $limit->transactionCurrency;
+ $currency = $limit->transactionCurrency;
$return[$currency->id] ??= [
'id' => (string) $currency->id,
'name' => $currency->name,
@@ -253,7 +253,7 @@ class BudgetRepository implements BudgetRepositoryInterface
{
app('log')->debug('Now in update()');
- $oldName = $budget->name;
+ $oldName = $budget->name;
if (array_key_exists('name', $data)) {
$budget->name = $data['name'];
$this->updateRuleActions($oldName, $budget->name);
@@ -268,7 +268,7 @@ class BudgetRepository implements BudgetRepositoryInterface
$budget->save();
// update or create auto-budget:
- $autoBudget = $this->getAutoBudget($budget);
+ $autoBudget = $this->getAutoBudget($budget);
// first things first: delete when no longer required:
$autoBudgetType = array_key_exists('auto_budget_type', $data) ? $data['auto_budget_type'] : null;
@@ -392,7 +392,7 @@ class BudgetRepository implements BudgetRepositoryInterface
public function getAttachments(Budget $budget): Collection
{
- $set = $budget->attachments()->get();
+ $set = $budget->attachments()->get();
/** @var \Storage $disk */
$disk = \Storage::disk('upload');
@@ -462,8 +462,8 @@ class BudgetRepository implements BudgetRepositoryInterface
// exclude specific liabilities
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
- $subset = $repository->getAccountsByType(config('firefly.valid_liabilities'));
- $selection = new Collection();
+ $subset = $repository->getAccountsByType(config('firefly.valid_liabilities'));
+ $selection = new Collection();
/** @var Account $account */
foreach ($subset as $account) {
@@ -474,7 +474,7 @@ class BudgetRepository implements BudgetRepositoryInterface
// start collecting:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user)
->setRange($start, $end)
->excludeDestinationAccounts($selection)
@@ -482,12 +482,12 @@ class BudgetRepository implements BudgetRepositoryInterface
->setBudgets($this->getActiveBudgets())
;
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int) $journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'id' => (string) $currencyId,
'name' => $journal['currency_name'],
'symbol' => $journal['currency_symbol'],
@@ -498,9 +498,9 @@ class BudgetRepository implements BudgetRepositoryInterface
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount']));
// also do foreign amount:
- $foreignId = (int) $journal['foreign_currency_id'];
+ $foreignId = (int) $journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'id' => (string) $foreignId,
'name' => $journal['foreign_currency_name'],
'symbol' => $journal['foreign_currency_symbol'],
@@ -524,8 +524,8 @@ class BudgetRepository implements BudgetRepositoryInterface
// exclude specific liabilities
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
- $subset = $repository->getAccountsByType(config('firefly.valid_liabilities'));
- $selection = new Collection();
+ $subset = $repository->getAccountsByType(config('firefly.valid_liabilities'));
+ $selection = new Collection();
/** @var Account $account */
foreach ($subset as $account) {
@@ -536,7 +536,7 @@ class BudgetRepository implements BudgetRepositoryInterface
// start collecting:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user)
->setRange($start, $end)
->excludeDestinationAccounts($selection)
@@ -544,12 +544,12 @@ class BudgetRepository implements BudgetRepositoryInterface
->setBudget($budget)
;
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int) $journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'id' => (string) $currencyId,
'name' => $journal['currency_name'],
'symbol' => $journal['currency_symbol'],
@@ -560,9 +560,9 @@ class BudgetRepository implements BudgetRepositoryInterface
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount']));
// also do foreign amount:
- $foreignId = (int) $journal['foreign_currency_id'];
+ $foreignId = (int) $journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'id' => (string) $foreignId,
'name' => $journal['foreign_currency_name'],
'symbol' => $journal['foreign_currency_symbol'],
@@ -584,7 +584,7 @@ class BudgetRepository implements BudgetRepositoryInterface
*/
public function store(array $data): Budget
{
- $order = $this->getMaxOrder();
+ $order = $this->getMaxOrder();
try {
$newBudget = Budget::create(
@@ -611,7 +611,7 @@ class BudgetRepository implements BudgetRepositoryInterface
if (!array_key_exists('auto_budget_type', $data) || !array_key_exists('auto_budget_amount', $data) || !array_key_exists('auto_budget_period', $data)) {
return $newBudget;
}
- $type = $data['auto_budget_type'];
+ $type = $data['auto_budget_type'];
if ('none' === $type) {
return $newBudget;
}
@@ -630,8 +630,8 @@ class BudgetRepository implements BudgetRepositoryInterface
}
/** @var CurrencyRepositoryInterface $repos */
- $repos = app(CurrencyRepositoryInterface::class);
- $currency = null;
+ $repos = app(CurrencyRepositoryInterface::class);
+ $currency = null;
if (array_key_exists('currency_id', $data)) {
$currency = $repos->find((int) $data['currency_id']);
}
@@ -642,7 +642,7 @@ class BudgetRepository implements BudgetRepositoryInterface
$currency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
}
- $autoBudget = new AutoBudget();
+ $autoBudget = new AutoBudget();
$autoBudget->budget()->associate($newBudget);
$autoBudget->transaction_currency_id = $currency->id;
$autoBudget->auto_budget_type = $type;
@@ -651,11 +651,11 @@ class BudgetRepository implements BudgetRepositoryInterface
$autoBudget->save();
// create initial budget limit.
- $today = today(config('app.timezone'));
- $start = app('navigation')->startOfPeriod($today, $autoBudget->period);
- $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
+ $today = today(config('app.timezone'));
+ $start = app('navigation')->startOfPeriod($today, $autoBudget->period);
+ $end = app('navigation')->endOfPeriod($start, $autoBudget->period);
- $limitRepos = app(BudgetLimitRepositoryInterface::class);
+ $limitRepos = app(BudgetLimitRepositoryInterface::class);
$limitRepos->setUser($this->user);
$limitRepos->store(
[
@@ -774,7 +774,7 @@ class BudgetRepository implements BudgetRepositoryInterface
$autoBudget = $this->getAutoBudget($budget);
// grab default currency:
- $currency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
+ $currency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
if (null === $autoBudget) {
// at this point it's a blind assumption auto_budget_type is 1 or 2.
diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php
index 73f0bc2deb..4527e77114 100644
--- a/app/Repositories/Budget/NoBudgetRepository.php
+++ b/app/Repositories/Budget/NoBudgetRepository.php
@@ -44,17 +44,17 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
$carbonFormat = app('navigation')->preferredCarbonFormat($start, $end);
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($start, $end);
$collector->setTypes([TransactionType::WITHDRAWAL]);
$collector->withoutBudget();
- $journals = $collector->getExtractedJournals();
- $data = [];
+ $journals = $collector->getExtractedJournals();
+ $data = [];
/** @var array $journal */
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
+ $currencyId = (int)$journal['currency_id'];
$data[$currencyId] ??= [
'id' => 0,
@@ -67,7 +67,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
'currency_decimal_places' => $journal['currency_decimal_places'],
'entries' => [],
];
- $date = $journal['date']->format($carbonFormat);
+ $date = $journal['date']->format($carbonFormat);
if (!array_key_exists($date, $data[$currencyId]['entries'])) {
$data[$currencyId]['entries'][$date] = '0';
@@ -84,7 +84,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
public function spentInPeriodWoBudgetMc(Collection $accounts, Carbon $start, Carbon $end): array
{
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user);
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->withoutBudget();
@@ -99,7 +99,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
/** @var array $journal */
foreach ($journals as $journal) {
- $code = $journal['currency_code'];
+ $code = $journal['currency_code'];
if (!array_key_exists($code, $currencies)) {
$currencies[$code] = [
'id' => $journal['currency_id'],
@@ -151,12 +151,12 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
}
$collector->withoutBudget();
$collector->withBudgetInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php
index 0e0bec4b0d..f0e3fc132a 100644
--- a/app/Repositories/Budget/OperationsRepository.php
+++ b/app/Repositories/Budget/OperationsRepository.php
@@ -59,7 +59,7 @@ class OperationsRepository implements OperationsRepositoryInterface
++$count;
app('log')->debug(sprintf('Found %d budget limits. Per day is %s, total is %s', $count, $perDay, $total));
}
- $avg = $total;
+ $avg = $total;
if ($count > 0) {
$avg = bcdiv($total, (string)$count);
}
@@ -81,21 +81,21 @@ class OperationsRepository implements OperationsRepositoryInterface
// get all transactions:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($start, $end);
$collector->setBudgets($budgets);
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
// loop transactions:
/** @var array $journal */
foreach ($journals as $journal) {
// prep data array for currency:
- $budgetId = (int)$journal['budget_id'];
- $budgetName = $journal['budget_name'];
- $currencyId = (int)$journal['currency_id'];
- $key = sprintf('%d-%d', $budgetId, $currencyId);
+ $budgetId = (int)$journal['budget_id'];
+ $budgetName = $journal['budget_name'];
+ $currencyId = (int)$journal['currency_id'];
+ $key = sprintf('%d-%d', $budgetId, $currencyId);
- $data[$key] ??= [
+ $data[$key] ??= [
'id' => $budgetId,
'name' => sprintf('%s (%s)', $budgetName, $journal['currency_name']),
'sum' => '0',
@@ -133,13 +133,13 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setBudgets($this->getBudgets());
}
$collector->withBudgetInformation()->withAccountInformation()->withCategoryInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $budgetId = (int)$journal['budget_id'];
- $budgetName = (string)$journal['budget_name'];
+ $currencyId = (int)$journal['currency_id'];
+ $budgetId = (int)$journal['budget_id'];
+ $budgetName = (string)$journal['budget_name'];
// catch "no category" entries.
if (0 === $budgetId) {
@@ -147,7 +147,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
// info about the currency:
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'budgets' => [],
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -210,8 +210,8 @@ class OperationsRepository implements OperationsRepositoryInterface
// TODO this filter must be somewhere in AccountRepositoryInterface because I suspect its needed more often (A113)
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
- $subset = $repository->getAccountsByType(config('firefly.valid_liabilities'));
- $selection = new Collection();
+ $subset = $repository->getAccountsByType(config('firefly.valid_liabilities'));
+ $selection = new Collection();
/** @var Account $account */
foreach ($subset as $account) {
@@ -221,7 +221,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user)
->setRange($start, $end)
->excludeDestinationAccounts($selection)
@@ -238,7 +238,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setCurrency($currency);
}
$collector->setBudgets($budgets);
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
// same but for foreign currencies:
if (null !== $currency) {
@@ -252,16 +252,16 @@ class OperationsRepository implements OperationsRepositoryInterface
if (null !== $accounts) {
$collector->setAccounts($accounts);
}
- $result = $collector->getExtractedJournals();
+ $result = $collector->getExtractedJournals();
// app('log')->debug(sprintf('Found %d journals with currency %s.', count($result), $currency->code));
// do not use array_merge because you want keys to overwrite (otherwise you get double results):
- $journals = $result + $journals;
+ $journals = $result + $journals;
}
- $array = [];
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -272,9 +272,9 @@ class OperationsRepository implements OperationsRepositoryInterface
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount']));
// also do foreign amount:
- $foreignId = (int)$journal['foreign_currency_id'];
+ $foreignId = (int)$journal['foreign_currency_id'];
if (0 !== $foreignId) {
- $array[$foreignId] ??= [
+ $array[$foreignId] ??= [
'sum' => '0',
'currency_id' => $foreignId,
'currency_name' => $journal['foreign_currency_name'],
diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php
index 70605f9d20..97e64c10cb 100644
--- a/app/Repositories/Category/CategoryRepository.php
+++ b/app/Repositories/Category/CategoryRepository.php
@@ -144,7 +144,7 @@ class CategoryRepository implements CategoryRepositoryInterface
public function store(array $data): Category
{
/** @var CategoryFactory $factory */
- $factory = app(CategoryFactory::class);
+ $factory = app(CategoryFactory::class);
$factory->setUser($this->user);
$category = $factory->findOrCreate(null, $data['name']);
@@ -177,7 +177,7 @@ class CategoryRepository implements CategoryRepositoryInterface
public function updateNotes(Category $category, string $notes): void
{
- $dbNote = $category->notes()->first();
+ $dbNote = $category->notes()->first();
if (null === $dbNote) {
$dbNote = new Note();
$dbNote->noteable()->associate($category);
@@ -210,7 +210,7 @@ class CategoryRepository implements CategoryRepositoryInterface
public function getAttachments(Category $category): Collection
{
- $set = $category->attachments()->get();
+ $set = $category->attachments()->get();
/** @var \Storage $disk */
$disk = \Storage::disk('upload');
@@ -306,7 +306,7 @@ class CategoryRepository implements CategoryRepositoryInterface
private function getFirstTransactionDate(Category $category): ?Carbon
{
// check transactions:
- $query = $category->transactions()
+ $query = $category->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->orderBy('transaction_journals.date', 'ASC')
;
@@ -321,7 +321,7 @@ class CategoryRepository implements CategoryRepositoryInterface
private function getLastJournalDate(Category $category, Collection $accounts): ?Carbon
{
- $query = $category->transactionJournals()->orderBy('date', 'DESC');
+ $query = $category->transactionJournals()->orderBy('date', 'DESC');
if ($accounts->count() > 0) {
$query->leftJoin('transactions as t', 't.transaction_journal_id', '=', 'transaction_journals.id');
@@ -343,7 +343,7 @@ class CategoryRepository implements CategoryRepositoryInterface
private function getLastTransactionDate(Category $category, Collection $accounts): ?Carbon
{
// check transactions:
- $query = $category->transactions()
+ $query = $category->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->orderBy('transaction_journals.date', 'DESC')
;
diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php
index e5dfd6a164..d74749f2df 100644
--- a/app/Repositories/Category/NoCategoryRepository.php
+++ b/app/Repositories/Category/NoCategoryRepository.php
@@ -50,12 +50,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
if (null !== $accounts && $accounts->count() > 0) {
$collector->setAccounts($accounts);
}
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $currencyId = (int)$journal['currency_id'];
+ $array[$currencyId] ??= [
'categories' => [],
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -72,9 +72,9 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
// add journal to array:
// only a subset of the fields.
- $journalId = (int)$journal['transaction_journal_id'];
+ $journalId = (int)$journal['transaction_journal_id'];
$array[$currencyId]['categories'][0]['transaction_journals'][$journalId]
- = [
+ = [
'amount' => app('steam')->negative($journal['amount']),
'date' => $journal['date'],
];
@@ -103,12 +103,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
if (null !== $accounts && $accounts->count() > 0) {
$collector->setAccounts($accounts);
}
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $currencyId = (int)$journal['currency_id'];
+ $array[$currencyId] ??= [
'categories' => [],
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -125,9 +125,9 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
];
// add journal to array:
// only a subset of the fields.
- $journalId = (int)$journal['transaction_journal_id'];
+ $journalId = (int)$journal['transaction_journal_id'];
$array[$currencyId]['categories'][0]['transaction_journals'][$journalId]
- = [
+ = [
'amount' => app('steam')->positive($journal['amount']),
'date' => $journal['date'],
];
@@ -148,12 +148,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
if (null !== $accounts && $accounts->count() > 0) {
$collector->setAccounts($accounts);
}
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -179,12 +179,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
if (null !== $accounts && $accounts->count() > 0) {
$collector->setAccounts($accounts);
}
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -207,12 +207,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
if (null !== $accounts && $accounts->count() > 0) {
$collector->setAccounts($accounts);
}
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php
index 823bcf5598..f814f027d1 100644
--- a/app/Repositories/Category/OperationsRepository.php
+++ b/app/Repositories/Category/OperationsRepository.php
@@ -59,13 +59,13 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setCategories($this->getCategories());
}
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $categoryId = (int)$journal['category_id'];
- $categoryName = (string)$journal['category_name'];
+ $currencyId = (int)$journal['currency_id'];
+ $categoryId = (int)$journal['category_id'];
+ $categoryName = (string)$journal['category_name'];
// catch "no category" entries.
if (0 === $categoryId) {
@@ -73,7 +73,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
// info about the currency:
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'categories' => [],
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -135,13 +135,13 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setCategories($this->getCategories());
}
$collector->withCategoryInformation()->withAccountInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $categoryId = (int)$journal['category_id'];
- $categoryName = (string)$journal['category_name'];
+ $currencyId = (int)$journal['currency_id'];
+ $categoryId = (int)$journal['category_id'];
+ $categoryName = (string)$journal['category_name'];
// catch "no category" entries.
if (0 === $categoryId) {
@@ -149,7 +149,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
// info about the currency:
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'categories' => [],
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -197,13 +197,13 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setCategories($this->getCategories());
}
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $categoryId = (int)$journal['category_id'];
- $categoryName = (string)$journal['category_name'];
+ $currencyId = (int)$journal['currency_id'];
+ $categoryId = (int)$journal['category_id'];
+ $categoryName = (string)$journal['category_name'];
// catch "no category" entries.
if (0 === $categoryId) {
@@ -211,7 +211,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
// info about the currency:
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'categories' => [],
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -260,13 +260,13 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setCategories($this->getCategories());
}
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $categoryId = (int)$journal['category_id'];
- $categoryName = (string)$journal['category_name'];
+ $currencyId = (int)$journal['currency_id'];
+ $categoryId = (int)$journal['category_id'];
+ $categoryName = (string)$journal['category_name'];
// catch "no category" entries.
if (0 === $categoryId) {
@@ -274,7 +274,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
// info about the currency:
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'categories' => [],
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -328,12 +328,12 @@ class OperationsRepository implements OperationsRepositoryInterface
}
$collector->setCategories($categories);
$collector->withCategoryInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -365,12 +365,12 @@ class OperationsRepository implements OperationsRepositoryInterface
$categories = $this->getCategories();
}
$collector->setCategories($categories);
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
@@ -402,12 +402,12 @@ class OperationsRepository implements OperationsRepositoryInterface
$categories = $this->getCategories();
}
$collector->setCategories($categories);
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
$currencyId = (int)$journal['currency_id'];
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'sum' => '0',
'currency_id' => (string)$currencyId,
'currency_name' => $journal['currency_name'],
diff --git a/app/Repositories/Journal/JournalAPIRepository.php b/app/Repositories/Journal/JournalAPIRepository.php
index 9ded9dade4..68daaf8f8a 100644
--- a/app/Repositories/Journal/JournalAPIRepository.php
+++ b/app/Repositories/Journal/JournalAPIRepository.php
@@ -57,7 +57,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
*/
public function getAttachments(TransactionJournal $journal): Collection
{
- $set = $journal->attachments;
+ $set = $journal->attachments;
/** @var \Storage $disk */
$disk = \Storage::disk('upload');
diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php
index c690ed71bd..caa152c818 100644
--- a/app/Repositories/Journal/JournalCLIRepository.php
+++ b/app/Repositories/Journal/JournalCLIRepository.php
@@ -118,7 +118,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
*/
public function getMetaField(TransactionJournal $journal, string $field): ?string
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('journal-meta-updated');
$cache->addProperty($journal->id);
$cache->addProperty($field);
@@ -127,12 +127,12 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
return $cache->get();
}
- $entry = $journal->transactionJournalMeta()->where('name', $field)->first();
+ $entry = $journal->transactionJournalMeta()->where('name', $field)->first();
if (null === $entry) {
return null;
}
- $value = $entry->data;
+ $value = $entry->data;
if (is_array($value)) {
$return = implode(',', $value);
@@ -167,10 +167,10 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface
*/
public function getSplitJournals(): Collection
{
- $query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
+ $query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->groupBy('transaction_journals.id')
;
- $result = $query->get(['transaction_journals.id as id', \DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line
+ $result = $query->get(['transaction_journals.id as id', \DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line
$journalIds = [];
/** @var \stdClass $row */
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index a4ffd85881..ea80eed79b 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -102,7 +102,7 @@ class JournalRepository implements JournalRepositoryInterface
*/
public function getJournalTotal(TransactionJournal $journal): string
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($journal->id);
$cache->addProperty('amount-positive');
if ($cache->has()) {
diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php
index b2ff6d012e..a84b87db97 100644
--- a/app/Repositories/LinkType/LinkTypeRepository.php
+++ b/app/Repositories/LinkType/LinkTypeRepository.php
@@ -199,7 +199,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
return $existing;
}
- $link = new TransactionJournalLink();
+ $link = new TransactionJournalLink();
$link->linkType()->associate($linkType);
if ('inward' === $information['direction']) {
app('log')->debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $inward->id, $outward->id));
@@ -285,7 +285,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
$journalLink->refresh();
}
- $journalLink->link_type_id = null === $data['link_type_id'] ? $journalLink->link_type_id : $data['link_type_id'];
+ $journalLink->link_type_id = null === $data['link_type_id'] ? $journalLink->link_type_id : $data['link_type_id'];
$journalLink->save();
if (array_key_exists('notes', $data) && null !== $data['notes']) {
$this->setNoteText($journalLink, $data['notes']);
diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
index 169a8f29cb..3bde670619 100644
--- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
+++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
@@ -55,7 +55,7 @@ trait ModifiesPiggyBanks
public function removeAmount(PiggyBank $piggyBank, string $amount, ?TransactionJournal $journal = null): bool
{
- $repetition = $this->getRepetition($piggyBank);
+ $repetition = $this->getRepetition($piggyBank);
if (null === $repetition) {
return false;
}
@@ -70,7 +70,7 @@ trait ModifiesPiggyBanks
public function addAmount(PiggyBank $piggyBank, string $amount, ?TransactionJournal $journal = null): bool
{
- $repetition = $this->getRepetition($piggyBank);
+ $repetition = $this->getRepetition($piggyBank);
if (null === $repetition) {
return false;
}
@@ -96,8 +96,8 @@ trait ModifiesPiggyBanks
$maxAmount = 1 === bccomp($leftOnAccount, $leftToSave) ? $leftToSave : $leftOnAccount;
}
- $compare = bccomp($amount, $maxAmount);
- $result = $compare <= 0;
+ $compare = bccomp($amount, $maxAmount);
+ $result = $compare <= 0;
app('log')->debug(sprintf('Left on account: %s on %s', $leftOnAccount, $today->format('Y-m-d')));
app('log')->debug(sprintf('Saved so far: %s', $savedSoFar));
@@ -139,11 +139,11 @@ trait ModifiesPiggyBanks
public function setCurrentAmount(PiggyBank $piggyBank, string $amount): PiggyBank
{
- $repetition = $this->getRepetition($piggyBank);
+ $repetition = $this->getRepetition($piggyBank);
if (null === $repetition) {
return $piggyBank;
}
- $max = $piggyBank->targetamount;
+ $max = $piggyBank->targetamount;
if (1 === bccomp($amount, $max) && 0 !== bccomp($piggyBank->targetamount, '0')) {
$amount = $max;
}
@@ -178,12 +178,12 @@ trait ModifiesPiggyBanks
*/
public function store(array $data): PiggyBank
{
- $order = $this->getMaxOrder() + 1;
+ $order = $this->getMaxOrder() + 1;
if (array_key_exists('order', $data)) {
$order = $data['order'];
}
- $data['order'] = 31337; // very high when creating.
- $piggyData = $data;
+ $data['order'] = 31337; // very high when creating.
+ $piggyData = $data;
// unset fields just in case.
unset($piggyData['object_group_title'], $piggyData['object_group_id'], $piggyData['notes'], $piggyData['current_amount']);
@@ -208,7 +208,7 @@ trait ModifiesPiggyBanks
$this->updateNote($piggyBank, $data['notes']);
// repetition is auto created.
- $repetition = $this->getRepetition($piggyBank);
+ $repetition = $this->getRepetition($piggyBank);
if (null !== $repetition && array_key_exists('current_amount', $data) && '' !== $data['current_amount']) {
$repetition->currentamount = $data['current_amount'];
$repetition->save();
@@ -223,7 +223,7 @@ trait ModifiesPiggyBanks
}
}
// try also with ID
- $objectGroupId = (int)($data['object_group_id'] ?? 0);
+ $objectGroupId = (int)($data['object_group_id'] ?? 0);
if (0 !== $objectGroupId) {
$objectGroup = $this->findObjectGroupById($objectGroupId);
if (null !== $objectGroup) {
@@ -254,7 +254,7 @@ trait ModifiesPiggyBanks
public function setOrder(PiggyBank $piggyBank, int $newOrder): bool
{
- $oldOrder = $piggyBank->order;
+ $oldOrder = $piggyBank->order;
// app('log')->debug(sprintf('Will move piggy bank #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder));
if ($newOrder > $oldOrder) {
$this->user->piggyBanks()->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder)
@@ -281,14 +281,14 @@ trait ModifiesPiggyBanks
public function update(PiggyBank $piggyBank, array $data): PiggyBank
{
- $piggyBank = $this->updateProperties($piggyBank, $data);
+ $piggyBank = $this->updateProperties($piggyBank, $data);
if (array_key_exists('notes', $data)) {
$this->updateNote($piggyBank, (string)$data['notes']);
}
// update the order of the piggy bank:
- $oldOrder = $piggyBank->order;
- $newOrder = (int)($data['order'] ?? $oldOrder);
+ $oldOrder = $piggyBank->order;
+ $newOrder = (int)($data['order'] ?? $oldOrder);
if ($oldOrder !== $newOrder) {
$this->setOrder($piggyBank, $newOrder);
}
@@ -297,7 +297,7 @@ trait ModifiesPiggyBanks
// remove money from the rep.
$repetition = $this->getRepetition($piggyBank);
if (null !== $repetition && $repetition->currentamount > $piggyBank->targetamount && 0 !== bccomp($piggyBank->targetamount, '0')) {
- $difference = bcsub($piggyBank->targetamount, $repetition->currentamount);
+ $difference = bcsub($piggyBank->targetamount, $repetition->currentamount);
// an amount will be removed, create "negative" event:
event(new ChangedAmount($piggyBank, $difference, null, null));
@@ -347,7 +347,7 @@ trait ModifiesPiggyBanks
return true;
}
- $dbNote = $piggyBank->notes()->first();
+ $dbNote = $piggyBank->notes()->first();
if (null === $dbNote) {
$dbNote = new Note();
$dbNote->noteable()->associate($piggyBank);
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index e48b69c4b4..75710cdedc 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -92,7 +92,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
public function getAttachments(PiggyBank $piggyBank): Collection
{
- $set = $piggyBank->attachments()->get();
+ $set = $piggyBank->attachments()->get();
/** @var \Storage $disk */
$disk = \Storage::disk('upload');
@@ -140,15 +140,15 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
{
app('log')->debug(sprintf('Now in getExactAmount(%d, %d, %d)', $piggyBank->id, $repetition->id, $journal->id));
- $operator = null;
- $currency = null;
+ $operator = null;
+ $currency = null;
/** @var JournalRepositoryInterface $journalRepost */
- $journalRepost = app(JournalRepositoryInterface::class);
+ $journalRepost = app(JournalRepositoryInterface::class);
$journalRepost->setUser($this->user);
/** @var AccountRepositoryInterface $accountRepos */
- $accountRepos = app(AccountRepositoryInterface::class);
+ $accountRepos = app(AccountRepositoryInterface::class);
$accountRepos->setUser($this->user);
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($this->user->userGroup);
@@ -157,10 +157,10 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
app('log')->debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBankCurrency->code));
/** @var Transaction $source */
- $source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first();
+ $source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first();
/** @var Transaction $destination */
- $destination = $journal->transactions()->with(['account'])->where('amount', '>', 0)->first();
+ $destination = $journal->transactions()->with(['account'])->where('amount', '>', 0)->first();
// matches source, which means amount will be removed from piggy:
if ($source->account_id === $piggyBank->account_id) {
@@ -182,7 +182,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
}
// currency of the account + the piggy bank currency are almost the same.
// which amount from the transaction matches?
- $amount = null;
+ $amount = null;
if ((int)$source->transaction_currency_id === $currency->id) {
app('log')->debug('Use normal amount');
$amount = app('steam')->{$operator}($source->amount); // @phpstan-ignore-line
@@ -198,8 +198,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
}
app('log')->debug(sprintf('The currency is %s and the amount is %s', $currency->code, $amount));
- $room = bcsub($piggyBank->targetamount, $repetition->currentamount);
- $compare = bcmul($repetition->currentamount, '-1');
+ $room = bcsub($piggyBank->targetamount, $repetition->currentamount);
+ $compare = bcmul($repetition->currentamount, '-1');
if (0 === bccomp($piggyBank->targetamount, '0')) {
// amount is zero? then the "room" is positive amount of we wish to add or remove.
@@ -261,7 +261,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
{
$currency = app('amount')->getDefaultCurrency();
- $set = $this->getPiggyBanks();
+ $set = $this->getPiggyBanks();
/** @var PiggyBank $piggy */
foreach ($set as $piggy) {
diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php
index d5bfce4440..c3e0ae0b2c 100644
--- a/app/Repositories/Recurring/RecurringRepository.php
+++ b/app/Repositories/Recurring/RecurringRepository.php
@@ -288,7 +288,7 @@ class RecurringRepository implements RecurringRepositoryInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($recurrence->user);
$collector->withCategoryInformation()->withBudgetInformation()->setLimit($pageSize)->setPage($page)
@@ -325,7 +325,7 @@ class RecurringRepository implements RecurringRepositoryInterface
}
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($recurrence->user);
$collector->withCategoryInformation()->withBudgetInformation()->withAccountInformation();
@@ -441,21 +441,21 @@ class RecurringRepository implements RecurringRepositoryInterface
);
}
if ('ndom' === $repetition->repetition_type) {
- $parts = explode(',', $repetition->repetition_moment);
+ $parts = explode(',', $repetition->repetition_moment);
// first part is number of week, second is weekday.
$dayOfWeek = trans(sprintf('config.dow_%s', $parts[1]), [], $language);
return (string)trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $parts[0]], $language);
}
if ('yearly' === $repetition->repetition_type) {
- $today = today(config('app.timezone'))->endOfYear();
- $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
+ $today = today(config('app.timezone'))->endOfYear();
+ $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
if (false === $repDate) {
$repDate = clone $today;
}
$diffInYears = $today->diffInYears($repDate);
$repDate->addYears($diffInYears); // technically not necessary.
- $string = $repDate->isoFormat((string)trans('config.month_and_day_no_year_js'));
+ $string = $repDate->isoFormat((string)trans('config.month_and_day_no_year_js'));
return (string)trans('firefly.recurring_yearly', ['date' => $string], $language);
}
@@ -517,7 +517,7 @@ class RecurringRepository implements RecurringRepositoryInterface
$occurrences = [];
$mutator = clone $start;
$mutator->startOfDay();
- $skipMod = $repetition->repetition_skip + 1;
+ $skipMod = $repetition->repetition_skip + 1;
app('log')->debug(sprintf('Calculating occurrences for rep type "%s"', $repetition->repetition_type));
app('log')->debug(sprintf('Mutator is now: %s', $mutator->format('Y-m-d')));
diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php
index 3e21a7fa31..ef7e1b821a 100644
--- a/app/Repositories/Rule/RuleRepository.php
+++ b/app/Repositories/Rule/RuleRepository.php
@@ -223,7 +223,7 @@ class RuleRepository implements RuleRepositoryInterface
*/
public function store(array $data): Rule
{
- $ruleGroup = null;
+ $ruleGroup = null;
if (array_key_exists('rule_group_id', $data)) {
$ruleGroup = $this->user->ruleGroups()->find($data['rule_group_id']);
}
@@ -235,7 +235,7 @@ class RuleRepository implements RuleRepositoryInterface
}
// start by creating a new rule:
- $rule = new Rule();
+ $rule = new Rule();
$rule->user()->associate($this->user);
$rule->userGroup()->associate($this->user->userGroup);
@@ -293,10 +293,10 @@ class RuleRepository implements RuleRepositoryInterface
public function setOrder(Rule $rule, int $newOrder): void
{
- $oldOrder = $rule->order;
- $groupId = $rule->rule_group_id;
- $maxOrder = $this->maxOrder($rule->ruleGroup);
- $newOrder = $newOrder > $maxOrder ? $maxOrder + 1 : $newOrder;
+ $oldOrder = $rule->order;
+ $groupId = $rule->rule_group_id;
+ $maxOrder = $this->maxOrder($rule->ruleGroup);
+ $newOrder = $newOrder > $maxOrder ? $maxOrder + 1 : $newOrder;
app('log')->debug(sprintf('New order will be %d', $newOrder));
if ($newOrder > $oldOrder) {
@@ -333,7 +333,7 @@ class RuleRepository implements RuleRepositoryInterface
public function storeTrigger(Rule $rule, array $values): RuleTrigger
{
- $ruleTrigger = new RuleTrigger();
+ $ruleTrigger = new RuleTrigger();
$ruleTrigger->rule()->associate($rule);
$ruleTrigger->order = $values['order'];
$ruleTrigger->active = $values['active'];
@@ -347,7 +347,7 @@ class RuleRepository implements RuleRepositoryInterface
public function storeAction(Rule $rule, array $values): RuleAction
{
- $ruleAction = new RuleAction();
+ $ruleAction = new RuleAction();
$ruleAction->rule()->associate($rule);
$ruleAction->order = $values['order'];
$ruleAction->active = $values['active'];
@@ -377,7 +377,7 @@ class RuleRepository implements RuleRepositoryInterface
}
$rule->save();
$rule->refresh();
- $group = $rule->ruleGroup;
+ $group = $rule->ruleGroup;
// update the order:
$this->resetRuleOrder($group);
if (array_key_exists('order', $data)) {
@@ -425,7 +425,7 @@ class RuleRepository implements RuleRepositoryInterface
private function setRuleTrigger(string $moment, Rule $rule): void
{
/** @var null|RuleTrigger $trigger */
- $trigger = $rule->ruleTriggers()->where('trigger_type', 'user_action')->first();
+ $trigger = $rule->ruleTriggers()->where('trigger_type', 'user_action')->first();
if (null !== $trigger) {
$trigger->trigger_value = $moment;
$trigger->save();
@@ -454,7 +454,7 @@ class RuleRepository implements RuleRepositoryInterface
$type = sprintf('-%s', $type);
}
- $triggerValues = [
+ $triggerValues = [
'action' => $type,
'value' => $value,
'stop_processing' => $stopProcessing,
diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php
index 145a2c77cb..fa641f7d17 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepository.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php
@@ -365,7 +365,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
public function setOrder(RuleGroup $ruleGroup, int $newOrder): void
{
- $oldOrder = $ruleGroup->order;
+ $oldOrder = $ruleGroup->order;
if ($newOrder > $oldOrder) {
$this->user->ruleGroups()->where('rule_groups.order', '<=', $newOrder)->where('rule_groups.order', '>', $oldOrder)
diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php
index 2e77c1adc1..e9aaaf4d46 100644
--- a/app/Repositories/Tag/OperationsRepository.php
+++ b/app/Repositories/Tag/OperationsRepository.php
@@ -46,9 +46,9 @@ class OperationsRepository implements OperationsRepositoryInterface
public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $tags = null): array
{
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL]);
- $tagIds = [];
+ $tagIds = [];
if (null !== $accounts && $accounts->count() > 0) {
$collector->setAccounts($accounts);
}
@@ -65,7 +65,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$array = [];
$listedJournals = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
+ $currencyId = (int)$journal['currency_id'];
$array[$currencyId] ??= [
'tags' => [],
'currency_id' => $currencyId,
@@ -77,9 +77,9 @@ class OperationsRepository implements OperationsRepositoryInterface
// may have multiple tags:
foreach ($journal['tags'] as $tag) {
- $tagId = (int)$tag['id'];
- $tagName = (string)$tag['name'];
- $journalId = (int)$journal['transaction_journal_id'];
+ $tagId = (int)$tag['id'];
+ $tagName = (string)$tag['name'];
+ $journalId = (int)$journal['transaction_journal_id'];
if(!in_array($tagId, $tagIds, true)) {
continue;
}
@@ -88,7 +88,7 @@ class OperationsRepository implements OperationsRepositoryInterface
if (in_array($journalId, $listedJournals, true)) {
continue;
}
- $listedJournals[] = $journalId;
+ $listedJournals[] = $journalId;
$array[$currencyId]['tags'][$tagId] ??= [
'id' => $tagId,
'name' => $tagName,
@@ -128,9 +128,9 @@ class OperationsRepository implements OperationsRepositoryInterface
public function listIncome(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $tags = null): array
{
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT]);
- $tagIds = [];
+ $tagIds = [];
if (null !== $accounts && $accounts->count() > 0) {
$collector->setAccounts($accounts);
}
@@ -148,7 +148,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$listedJournals = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
+ $currencyId = (int)$journal['currency_id'];
$array[$currencyId] ??= [
'tags' => [],
'currency_id' => $currencyId,
@@ -160,9 +160,9 @@ class OperationsRepository implements OperationsRepositoryInterface
// may have multiple tags:
foreach ($journal['tags'] as $tag) {
- $tagId = (int)$tag['id'];
- $tagName = (string)$tag['name'];
- $journalId = (int)$journal['transaction_journal_id'];
+ $tagId = (int)$tag['id'];
+ $tagName = (string)$tag['name'];
+ $journalId = (int)$journal['transaction_journal_id'];
if(!in_array($tagId, $tagIds, true)) {
continue;
@@ -171,9 +171,9 @@ class OperationsRepository implements OperationsRepositoryInterface
if (in_array($journalId, $listedJournals, true)) {
continue;
}
- $listedJournals[] = $journalId;
+ $listedJournals[] = $journalId;
- $array[$currencyId]['tags'][$tagId] ??= [
+ $array[$currencyId]['tags'][$tagId] ??= [
'id' => $tagId,
'name' => $tagName,
'transaction_journals' => [],
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index 2ca33ce3f4..f9c7beb935 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -115,7 +115,7 @@ class TagRepository implements TagRepositoryInterface
public function getAttachments(Tag $tag): Collection
{
- $set = $tag->attachments()->get();
+ $set = $tag->attachments()->get();
/** @var \Storage $disk */
$disk = \Storage::disk('upload');
@@ -123,7 +123,7 @@ class TagRepository implements TagRepositoryInterface
return $set->each(
static function (Attachment $attachment) use ($disk): void {
/** @var null|Note $note */
- $note = $attachment->notes()->first();
+ $note = $attachment->notes()->first();
// only used in v1 view of tags
$attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = null === $note ? '' : $note->text;
@@ -134,7 +134,7 @@ class TagRepository implements TagRepositoryInterface
public function getTagsInYear(?int $year): array
{
// get all tags in the year (if present):
- $tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag');
+ $tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag');
// add date range (or not):
if (null === $year) {
@@ -240,13 +240,13 @@ class TagRepository implements TagRepositoryInterface
}
$collector->setTag($tag)->withAccountInformation();
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
- $sums = [];
+ $sums = [];
/** @var array $journal */
foreach ($journals as $journal) {
- $found = false;
+ $found = false;
/** @var array $localTag */
foreach ($journal['tags'] as $localTag) {
@@ -257,7 +257,7 @@ class TagRepository implements TagRepositoryInterface
if (false === $found) {
continue;
}
- $currencyId = (int) $journal['currency_id'];
+ $currencyId = (int) $journal['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -271,14 +271,14 @@ class TagRepository implements TagRepositoryInterface
];
// add amount to correct type:
- $amount = app('steam')->positive((string) $journal['amount']);
- $type = $journal['transaction_type_type'];
+ $amount = app('steam')->positive((string) $journal['amount']);
+ $type = $journal['transaction_type_type'];
if (TransactionType::WITHDRAWAL === $type) {
$amount = bcmul($amount, '-1');
}
$sums[$currencyId][$type] = bcadd($sums[$currencyId][$type], $amount);
- $foreignCurrencyId = $journal['foreign_currency_id'];
+ $foreignCurrencyId = $journal['foreign_currency_id'];
if (null !== $foreignCurrencyId && 0 !== $foreignCurrencyId) {
$sums[$foreignCurrencyId] ??= [
'currency_id' => $foreignCurrencyId,
@@ -292,7 +292,7 @@ class TagRepository implements TagRepositoryInterface
TransactionType::OPENING_BALANCE => '0',
];
// add foreign amount to correct type:
- $amount = app('steam')->positive((string) $journal['foreign_amount']);
+ $amount = app('steam')->positive((string) $journal['foreign_amount']);
if (TransactionType::WITHDRAWAL === $type) {
$amount = bcmul($amount, '-1');
}
@@ -357,7 +357,7 @@ class TagRepository implements TagRepositoryInterface
// otherwise, update or create.
if (!(null === $data['latitude'] && null === $data['longitude'] && null === $data['zoom_level'])) {
- $location = $this->getLocation($tag);
+ $location = $this->getLocation($tag);
if (null === $location) {
$location = new Location();
$location->locatable()->associate($tag);
diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
index 27613a0940..486fbf67b1 100644
--- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php
+++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
@@ -97,22 +97,22 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
{
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($this->user);
- $journals = $group->transactionJournals->pluck('id')->toArray();
- $set = Attachment::whereIn('attachable_id', $journals)
+ $journals = $group->transactionJournals->pluck('id')->toArray();
+ $set = Attachment::whereIn('attachable_id', $journals)
->where('attachable_type', TransactionJournal::class)
->where('uploaded', true)
->whereNull('deleted_at')->get()
;
- $result = [];
+ $result = [];
/** @var Attachment $attachment */
foreach ($set as $attachment) {
- $journalId = $attachment->attachable_id;
- $result[$journalId] ??= [];
- $current = $attachment->toArray();
- $current['file_exists'] = true;
- $current['notes'] = $repository->getNoteText($attachment);
+ $journalId = $attachment->attachable_id;
+ $result[$journalId] ??= [];
+ $current = $attachment->toArray();
+ $current['file_exists'] = true;
+ $current['notes'] = $repository->getNoteText($attachment);
// already determined that this attachable is a TransactionJournal.
$current['journal_title'] = $attachment->attachable->description; // @phpstan-ignore-line
$result[$journalId][] = $current;
@@ -165,7 +165,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
/** @var TransactionJournalLink $entry */
foreach ($set as $entry) {
- $journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id;
+ $journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id;
$return[$journalId] ??= [];
// phpstan: the editable field is provided by the query.
@@ -272,14 +272,14 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
continue;
}
// get currency preference.
- $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id)
+ $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id)
->where('name', 'currency_id')
->first()
;
if (null !== $currencyPreference) {
$currency = TransactionCurrency::where('id', $currencyPreference->data)->first();
}
- $journalId = $row->transaction_journal_id;
+ $journalId = $row->transaction_journal_id;
$return[$journalId] ??= [];
$return[$journalId][] = [
@@ -420,10 +420,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
if (0 === bccomp('0', $transaction->foreign_amount)) {
return '';
}
- $currency = $transaction->foreignCurrency;
- $type = $journal->transactionType->type;
- $amount = app('steam')->positive($transaction->foreign_amount);
- $return = '';
+ $currency = $transaction->foreignCurrency;
+ $type = $journal->transactionType->type;
+ $amount = app('steam')->positive($transaction->foreign_amount);
+ $return = '';
if (TransactionType::WITHDRAWAL === $type) {
$return = app('amount')->formatAnything($currency, app('steam')->negative($amount));
}
diff --git a/app/Repositories/TransactionType/TransactionTypeRepository.php b/app/Repositories/TransactionType/TransactionTypeRepository.php
index 3219b15a97..4e47c0cffa 100644
--- a/app/Repositories/TransactionType/TransactionTypeRepository.php
+++ b/app/Repositories/TransactionType/TransactionTypeRepository.php
@@ -40,7 +40,7 @@ class TransactionTypeRepository implements TransactionTypeRepositoryInterface
return $type;
}
$typeString ??= TransactionType::WITHDRAWAL;
- $search = $this->findByType($typeString);
+ $search = $this->findByType($typeString);
if (null === $search) {
$search = $this->findByType(TransactionType::WITHDRAWAL);
}
diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php
index b645719c88..8cb3b53854 100644
--- a/app/Repositories/User/UserRepository.php
+++ b/app/Repositories/User/UserRepository.php
@@ -49,7 +49,7 @@ class UserRepository implements UserRepositoryInterface
*/
public function changeEmail(User $user, string $newEmail): bool
{
- $oldEmail = $user->email;
+ $oldEmail = $user->email;
// save old email as pref
app('preferences')->setForUser($user, 'previous_email_latest', $oldEmail);
@@ -170,7 +170,7 @@ class UserRepository implements UserRepositoryInterface
public function getRolesInGroup(User $user, int $groupId): array
{
/** @var null|UserGroup $group */
- $group = UserGroup::find($groupId);
+ $group = UserGroup::find($groupId);
if (null === $group) {
throw new FireflyException(sprintf('Could not find group #%d', $groupId));
}
@@ -196,7 +196,7 @@ class UserRepository implements UserRepositoryInterface
*/
public function getUserData(User $user): array
{
- $return = [];
+ $return = [];
// two factor:
$return['has_2fa'] = null !== $user->mfa_secret;
@@ -244,9 +244,9 @@ class UserRepository implements UserRepositoryInterface
public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser
{
- $now = today(config('app.timezone'));
+ $now = today(config('app.timezone'));
$now->addDays(2);
- $invitee = new InvitedUser();
+ $invitee = new InvitedUser();
$invitee->user()->associate($user);
$invitee->invite_code = \Str::random(64);
$invitee->email = $email;
@@ -356,7 +356,7 @@ class UserRepository implements UserRepositoryInterface
if ('' === $newEmail) {
return true;
}
- $oldEmail = $user->email;
+ $oldEmail = $user->email;
// save old email as pref
app('preferences')->setForUser($user, 'admin_previous_email_latest', $oldEmail);
diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php
index b92a50aa3d..eae9cd69b7 100644
--- a/app/Repositories/UserGroup/UserGroupRepository.php
+++ b/app/Repositories/UserGroup/UserGroupRepository.php
@@ -49,7 +49,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
/** @var GroupMembership $membership */
foreach ($memberships as $membership) {
/** @var null|User $user */
- $user = $membership->user()->first();
+ $user = $membership->user()->first();
if (null === $user) {
continue;
}
@@ -78,7 +78,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
// all users are now moved away from user group.
// time to DESTROY all objects.
// we have to do this one by one to trigger the necessary observers :(
- $objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups',
+ $objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups',
'recurrences', 'rules', 'ruleGroups', 'tags', 'transactionGroups', 'transactionJournals', 'piggyBanks', 'accounts', 'webhooks',
];
foreach ($objects as $object) {
@@ -125,7 +125,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
$data['user'] = $this->user;
/** @var UserGroupFactory $factory */
- $factory = app(UserGroupFactory::class);
+ $factory = app(UserGroupFactory::class);
return $factory->create($data);
}
@@ -163,11 +163,11 @@ class UserGroupRepository implements UserGroupRepositoryInterface
*/
public function updateMembership(UserGroup $userGroup, array $data): UserGroup
{
- $owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first();
+ $owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first();
app('log')->debug('in update membership');
/** @var null|User $user */
- $user = null;
+ $user = null;
if (array_key_exists('id', $data)) {
/** @var null|User $user */
$user = User::find($data['id']);
@@ -252,7 +252,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
while ($exists && $loop < 10) {
$existingGroup = $this->findByName($groupName);
if (null === $existingGroup) {
- $exists = false;
+ $exists = false;
/** @var null|UserGroup $existingGroup */
$existingGroup = $this->store(['user' => $user, 'title' => $groupName]);
diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php
index 1bc45aeb0d..c9a765f52a 100644
--- a/app/Repositories/UserGroups/Account/AccountRepository.php
+++ b/app/Repositories/UserGroups/Account/AccountRepository.php
@@ -78,7 +78,7 @@ class AccountRepository implements AccountRepositoryInterface
public function findByName(string $name, array $types): ?Account
{
- $query = $this->userGroup->accounts();
+ $query = $this->userGroup->accounts();
if (0 !== count($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
@@ -102,8 +102,8 @@ class AccountRepository implements AccountRepositoryInterface
public function getAccountCurrency(Account $account): ?TransactionCurrency
{
- $type = $account->accountType->type;
- $list = config('firefly.valid_currency_account_types');
+ $type = $account->accountType->type;
+ $list = config('firefly.valid_currency_account_types');
// return null if not in this list.
if (!in_array($type, $list, true)) {
diff --git a/app/Repositories/UserGroups/Bill/BillRepository.php b/app/Repositories/UserGroups/Bill/BillRepository.php
index 144af5faf1..6e36453002 100644
--- a/app/Repositories/UserGroups/Bill/BillRepository.php
+++ b/app/Repositories/UserGroups/Bill/BillRepository.php
@@ -81,18 +81,18 @@ class BillRepository implements BillRepositoryInterface
$currencyId = $bill->transaction_currency_id;
$return[$currencyId] ??= [
- 'currency_id' => (string)$currency->id,
- 'currency_name' => $currency->name,
- 'currency_symbol' => $currency->symbol,
- 'currency_code' => $currency->code,
- 'currency_decimal_places' => $currency->decimal_places,
+ 'currency_id' => (string)$currency->id,
+ 'currency_name' => $currency->name,
+ 'currency_symbol' => $currency->symbol,
+ 'currency_code' => $currency->code,
+ 'currency_decimal_places' => $currency->decimal_places,
'native_currency_id' => (string)$default->id,
'native_currency_name' => $default->name,
'native_currency_symbol' => $default->symbol,
'native_currency_code' => $default->code,
'native_currency_decimal_places' => $default->decimal_places,
- 'sum' => '0',
- 'native_sum' => '0',
+ 'sum' => '0',
+ 'native_sum' => '0',
];
/** @var TransactionJournal $transactionJournal */
@@ -100,13 +100,13 @@ class BillRepository implements BillRepositoryInterface
/** @var null|Transaction $sourceTransaction */
$sourceTransaction = $transactionJournal->transactions()->where('amount', '<', 0)->first();
if (null !== $sourceTransaction) {
- $amount = $sourceTransaction->amount;
+ $amount = $sourceTransaction->amount;
if ((int)$sourceTransaction->foreign_currency_id === $currency->id) {
// use foreign amount instead!
$amount = (string)$sourceTransaction->foreign_amount;
}
// convert to native currency
- $nativeAmount = $amount;
+ $nativeAmount = $amount;
if ($currencyId !== $default->id) {
// get rate and convert.
$nativeAmount = $converter->convert($currency, $default, $transactionJournal->date, $amount);
@@ -153,19 +153,19 @@ class BillRepository implements BillRepositoryInterface
$currencyId = $bill->transaction_currency_id;
$average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2');
$nativeAverage = $converter->convert($currency, $default, $start, $average);
- $return[$currencyId] ??= [
- 'currency_id' => (string)$currency->id,
- 'currency_name' => $currency->name,
- 'currency_symbol' => $currency->symbol,
- 'currency_code' => $currency->code,
- 'currency_decimal_places' => $currency->decimal_places,
+ $return[$currencyId] ??= [
+ 'currency_id' => (string)$currency->id,
+ 'currency_name' => $currency->name,
+ 'currency_symbol' => $currency->symbol,
+ 'currency_code' => $currency->code,
+ 'currency_decimal_places' => $currency->decimal_places,
'native_currency_id' => (string)$default->id,
'native_currency_name' => $default->name,
'native_currency_symbol' => $default->symbol,
'native_currency_code' => $default->code,
'native_currency_decimal_places' => $default->decimal_places,
- 'sum' => '0',
- 'native_sum' => '0',
+ 'sum' => '0',
+ 'native_sum' => '0',
];
$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], bcmul($average, (string)$total));
$return[$currencyId]['native_sum'] = bcadd($return[$currencyId]['native_sum'], bcmul($nativeAverage, (string)$total));
@@ -200,7 +200,7 @@ class BillRepository implements BillRepositoryInterface
// app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
- $currentStart = clone $nextExpectedMatch;
+ $currentStart = clone $nextExpectedMatch;
}
return $set;
diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
index 66a8e7b4e1..1870d48dd0 100644
--- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php
@@ -51,7 +51,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
/** @var AvailableBudget $availableBudget */
foreach ($availableBudgets as $availableBudget) {
$currencyId = $availableBudget->transaction_currency_id;
- $return[$currencyId] ??= [
+ $return[$currencyId] ??= [
'currency_id' => $currencyId,
'currency_code' => $availableBudget->transactionCurrency->code,
'currency_symbol' => $availableBudget->transactionCurrency->symbol,
diff --git a/app/Repositories/UserGroups/Budget/OperationsRepository.php b/app/Repositories/UserGroups/Budget/OperationsRepository.php
index 8db50a46dc..1b115e1aba 100644
--- a/app/Repositories/UserGroups/Budget/OperationsRepository.php
+++ b/app/Repositories/UserGroups/Budget/OperationsRepository.php
@@ -56,13 +56,13 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setBudgets($this->getBudgets());
}
$collector->withBudgetInformation()->withAccountInformation()->withCategoryInformation();
- $journals = $collector->getExtractedJournals();
- $array = [];
+ $journals = $collector->getExtractedJournals();
+ $array = [];
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
- $budgetId = (int)$journal['budget_id'];
- $budgetName = (string)$journal['budget_name'];
+ $currencyId = (int)$journal['currency_id'];
+ $budgetId = (int)$journal['budget_id'];
+ $budgetName = (string)$journal['budget_name'];
// catch "no budget" entries.
if (0 === $budgetId) {
@@ -70,7 +70,7 @@ class OperationsRepository implements OperationsRepositoryInterface
}
// info about the currency:
- $array[$currencyId] ??= [
+ $array[$currencyId] ??= [
'budgets' => [],
'currency_id' => $currencyId,
'currency_name' => $journal['currency_name'],
@@ -88,8 +88,8 @@ class OperationsRepository implements OperationsRepositoryInterface
// add journal to array:
// only a subset of the fields.
- $journalId = (int)$journal['transaction_journal_id'];
- $final = [
+ $journalId = (int)$journal['transaction_journal_id'];
+ $final = [
'amount' => app('steam')->negative($journal['amount']),
'currency_id' => $journal['currency_id'],
'foreign_amount' => null,
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
index 217880e661..64c19bd2ba 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
@@ -62,7 +62,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
public function currencyInUseAt(TransactionCurrency $currency): ?string
{
app('log')->debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code));
- $countJournals = $this->countJournals($currency);
+ $countJournals = $this->countJournals($currency);
if ($countJournals > 0) {
app('log')->info(sprintf('Count journals is %d, return true.', $countJournals));
@@ -77,7 +77,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
}
// is being used in accounts:
- $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string)$currency->id))->count();
+ $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string)$currency->id))->count();
if ($meta > 0) {
app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta));
@@ -85,7 +85,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
}
// is being used in bills:
- $bills = Bill::where('transaction_currency_id', $currency->id)->count();
+ $bills = Bill::where('transaction_currency_id', $currency->id)->count();
if ($bills > 0) {
app('log')->info(sprintf('Used in %d bills as currency, return true. ', $bills));
@@ -103,7 +103,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
}
// is being used in accounts (as integer)
- $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
+ $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
->whereNull('accounts.deleted_at')
->where('account_meta.name', 'currency_id')->where('account_meta.data', json_encode($currency->id))->count()
;
@@ -122,7 +122,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
}
// is being used in budget limits
- $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count();
+ $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count();
if ($budgetLimit > 0) {
app('log')->info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit));
@@ -130,7 +130,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
}
// is the default currency for the user or the system
- $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count();
+ $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count();
if ($count > 0) {
app('log')->info('Is the default currency of the user, return true.');
@@ -138,7 +138,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
}
// is the default currency for the user or the system
- $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count();
+ $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count();
if ($count > 0) {
app('log')->info('Is the default currency of the user group, return true.');
@@ -159,10 +159,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface
$local = $this->get();
return $all->map(static function (TransactionCurrency $current) use ($local) {
- $hasId = $local->contains(static function (TransactionCurrency $entry) use ($current) {
+ $hasId = $local->contains(static function (TransactionCurrency $entry) use ($current) {
return $entry->id === $current->id;
});
- $isDefault = $local->contains(static function (TransactionCurrency $entry) use ($current) {
+ $isDefault = $local->contains(static function (TransactionCurrency $entry) use ($current) {
return 1 === (int)$entry->pivot->group_default && $entry->id === $current->id;
});
$current->userGroupEnabled = $hasId;
diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php
index a0c0ceff3d..8957d4f141 100644
--- a/app/Rules/BelongsUser.php
+++ b/app/Rules/BelongsUser.php
@@ -48,7 +48,7 @@ class BelongsUser implements ValidationRule
}
app('log')->debug(sprintf('Going to validate %s', $attribute));
- $result = match ($attribute) {
+ $result = match ($attribute) {
'piggy_bank_id' => $this->validatePiggyBankId((int)$value),
'piggy_bank_name' => $this->validatePiggyBankName($value),
'bill_id' => $this->validateBillId((int)$value),
@@ -78,7 +78,7 @@ class BelongsUser implements ValidationRule
if (PiggyBank::class !== $class) {
$objects = $class::where('user_id', '=', auth()->user()->id)->get();
}
- $count = 0;
+ $count = 0;
foreach ($objects as $object) {
$objectValue = trim((string)$object->{$field}); // @phpstan-ignore-line
app('log')->debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
diff --git a/app/Rules/BelongsUserGroup.php b/app/Rules/BelongsUserGroup.php
index e31cde0aa5..e43d2ce426 100644
--- a/app/Rules/BelongsUserGroup.php
+++ b/app/Rules/BelongsUserGroup.php
@@ -61,7 +61,7 @@ class BelongsUserGroup implements ValidationRule
}
app('log')->debug(sprintf('Group: Going to validate "%s"', $attribute));
- $result = match ($attribute) {
+ $result = match ($attribute) {
'piggy_bank_id' => $this->validatePiggyBankId((int)$value),
'piggy_bank_name' => $this->validatePiggyBankName($value),
'bill_id' => $this->validateBillId((int)$value),
@@ -91,7 +91,7 @@ class BelongsUserGroup implements ValidationRule
if (PiggyBank::class !== $class) {
$objects = $class::where('user_group_id', '=', $this->userGroup->id)->get();
}
- $count = 0;
+ $count = 0;
foreach ($objects as $object) {
$objectValue = trim((string)$object->{$field}); // @phpstan-ignore-line
app('log')->debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
diff --git a/app/Rules/IsAssetAccountId.php b/app/Rules/IsAssetAccountId.php
index 9a57ae4cee..5c4e715f36 100644
--- a/app/Rules/IsAssetAccountId.php
+++ b/app/Rules/IsAssetAccountId.php
@@ -40,7 +40,7 @@ class IsAssetAccountId implements ValidationRule
$accountId = (int)$value;
/** @var null|Account $account */
- $account = Account::with('accountType')->find($accountId);
+ $account = Account::with('accountType')->find($accountId);
if (null === $account) {
$fail('validation.no_asset_account')->translate();
diff --git a/app/Rules/IsTransferAccount.php b/app/Rules/IsTransferAccount.php
index 5b021fcefb..e61b07ee47 100644
--- a/app/Rules/IsTransferAccount.php
+++ b/app/Rules/IsTransferAccount.php
@@ -41,7 +41,7 @@ class IsTransferAccount implements ValidationRule
app('log')->debug(sprintf('Now in %s(%s)', __METHOD__, $value));
/** @var AccountValidator $validator */
- $validator = app(AccountValidator::class);
+ $validator = app(AccountValidator::class);
$validator->setTransactionType(TransactionType::TRANSFER);
$validator->setUser(auth()->user());
diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php
index 29c10e6704..6df894dfd4 100644
--- a/app/Rules/UniqueIban.php
+++ b/app/Rules/UniqueIban.php
@@ -145,7 +145,7 @@ class UniqueIban implements ValidationRule
$typesArray = [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
}
$query
- = auth()->user()
+ = auth()->user()
->accounts()
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('accounts.iban', $iban)
diff --git a/app/Rules/ValidRecurrenceRepetitionValue.php b/app/Rules/ValidRecurrenceRepetitionValue.php
index 318420c949..637b26b56a 100644
--- a/app/Rules/ValidRecurrenceRepetitionValue.php
+++ b/app/Rules/ValidRecurrenceRepetitionValue.php
@@ -78,8 +78,8 @@ class ValidRecurrenceRepetitionValue implements ValidationRule
if (2 !== count($parameters)) {
return false;
}
- $nthDay = (int)($parameters[0] ?? 0.0);
- $dayOfWeek = (int)($parameters[1] ?? 0.0);
+ $nthDay = (int)($parameters[0] ?? 0.0);
+ $dayOfWeek = (int)($parameters[1] ?? 0.0);
if ($nthDay < 1 || $nthDay > 5) {
return false;
}
diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
index b5d01c780f..24a10b8f84 100644
--- a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
+++ b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php
@@ -43,7 +43,7 @@ class UpdateRequest implements UpdateRequestInterface
];
// try get array from update server:
- $updateInfo = $this->contactServer($channel);
+ $updateInfo = $this->contactServer($channel);
if ('error' === $updateInfo['level']) {
app('log')->error('Update information contains an error.');
app('log')->error($updateInfo['message']);
@@ -60,14 +60,14 @@ class UpdateRequest implements UpdateRequestInterface
{
app('log')->debug(sprintf('Now in contactServer(%s)', $channel));
// always fall back to current version:
- $return = [
+ $return = [
'version' => config('firefly.version'),
'date' => today(config('app.timezone'))->startOfDay(),
'level' => 'error',
'message' => (string)trans('firefly.unknown_error'),
];
- $url = config('firefly.update_endpoint');
+ $url = config('firefly.update_endpoint');
app('log')->debug(sprintf('Going to call %s', $url));
try {
@@ -95,7 +95,7 @@ class UpdateRequest implements UpdateRequestInterface
return $return;
}
- $body = (string)$res->getBody();
+ $body = (string)$res->getBody();
try {
$json = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
@@ -114,8 +114,8 @@ class UpdateRequest implements UpdateRequestInterface
}
// parse response a bit. No message yet.
- $response = $json['firefly_iii'][$channel];
- $date = Carbon::createFromFormat('Y-m-d', $response['date']);
+ $response = $json['firefly_iii'][$channel];
+ $date = Carbon::createFromFormat('Y-m-d', $response['date']);
if (false === $date) {
$date = today(config('app.timezone'));
}
@@ -131,19 +131,19 @@ class UpdateRequest implements UpdateRequestInterface
private function parseResult(array $information): array
{
app('log')->debug('Now in parseResult()', $information);
- $return = [
+ $return = [
'level' => 'error',
'message' => (string)trans('firefly.unknown_error'),
];
- $current = config('firefly.version');
- $latest = $information['version'];
+ $current = config('firefly.version');
+ $latest = $information['version'];
// strip the 'v' from the version if it's there.
if (str_starts_with($latest, 'v')) {
$latest = substr($latest, 1);
}
- $compare = version_compare($latest, $current);
+ $compare = version_compare($latest, $current);
app('log')->debug(sprintf('Current version is "%s", latest is "%s", result is: %d', $current, $latest, $compare));
@@ -166,10 +166,10 @@ class UpdateRequest implements UpdateRequestInterface
// a newer version is available!
/** @var Carbon $released */
- $released = $information['date'];
- $today = today(config('app.timezone'))->startOfDay();
- $diff = $today->diffInDays($released);
- $expectedDiff = config('firefly.update_minimum_age') ?? 6;
+ $released = $information['date'];
+ $today = today(config('app.timezone'))->startOfDay();
+ $diff = $today->diffInDays($released);
+ $expectedDiff = config('firefly.update_minimum_age') ?? 6;
// it's still very fresh, and user wants a stable release:
if ($diff <= $expectedDiff) {
$return['level'] = 'info';
@@ -200,13 +200,13 @@ class UpdateRequest implements UpdateRequestInterface
// add warning in case of alpha or beta:
// append warning if beta or alpha.
- $isBeta = $information['is_beta'] ?? false;
+ $isBeta = $information['is_beta'] ?? false;
if (true === $isBeta) {
$return['message'] = sprintf('%s %s', $return['message'], trans('firefly.update_version_beta'));
app('log')->debug('New release is also a beta!');
}
- $isAlpha = $information['is_alpha'] ?? false;
+ $isAlpha = $information['is_alpha'] ?? false;
if (true === $isAlpha) {
$return['message'] = sprintf('%s %s', $return['message'], trans('firefly.update_version_alpha'));
app('log')->debug('New release is also a alpha!');
diff --git a/app/Services/Internal/Destroy/AccountDestroyService.php b/app/Services/Internal/Destroy/AccountDestroyService.php
index a388fe25cb..2aefdf29eb 100644
--- a/app/Services/Internal/Destroy/AccountDestroyService.php
+++ b/app/Services/Internal/Destroy/AccountDestroyService.php
@@ -75,8 +75,8 @@ class AccountDestroyService
}
/** @var JournalDestroyService $service */
- $service = app(JournalDestroyService::class);
- $user = $account->user;
+ $service = app(JournalDestroyService::class);
+ $user = $account->user;
/** @var \stdClass $row */
foreach ($collection as $row) {
@@ -101,7 +101,7 @@ class AccountDestroyService
->get(['transactions.transaction_journal_id'])
;
if ($set->count() > 0) {
- $journalId = $set->first()->transaction_journal_id;
+ $journalId = $set->first()->transaction_journal_id;
app('log')->debug(sprintf('Found opening balance journal with ID #%d', $journalId));
// get transactions with this journal (should be just one):
@@ -120,7 +120,7 @@ class AccountDestroyService
$transaction->delete();
$ibAccount->delete();
}
- $journal = TransactionJournal::find($journalId);
+ $journal = TransactionJournal::find($journalId);
if (null !== $journal) {
/** @var JournalDestroyService $service */
$service = app(JournalDestroyService::class);
@@ -157,7 +157,7 @@ class AccountDestroyService
private function destroyRecurrences(Account $account): void
{
- $recurrences = RecurrenceTransaction::where(
+ $recurrences = RecurrenceTransaction::where(
static function (Builder $q) use ($account): void {
$q->where('source_id', $account->id);
$q->orWhere('destination_id', $account->id);
diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php
index b35b7518ec..3c10ead36e 100644
--- a/app/Services/Internal/Support/AccountServiceTrait.php
+++ b/app/Services/Internal/Support/AccountServiceTrait.php
@@ -94,14 +94,14 @@ trait AccountServiceTrait
*/
public function updateMetaData(Account $account, array $data): void
{
- $fields = $this->validFields;
+ $fields = $this->validFields;
if (AccountType::ASSET === $account->accountType->type) {
$fields = $this->validAssetFields;
}
// remove currency_id if necessary.
- $type = $account->accountType->type;
- $list = config('firefly.valid_currency_account_types');
+ $type = $account->accountType->type;
+ $list = config('firefly.valid_currency_account_types');
if (!in_array($type, $list, true)) {
$pos = array_search('currency_id', $fields, true);
if (false !== $pos) {
@@ -150,7 +150,7 @@ trait AccountServiceTrait
public function updateNote(Account $account, string $note): bool
{
- $dbNote = $account->notes()->first();
+ $dbNote = $account->notes()->first();
if ('' === $note) {
if (null !== $dbNote) {
$dbNote->delete();
@@ -196,7 +196,7 @@ trait AccountServiceTrait
protected function createOBGroup(Account $account, array $data): TransactionGroup
{
app('log')->debug('Now going to create an OB group.');
- $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
+ $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
if (is_array($language)) {
$language = 'en_US';
}
@@ -227,10 +227,10 @@ trait AccountServiceTrait
}
// make amount positive, regardless:
- $amount = app('steam')->positive($amount);
+ $amount = app('steam')->positive($amount);
// get or grab currency:
- $currency = $this->accountRepository->getAccountCurrency($account);
+ $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
}
@@ -268,7 +268,7 @@ trait AccountServiceTrait
app('log')->debug('Going for submission in createOBGroup', $submission);
/** @var TransactionGroupFactory $factory */
- $factory = app(TransactionGroupFactory::class);
+ $factory = app(TransactionGroupFactory::class);
$factory->setUser($account->user);
try {
@@ -343,10 +343,10 @@ trait AccountServiceTrait
{
// find currency, or use default currency instead.
/** @var TransactionCurrencyFactory $factory */
- $factory = app(TransactionCurrencyFactory::class);
+ $factory = app(TransactionCurrencyFactory::class);
/** @var null|TransactionCurrency $currency */
- $currency = $factory->find($currencyId, $currencyCode);
+ $currency = $factory->find($currencyId, $currencyCode);
if (null === $currency) {
// use default currency:
@@ -374,7 +374,7 @@ trait AccountServiceTrait
}
// if direction is "debit" (i owe this debt), amount is negative.
// which means the liability will have a negative balance which the user must fill.
- $openingBalance = app('steam')->negative($openingBalance);
+ $openingBalance = app('steam')->negative($openingBalance);
// if direction is "credit" (I am owed this debt), amount is positive.
// which means the liability will have a positive balance which is drained when its paid back into any asset.
@@ -383,21 +383,21 @@ trait AccountServiceTrait
}
// create if not exists:
- $clGroup = $this->getCreditTransaction($account);
+ $clGroup = $this->getCreditTransaction($account);
if (null === $clGroup) {
return $this->createCreditTransaction($account, $openingBalance, $openingBalanceDate);
}
// if exists, update:
- $currency = $this->accountRepository->getAccountCurrency($account);
+ $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
}
// simply grab the first journal and change it:
- $journal = $this->getObJournal($clGroup);
- $clTransaction = $this->getOBTransaction($journal, $account);
- $accountTransaction = $this->getNotOBTransaction($journal, $account);
- $journal->date = $openingBalanceDate;
+ $journal = $this->getObJournal($clGroup);
+ $clTransaction = $this->getOBTransaction($journal, $account);
+ $accountTransaction = $this->getNotOBTransaction($journal, $account);
+ $journal->date = $openingBalanceDate;
$journal->transactionCurrency()->associate($currency);
// account always gains money:
@@ -405,8 +405,8 @@ trait AccountServiceTrait
$accountTransaction->transaction_currency_id = $currency->id;
// CL account always loses money:
- $clTransaction->amount = app('steam')->negative($openingBalance);
- $clTransaction->transaction_currency_id = $currency->id;
+ $clTransaction->amount = app('steam')->negative($openingBalance);
+ $clTransaction->transaction_currency_id = $currency->id;
// save both
$accountTransaction->save();
$clTransaction->save();
@@ -429,11 +429,11 @@ trait AccountServiceTrait
throw new FireflyException('Amount for new liability credit was unexpectedly 0.');
}
- $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
+ $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
if (is_array($language)) {
$language = 'en_US';
}
- $language = (string)$language;
+ $language = (string)$language;
// set source and/or destination based on whether the amount is positive or negative.
// first, assume the amount is positive and go from there:
@@ -451,10 +451,10 @@ trait AccountServiceTrait
}
// amount must be positive for the transaction to work.
- $amount = app('steam')->positive($openingBalance);
+ $amount = app('steam')->positive($openingBalance);
// get or grab currency:
- $currency = $this->accountRepository->getAccountCurrency($account);
+ $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
}
@@ -492,7 +492,7 @@ trait AccountServiceTrait
app('log')->debug('Going for submission in createCreditTransaction', $submission);
/** @var TransactionGroupFactory $factory */
- $factory = app(TransactionGroupFactory::class);
+ $factory = app(TransactionGroupFactory::class);
$factory->setUser($account->user);
try {
@@ -517,14 +517,14 @@ trait AccountServiceTrait
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
// create if not exists:
- $obGroup = $this->getOBGroup($account);
+ $obGroup = $this->getOBGroup($account);
if (null === $obGroup) {
return $this->createOBGroupV2($account, $openingBalance, $openingBalanceDate);
}
app('log')->debug('Update OB group');
// if exists, update:
- $currency = $this->accountRepository->getAccountCurrency($account);
+ $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
}
@@ -544,8 +544,8 @@ trait AccountServiceTrait
$accountTransaction->transaction_currency_id = $currency->id;
// OB account transaction gains money
- $obTransaction->amount = app('steam')->positive($openingBalance);
- $obTransaction->transaction_currency_id = $currency->id;
+ $obTransaction->amount = app('steam')->positive($openingBalance);
+ $obTransaction->transaction_currency_id = $currency->id;
}
if (-1 === bccomp('0', $openingBalance)) {
app('log')->debug('Amount is positive.');
@@ -554,8 +554,8 @@ trait AccountServiceTrait
$accountTransaction->transaction_currency_id = $currency->id;
// OB account loses money:
- $obTransaction->amount = app('steam')->negative($openingBalance);
- $obTransaction->transaction_currency_id = $currency->id;
+ $obTransaction->amount = app('steam')->negative($openingBalance);
+ $obTransaction->transaction_currency_id = $currency->id;
}
// save both
$accountTransaction->save();
@@ -572,7 +572,7 @@ trait AccountServiceTrait
protected function createOBGroupV2(Account $account, string $openingBalance, Carbon $openingBalanceDate): TransactionGroup
{
app('log')->debug('Now going to create an OB group.');
- $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
+ $language = app('preferences')->getForUser($account->user, 'language', 'en_US')->data;
if (is_array($language)) {
$language = 'en_US';
}
@@ -602,10 +602,10 @@ trait AccountServiceTrait
}
// make amount positive, regardless:
- $amount = app('steam')->positive($openingBalance);
+ $amount = app('steam')->positive($openingBalance);
// get or grab currency:
- $currency = $this->accountRepository->getAccountCurrency($account);
+ $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
}
@@ -643,7 +643,7 @@ trait AccountServiceTrait
app('log')->debug('Going for submission in createOBGroupV2', $submission);
/** @var TransactionGroupFactory $factory */
- $factory = app(TransactionGroupFactory::class);
+ $factory = app(TransactionGroupFactory::class);
$factory->setUser($account->user);
try {
diff --git a/app/Services/Internal/Support/BillServiceTrait.php b/app/Services/Internal/Support/BillServiceTrait.php
index 15bc6514ff..7bace4e657 100644
--- a/app/Services/Internal/Support/BillServiceTrait.php
+++ b/app/Services/Internal/Support/BillServiceTrait.php
@@ -61,7 +61,7 @@ trait BillServiceTrait
return true;
}
- $dbNote = $bill->notes()->first();
+ $dbNote = $bill->notes()->first();
if (null === $dbNote) {
$dbNote = new Note();
$dbNote->noteable()->associate($bill);
diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php
index ecfe0057b3..aef6a058d1 100644
--- a/app/Services/Internal/Support/CreditRecalculateService.php
+++ b/app/Services/Internal/Support/CreditRecalculateService.php
@@ -104,7 +104,7 @@ class CreditRecalculateService
$destination = $this->getDestinationAccount($journal);
// destination or source must be liability.
- $valid = config('firefly.valid_liabilities');
+ $valid = config('firefly.valid_liabilities');
if (in_array($destination->accountType->type, $valid, true)) {
$this->work[] = $destination;
}
@@ -127,7 +127,7 @@ class CreditRecalculateService
private function getAccountByDirection(TransactionJournal $journal, string $direction): Account
{
/** @var null|Transaction $transaction */
- $transaction = $journal->transactions()->where('amount', $direction, '0')->first();
+ $transaction = $journal->transactions()->where('amount', $direction, '0')->first();
if (null === $transaction) {
throw new FireflyException(sprintf('Cannot find "%s"-transaction of journal #%d', $direction, $journal->id));
}
@@ -179,12 +179,12 @@ class CreditRecalculateService
$this->validateOpeningBalance($account, $openingBalance);
}
}
- $startOfDebt = $this->repository->getOpeningBalanceAmount($account) ?? '0';
- $leftOfDebt = app('steam')->positive($startOfDebt);
+ $startOfDebt = $this->repository->getOpeningBalanceAmount($account) ?? '0';
+ $leftOfDebt = app('steam')->positive($startOfDebt);
app('log')->debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', app('steam')->bcround($startOfDebt, 2), app('steam')->bcround($leftOfDebt, 2)));
/** @var AccountMetaFactory $factory */
- $factory = app(AccountMetaFactory::class);
+ $factory = app(AccountMetaFactory::class);
// amount is positive or negative, doesn't matter.
$factory->crud($account, 'start_of_debt', $startOfDebt);
@@ -192,12 +192,12 @@ class CreditRecalculateService
app('log')->debug(sprintf('Debt direction is "%s"', $direction));
// now loop all transactions (except opening balance and credit thing)
- $transactions = $account->transactions()
+ $transactions = $account->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->orderBy('transaction_journals.date', 'ASC')
->get(['transactions.*'])
;
- $total = $transactions->count();
+ $total = $transactions->count();
app('log')->debug(sprintf('Found %d transaction(s) to process.', $total));
/** @var Transaction $transaction */
@@ -218,7 +218,7 @@ class CreditRecalculateService
$source = $openingBalance->transactions()->where('amount', '<', 0)->first();
/** @var Transaction $dest */
- $dest = $openingBalance->transactions()->where('amount', '>', 0)->first();
+ $dest = $openingBalance->transactions()->where('amount', '>', 0)->first();
if ($source->account_id !== $account->id) {
app('log')->info(sprintf('Liability #%d has a reversed opening balance. Will fix this now.', $account->id));
app('log')->debug(sprintf('Source amount "%s" is now "%s"', $source->amount, app('steam')->positive($source->amount)));
@@ -269,10 +269,10 @@ class CreditRecalculateService
}
// amount to use depends on the currency:
- $usedAmount = $this->getAmountToUse($transaction, $accountCurrency, $foreignCurrency);
- $isSameAccount = $account->id === $transaction->account_id;
- $isDebit = 'debit' === $direction;
- $isCredit = 'credit' === $direction;
+ $usedAmount = $this->getAmountToUse($transaction, $accountCurrency, $foreignCurrency);
+ $isSameAccount = $account->id === $transaction->account_id;
+ $isDebit = 'debit' === $direction;
+ $isCredit = 'credit' === $direction;
if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1
$usedAmount = app('steam')->positive($usedAmount);
diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php
index f7dfabc158..1a1688d801 100644
--- a/app/Services/Internal/Support/JournalServiceTrait.php
+++ b/app/Services/Internal/Support/JournalServiceTrait.php
@@ -61,23 +61,23 @@ trait JournalServiceTrait
unset($array);
// and now try to find it, based on the type of transaction.
- $message = 'Transaction = %s, %s account should be in: %s. Direction is %s.';
+ $message = 'Transaction = %s, %s account should be in: %s. Direction is %s.';
app('log')->debug(sprintf($message, $transactionType, $direction, implode(', ', $expectedTypes[$transactionType] ?? ['UNKNOWN']), $direction));
- $result = $this->findAccountById($data, $expectedTypes[$transactionType]);
- $result = $this->findAccountByIban($result, $data, $expectedTypes[$transactionType]);
- $ibanResult = $result;
- $result = $this->findAccountByNumber($result, $data, $expectedTypes[$transactionType]);
- $numberResult = $result;
- $result = $this->findAccountByName($result, $data, $expectedTypes[$transactionType]);
- $nameResult = $result;
+ $result = $this->findAccountById($data, $expectedTypes[$transactionType]);
+ $result = $this->findAccountByIban($result, $data, $expectedTypes[$transactionType]);
+ $ibanResult = $result;
+ $result = $this->findAccountByNumber($result, $data, $expectedTypes[$transactionType]);
+ $numberResult = $result;
+ $result = $this->findAccountByName($result, $data, $expectedTypes[$transactionType]);
+ $nameResult = $result;
// if $result (find by name) is NULL, but IBAN is set, any result of the search by NAME can't overrule
// this account. In such a case, the name search must be retried with a new name.
if (null !== $nameResult && null === $numberResult && null === $ibanResult && '' !== (string)$data['iban'] && '' !== (string)$nameResult->iban) {
$data['name'] = sprintf('%s (%s)', $data['name'], $data['iban']);
app('log')->debug(sprintf('Search again using the new name, "%s".', $data['name']));
- $result = $this->findAccountByName(null, $data, $expectedTypes[$transactionType]);
+ $result = $this->findAccountByName(null, $data, $expectedTypes[$transactionType]);
}
// the account that Firefly III creates must be "creatable", aka select the one we can create from the list just in case
diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php
index cb778faedd..dea51b3445 100644
--- a/app/Services/Internal/Support/RecurringTransactionTrait.php
+++ b/app/Services/Internal/Support/RecurringTransactionTrait.php
@@ -56,7 +56,7 @@ trait RecurringTransactionTrait
return true;
}
- $dbNote = $recurrence->notes()->first();
+ $dbNote = $recurrence->notes()->first();
if (null === $dbNote) {
$dbNote = new Note();
$dbNote->noteable()->associate($recurrence);
@@ -95,10 +95,10 @@ trait RecurringTransactionTrait
app('log')->debug('Now in createTransactions()');
foreach ($transactions as $index => $array) {
app('log')->debug(sprintf('Now at transaction #%d', $index));
- $sourceTypes = config(sprintf('firefly.expected_source_types.source.%s', $recurrence->transactionType->type));
- $destTypes = config(sprintf('firefly.expected_source_types.destination.%s', $recurrence->transactionType->type));
- $source = $this->findAccount($sourceTypes, $array['source_id'], null);
- $destination = $this->findAccount($destTypes, $array['destination_id'], null);
+ $sourceTypes = config(sprintf('firefly.expected_source_types.source.%s', $recurrence->transactionType->type));
+ $destTypes = config(sprintf('firefly.expected_source_types.destination.%s', $recurrence->transactionType->type));
+ $source = $this->findAccount($sourceTypes, $array['source_id'], null);
+ $destination = $this->findAccount($destTypes, $array['destination_id'], null);
/** @var TransactionCurrencyFactory $factory */
$factory = app(TransactionCurrencyFactory::class);
@@ -114,7 +114,7 @@ trait RecurringTransactionTrait
// once the accounts have been determined, we still verify their validity:
/** @var AccountValidator $validator */
- $validator = app(AccountValidator::class);
+ $validator = app(AccountValidator::class);
$validator->setUser($recurrence->user);
$validator->setTransactionType($recurrence->transactionType->type);
@@ -129,7 +129,7 @@ trait RecurringTransactionTrait
unset($array['foreign_amount']);
}
// TODO typeOverrule. The account validator may have a different opinion on the type of the transaction.
- $transaction = new RecurrenceTransaction(
+ $transaction = new RecurrenceTransaction(
[
'recurrence_id' => $recurrence->id,
'transaction_currency_id' => $currency->id,
@@ -166,22 +166,22 @@ trait RecurringTransactionTrait
protected function findAccount(array $expectedTypes, ?int $accountId, ?string $accountName): Account
{
- $result = null;
- $accountId = (int) $accountId;
- $accountName = (string) $accountName;
+ $result = null;
+ $accountId = (int) $accountId;
+ $accountName = (string) $accountName;
/** @var AccountRepositoryInterface $repository */
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
// if user has submitted an account ID, search for it.
- $result = $repository->find($accountId);
+ $result = $repository->find($accountId);
if (null !== $result) {
return $result;
}
// if user has submitted a name, search for it:
- $result = $repository->findByName($accountName, $expectedTypes);
+ $result = $repository->findByName($accountName, $expectedTypes);
if (null !== $result) {
return $result;
}
@@ -190,7 +190,7 @@ trait RecurringTransactionTrait
$cannotCreate = [AccountType::ASSET, AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD];
/** @var AccountFactory $factory */
- $factory = app(AccountFactory::class);
+ $factory = app(AccountFactory::class);
$factory->setUser($this->user);
/** @var string $expectedType */
@@ -213,12 +213,12 @@ trait RecurringTransactionTrait
protected function updatePiggyBank(RecurrenceTransaction $transaction, int $piggyId): void
{
/** @var PiggyBankFactory $factory */
- $factory = app(PiggyBankFactory::class);
+ $factory = app(PiggyBankFactory::class);
$factory->setUser($transaction->recurrence->user);
$piggyBank = $factory->find($piggyId, null);
if (null !== $piggyBank) {
/** @var null|RecurrenceMeta $entry */
- $entry = $transaction->recurrenceTransactionMeta()->where('name', 'piggy_bank_id')->first();
+ $entry = $transaction->recurrenceTransactionMeta()->where('name', 'piggy_bank_id')->first();
if (null === $entry) {
$entry = RecurrenceTransactionMeta::create(['rt_id' => $transaction->id, 'name' => 'piggy_bank_id', 'value' => $piggyBank->id]);
}
@@ -235,7 +235,7 @@ trait RecurringTransactionTrait
{
if (0 !== count($tags)) {
/** @var null|RecurrenceMeta $entry */
- $entry = $transaction->recurrenceTransactionMeta()->where('name', 'tags')->first();
+ $entry = $transaction->recurrenceTransactionMeta()->where('name', 'tags')->first();
if (null === $entry) {
$entry = RecurrenceTransactionMeta::create(['rt_id' => $transaction->id, 'name' => 'tags', 'value' => json_encode($tags)]);
}
@@ -269,18 +269,18 @@ trait RecurringTransactionTrait
{
$budgetFactory = app(BudgetFactory::class);
$budgetFactory->setUser($transaction->recurrence->user);
- $budget = $budgetFactory->find($budgetId, null);
+ $budget = $budgetFactory->find($budgetId, null);
if (null === $budget) {
return;
}
- $meta = $transaction->recurrenceTransactionMeta()->where('name', 'budget_id')->first();
+ $meta = $transaction->recurrenceTransactionMeta()->where('name', 'budget_id')->first();
if (null === $meta) {
$meta = new RecurrenceTransactionMeta();
$meta->rt_id = $transaction->id;
$meta->name = 'budget_id';
}
- $meta->value = $budget->id;
+ $meta->value = $budget->id;
$meta->save();
}
@@ -288,12 +288,12 @@ trait RecurringTransactionTrait
{
$billFactory = app(BillFactory::class);
$billFactory->setUser($transaction->recurrence->user);
- $bill = $billFactory->find($billId, null);
+ $bill = $billFactory->find($billId, null);
if (null === $bill) {
return;
}
- $meta = $transaction->recurrenceTransactionMeta()->where('name', 'bill_id')->first();
+ $meta = $transaction->recurrenceTransactionMeta()->where('name', 'bill_id')->first();
if (null === $meta) {
$meta = new RecurrenceTransactionMeta();
$meta->rt_id = $transaction->id;
@@ -307,7 +307,7 @@ trait RecurringTransactionTrait
{
$categoryFactory = app(CategoryFactory::class);
$categoryFactory->setUser($transaction->recurrence->user);
- $category = $categoryFactory->findOrCreate($categoryId, null);
+ $category = $categoryFactory->findOrCreate($categoryId, null);
if (null === $category) {
// remove category:
$transaction->recurrenceTransactionMeta()->where('name', 'category_id')->delete();
@@ -316,13 +316,13 @@ trait RecurringTransactionTrait
return;
}
$transaction->recurrenceTransactionMeta()->where('name', 'category_name')->delete();
- $meta = $transaction->recurrenceTransactionMeta()->where('name', 'category_id')->first();
+ $meta = $transaction->recurrenceTransactionMeta()->where('name', 'category_id')->first();
if (null === $meta) {
$meta = new RecurrenceTransactionMeta();
$meta->rt_id = $transaction->id;
$meta->name = 'category_id';
}
- $meta->value = $category->id;
+ $meta->value = $category->id;
$meta->save();
}
}
diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php
index 7831bb8bdc..1ee69ae2bf 100644
--- a/app/Services/Internal/Update/AccountUpdateService.php
+++ b/app/Services/Internal/Update/AccountUpdateService.php
@@ -74,7 +74,7 @@ class AccountUpdateService
// find currency, or use default currency instead.
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
- $currency = $this->getCurrency((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null));
+ $currency = $this->getCurrency((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null));
unset($data['currency_code'], $data['currency_id']);
$data['currency_id'] = $currency->id;
}
@@ -118,17 +118,17 @@ class AccountUpdateService
return $account;
}
// skip if not of orderable type.
- $type = $account->accountType->type;
+ $type = $account->accountType->type;
if (!in_array($type, [AccountType::ASSET, AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT], true)) {
app('log')->debug('Will not change order of this account.');
return $account;
}
// get account type ID's because a join and an update is hard:
- $oldOrder = $account->order;
- $newOrder = $data['order'];
+ $oldOrder = $account->order;
+ $newOrder = $data['order'];
app('log')->debug(sprintf('Order is set to be updated from %s to %s', $oldOrder, $newOrder));
- $list = $this->getTypeIds([AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT]);
+ $list = $this->getTypeIds([AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT]);
if (AccountType::ASSET === $type) {
$list = $this->getTypeIds([AccountType::ASSET]);
}
@@ -235,7 +235,7 @@ class AccountUpdateService
// otherwise, update or create.
if (!(null === $data['latitude'] && null === $data['longitude'] && null === $data['zoom_level'])) {
- $location = $this->accountRepository->getLocation($account);
+ $location = $this->accountRepository->getLocation($account);
if (null === $location) {
$location = new Location();
$location->locatable()->associate($account);
@@ -291,11 +291,11 @@ class AccountUpdateService
if (true === $account->active) {
return;
}
- $preference = app('preferences')->getForUser($account->user, 'frontpageAccounts');
+ $preference = app('preferences')->getForUser($account->user, 'frontpageAccounts');
if (null === $preference) {
return;
}
- $array = $preference->data;
+ $array = $preference->data;
if (!is_array($array)) {
$array = [$array];
}
diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php
index 855c1651ed..63898994dd 100644
--- a/app/Services/Internal/Update/BillUpdateService.php
+++ b/app/Services/Internal/Update/BillUpdateService.php
@@ -52,22 +52,22 @@ class BillUpdateService
$this->user = $bill->user;
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
- $factory = app(TransactionCurrencyFactory::class);
- $currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) ??
+ $factory = app(TransactionCurrencyFactory::class);
+ $currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) ??
app('amount')->getDefaultCurrencyByUserGroup($bill->user->userGroup);
// enable the currency if it isn't.
- $currency->enabled = true;
+ $currency->enabled = true;
$currency->save();
$bill->transaction_currency_id = $currency->id;
$bill->save();
}
// update bill properties:
- $bill = $this->updateBillProperties($bill, $data);
+ $bill = $this->updateBillProperties($bill, $data);
$bill->save();
$bill->refresh();
// old values
- $oldData = [
+ $oldData = [
'name' => $bill->name,
'amount_min' => $bill->amount_min,
'amount_max' => $bill->amount_max,
@@ -197,14 +197,14 @@ class BillUpdateService
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$repository->setUser($bill->user);
- $rules = $repository->getRulesForBill($bill);
+ $rules = $repository->getRulesForBill($bill);
if (0 === $rules->count()) {
app('log')->debug('Found no rules.');
return;
}
app('log')->debug(sprintf('Found %d rules', $rules->count()));
- $fields = [
+ $fields = [
'name' => 'description_contains',
'amount_min' => 'amount_more',
'amount_max' => 'amount_less',
diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.php
index 0863bd7119..8d4a7067e5 100644
--- a/app/Services/Internal/Update/CategoryUpdateService.php
+++ b/app/Services/Internal/Update/CategoryUpdateService.php
@@ -131,7 +131,7 @@ class CategoryUpdateService
*/
private function updateNotes(Category $category, array $data): void
{
- $note = array_key_exists('notes', $data) ? $data['notes'] : null;
+ $note = array_key_exists('notes', $data) ? $data['notes'] : null;
if (null === $note) {
return;
}
@@ -143,7 +143,7 @@ class CategoryUpdateService
return;
}
- $dbNote = $category->notes()->first();
+ $dbNote = $category->notes()->first();
if (null === $dbNote) {
$dbNote = new Note();
$dbNote->noteable()->associate($category);
diff --git a/app/Services/Internal/Update/CurrencyUpdateService.php b/app/Services/Internal/Update/CurrencyUpdateService.php
index 8fd3c2b6dc..3a6adf9705 100644
--- a/app/Services/Internal/Update/CurrencyUpdateService.php
+++ b/app/Services/Internal/Update/CurrencyUpdateService.php
@@ -44,7 +44,7 @@ class CurrencyUpdateService
$currency->name = e($data['name']);
}
- $currency->enabled = false;
+ $currency->enabled = false;
if (array_key_exists('decimal_places', $data) && is_int($data['decimal_places'])) {
$currency->decimal_places = $data['decimal_places'];
diff --git a/app/Services/Internal/Update/GroupCloneService.php b/app/Services/Internal/Update/GroupCloneService.php
index 2d1240b4d5..e3353d6ada 100644
--- a/app/Services/Internal/Update/GroupCloneService.php
+++ b/app/Services/Internal/Update/GroupCloneService.php
@@ -97,7 +97,7 @@ class GroupCloneService
// add relation.
// TODO clone ALL linked piggy banks
/** @var null|PiggyBankEvent $event */
- $event = $journal->piggyBankEvents()->first();
+ $event = $journal->piggyBankEvents()->first();
if (null !== $event) {
$piggyBank = $event->piggyBank;
$factory = app(PiggyBankEventFactory::class);
diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php
index 9a7b310ca5..412c9f3a0c 100644
--- a/app/Services/Internal/Update/GroupUpdateService.php
+++ b/app/Services/Internal/Update/GroupUpdateService.php
@@ -88,8 +88,8 @@ class GroupUpdateService
app('log')->debug('Going to update split group.');
- $existing = $transactionGroup->transactionJournals->pluck('id')->toArray();
- $updated = $this->updateTransactions($transactionGroup, $transactions);
+ $existing = $transactionGroup->transactionJournals->pluck('id')->toArray();
+ $updated = $this->updateTransactions($transactionGroup, $transactions);
app('log')->debug('Array of updated IDs: ', $updated);
if (0 === count($updated)) {
@@ -101,7 +101,7 @@ class GroupUpdateService
return $transactionGroup;
}
- $result = array_diff($existing, $updated);
+ $result = array_diff($existing, $updated);
app('log')->debug('Result of DIFF: ', $result);
if (count($result) > 0) {
/** @var string $deletedId */
@@ -165,7 +165,7 @@ class GroupUpdateService
$journalId = (int)($transaction['transaction_journal_id'] ?? 0);
/** @var null|TransactionJournal $journal */
- $journal = $transactionGroup->transactionJournals()->find($journalId);
+ $journal = $transactionGroup->transactionJournals()->find($journalId);
if (null === $journal) {
app('log')->debug('This entry has no existing journal: make a new split.');
// force the transaction type on the transaction data.
@@ -216,7 +216,7 @@ class GroupUpdateService
];
/** @var TransactionJournalFactory $factory */
- $factory = app(TransactionJournalFactory::class);
+ $factory = app(TransactionJournalFactory::class);
$factory->setUser($transactionGroup->user);
try {
diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php
index b34159532a..ca34d50187 100644
--- a/app/Services/Internal/Update/JournalUpdateService.php
+++ b/app/Services/Internal/Update/JournalUpdateService.php
@@ -109,7 +109,7 @@ class JournalUpdateService
public function setTransactionGroup(TransactionGroup $transactionGroup): void
{
- $this->transactionGroup = $transactionGroup;
+ $this->transactionGroup = $transactionGroup;
$this->billRepository->setUser($transactionGroup->user);
$this->categoryRepository->setUser($transactionGroup->user);
$this->budgetRepository->setUser($transactionGroup->user);
@@ -176,8 +176,8 @@ class JournalUpdateService
private function hasValidSourceAccount(): bool
{
app('log')->debug('Now in hasValidSourceAccount().');
- $sourceId = $this->data['source_id'] ?? null;
- $sourceName = $this->data['source_name'] ?? null;
+ $sourceId = $this->data['source_id'] ?? null;
+ $sourceName = $this->data['source_name'] ?? null;
if (!$this->hasFields(['source_id', 'source_name'])) {
$origSourceAccount = $this->getOriginalSourceAccount();
@@ -191,11 +191,11 @@ class JournalUpdateService
// make a new validator.
/** @var AccountValidator $validator */
- $validator = app(AccountValidator::class);
+ $validator = app(AccountValidator::class);
$validator->setTransactionType($expectedType);
$validator->setUser($this->transactionJournal->user);
- $result = $validator->validateSource(['id' => $sourceId]);
+ $result = $validator->validateSource(['id' => $sourceId]);
app('log')->debug(
sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true))
);
@@ -261,8 +261,8 @@ class JournalUpdateService
private function hasValidDestinationAccount(): bool
{
app('log')->debug('Now in hasValidDestinationAccount().');
- $destId = $this->data['destination_id'] ?? null;
- $destName = $this->data['destination_name'] ?? null;
+ $destId = $this->data['destination_id'] ?? null;
+ $destName = $this->data['destination_name'] ?? null;
if (!$this->hasFields(['destination_id', 'destination_name'])) {
app('log')->debug('No destination info submitted, grab the original data.');
@@ -272,12 +272,12 @@ class JournalUpdateService
}
// make new account validator.
- $expectedType = $this->getExpectedType();
+ $expectedType = $this->getExpectedType();
app('log')->debug(sprintf('Expected type (new or unchanged) is %s', $expectedType));
// make a new validator.
/** @var AccountValidator $validator */
- $validator = app(AccountValidator::class);
+ $validator = app(AccountValidator::class);
$validator->setTransactionType($expectedType);
$validator->setUser($this->transactionJournal->user);
$validator->source = $this->getValidSourceAccount();
@@ -330,7 +330,7 @@ class JournalUpdateService
return $this->getOriginalSourceAccount();
}
- $sourceInfo = [
+ $sourceInfo = [
'id' => (int)($this->data['source_id'] ?? null),
'name' => $this->data['source_name'] ?? null,
'iban' => $this->data['source_iban'] ?? null,
@@ -358,8 +358,8 @@ class JournalUpdateService
*/
private function updateAccounts(): void
{
- $source = $this->getValidSourceAccount();
- $destination = $this->getValidDestinationAccount();
+ $source = $this->getValidSourceAccount();
+ $destination = $this->getValidDestinationAccount();
// cowardly refuse to update if both accounts are the same.
if ($source->id === $destination->id) {
@@ -372,7 +372,7 @@ class JournalUpdateService
$origSourceTransaction->account()->associate($source);
$origSourceTransaction->save();
- $destTransaction = $this->getDestinationTransaction();
+ $destTransaction = $this->getDestinationTransaction();
$destTransaction->account()->associate($destination);
$destTransaction->save();
@@ -394,7 +394,7 @@ class JournalUpdateService
return $this->getOriginalDestinationAccount();
}
- $destInfo = [
+ $destInfo = [
'id' => (int)($this->data['destination_id'] ?? null),
'name' => $this->data['destination_name'] ?? null,
'iban' => $this->data['destination_iban'] ?? null,
@@ -423,7 +423,7 @@ class JournalUpdateService
{
app('log')->debug('Now in updateType()');
if ($this->hasFields(['type'])) {
- $type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type'];
+ $type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type'];
app('log')->debug(
sprintf(
'Trying to change journal #%d from a %s to a %s.',
@@ -475,7 +475,7 @@ class JournalUpdateService
private function updateField(string $fieldName): void
{
if (array_key_exists($fieldName, $this->data) && '' !== (string)$this->data[$fieldName]) {
- $value = $this->data[$fieldName];
+ $value = $this->data[$fieldName];
if ('date' === $fieldName) {
if ($value instanceof Carbon) {
@@ -576,7 +576,7 @@ class JournalUpdateService
if ($this->hasFields([$field])) {
$value = '' === $this->data[$field] ? null : $this->data[$field];
app('log')->debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
- $set = [
+ $set = [
'journal' => $this->transactionJournal,
'name' => $field,
'data' => $value,
@@ -617,19 +617,19 @@ class JournalUpdateService
if (!$this->hasFields(['currency_id', 'currency_code'])) {
return;
}
- $currencyId = $this->data['currency_id'] ?? null;
- $currencyCode = $this->data['currency_code'] ?? null;
- $currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode);
+ $currencyId = $this->data['currency_id'] ?? null;
+ $currencyCode = $this->data['currency_code'] ?? null;
+ $currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode);
// update currency everywhere.
$this->transactionJournal->transaction_currency_id = $currency->id;
$this->transactionJournal->save();
- $source = $this->getSourceTransaction();
- $source->transaction_currency_id = $currency->id;
+ $source = $this->getSourceTransaction();
+ $source->transaction_currency_id = $currency->id;
$source->save();
- $dest = $this->getDestinationTransaction();
- $dest->transaction_currency_id = $currency->id;
+ $dest = $this->getDestinationTransaction();
+ $dest->transaction_currency_id = $currency->id;
$dest->save();
// refresh transactions.
@@ -645,7 +645,7 @@ class JournalUpdateService
return;
}
- $value = $this->data['amount'] ?? '';
+ $value = $this->data['amount'] ?? '';
app('log')->debug(sprintf('Amount is now "%s"', $value));
try {
@@ -658,8 +658,8 @@ class JournalUpdateService
$origSourceTransaction = $this->getSourceTransaction();
$origSourceTransaction->amount = app('steam')->negative($amount);
$origSourceTransaction->save();
- $destTransaction = $this->getDestinationTransaction();
- $destTransaction->amount = app('steam')->positive($amount);
+ $destTransaction = $this->getDestinationTransaction();
+ $destTransaction->amount = app('steam')->positive($amount);
$destTransaction->save();
// refresh transactions.
$this->sourceTransaction->refresh();
@@ -698,8 +698,8 @@ class JournalUpdateService
$source->foreign_currency_id = $foreignCurrency->id;
$source->foreign_amount = app('steam')->negative($foreignAmount);
$source->save();
- $dest->foreign_currency_id = $foreignCurrency->id;
- $dest->foreign_amount = app('steam')->positive($foreignAmount);
+ $dest->foreign_currency_id = $foreignCurrency->id;
+ $dest->foreign_amount = app('steam')->positive($foreignAmount);
$dest->save();
app('log')->debug(
@@ -722,8 +722,8 @@ class JournalUpdateService
$source->foreign_amount = null;
$source->save();
- $dest->foreign_currency_id = null;
- $dest->foreign_amount = null;
+ $dest->foreign_currency_id = null;
+ $dest->foreign_amount = null;
$dest->save();
app('log')->debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount));
}
diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php
index 6f16f05283..e5859d7d30 100644
--- a/app/Services/Internal/Update/RecurrenceUpdateService.php
+++ b/app/Services/Internal/Update/RecurrenceUpdateService.php
@@ -141,7 +141,7 @@ class RecurrenceUpdateService
// loop all and try to match them:
app('log')->debug('Loop and find');
foreach ($repetitions as $current) {
- $match = $this->matchRepetition($recurrence, $current);
+ $match = $this->matchRepetition($recurrence, $current);
if (null === $match) {
throw new FireflyException('Cannot match recurring repetition to existing repetition. Not sure what to do. Break.');
}
@@ -170,14 +170,14 @@ class RecurrenceUpdateService
return $recurrence->recurrenceRepetitions()->first();
}
// find it:
- $fields = [
+ $fields = [
'id' => 'id',
'type' => 'repetition_type',
'moment' => 'repetition_moment',
'skip' => 'repetition_skip',
'weekend' => 'weekend',
];
- $query = $recurrence->recurrenceRepetitions();
+ $query = $recurrence->recurrenceRepetitions();
foreach ($fields as $field => $column) {
if (array_key_exists($field, $data)) {
$query->where($column, $data[$field]);
@@ -196,7 +196,7 @@ class RecurrenceUpdateService
private function updateTransactions(Recurrence $recurrence, array $transactions): void
{
app('log')->debug('Now in updateTransactions()');
- $originalCount = $recurrence->recurrenceTransactions()->count();
+ $originalCount = $recurrence->recurrenceTransactions()->count();
app('log')->debug(sprintf('Original count is %d', $originalCount));
if (0 === count($transactions)) {
// won't drop transactions, rather avoid.
@@ -221,7 +221,7 @@ class RecurrenceUpdateService
}
// If one left of both we can match those as well and presto.
if (1 === count($originalTransactions) && 1 === count($transactions)) {
- $first = array_shift($originalTransactions);
+ $first = array_shift($originalTransactions);
app('log')->debug(sprintf('One left of each, link them (ID is #%d)', $first['id']));
$combinations[] = [
'original' => $first,
@@ -257,7 +257,7 @@ class RecurrenceUpdateService
$currencyFactory = app(TransactionCurrencyFactory::class);
/** @var RecurrenceTransaction $transaction */
- $transaction = $recurrence->recurrenceTransactions()->find($original['id']);
+ $transaction = $recurrence->recurrenceTransactions()->find($original['id']);
app('log')->debug(sprintf('Now in updateCombination(#%d)', $original['id']));
// loop all and try to match them:
@@ -289,7 +289,7 @@ class RecurrenceUpdateService
}
// update fields that are part of the recurring transaction itself.
- $fields = [
+ $fields = [
'source_id' => 'source_id',
'destination_id' => 'destination_id',
'amount' => 'amount',
diff --git a/app/Services/Webhook/StandardWebhookSender.php b/app/Services/Webhook/StandardWebhookSender.php
index c3c211d60b..1f667b9f23 100644
--- a/app/Services/Webhook/StandardWebhookSender.php
+++ b/app/Services/Webhook/StandardWebhookSender.php
@@ -64,10 +64,10 @@ class StandardWebhookSender implements WebhookSenderInterface
app('log')->error('Did not send message because of a Firefly III Exception.');
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
- $attempt = new WebhookAttempt();
+ $attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
- $attempt->status_code = 0;
- $attempt->logs = sprintf('Exception: %s', $e->getMessage());
+ $attempt->status_code = 0;
+ $attempt->logs = sprintf('Exception: %s', $e->getMessage());
$attempt->save();
$this->message->errored = true;
$this->message->sent = false;
@@ -84,10 +84,10 @@ class StandardWebhookSender implements WebhookSenderInterface
app('log')->error('Did not send message because of a JSON error.');
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
- $attempt = new WebhookAttempt();
+ $attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
- $attempt->status_code = 0;
- $attempt->logs = sprintf('Json error: %s', $e->getMessage());
+ $attempt->status_code = 0;
+ $attempt->logs = sprintf('Json error: %s', $e->getMessage());
$attempt->save();
$this->message->errored = true;
$this->message->sent = false;
@@ -95,7 +95,7 @@ class StandardWebhookSender implements WebhookSenderInterface
return;
}
- $options = [
+ $options = [
'body' => $json,
'headers' => [
'Content-Type' => 'application/json',
@@ -106,7 +106,7 @@ class StandardWebhookSender implements WebhookSenderInterface
'timeout' => 10,
],
];
- $client = new Client();
+ $client = new Client();
try {
$res = $client->request('POST', $this->message->webhook->url, $options);
@@ -115,22 +115,22 @@ class StandardWebhookSender implements WebhookSenderInterface
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
- $logs = sprintf("%s\n%s", $e->getMessage(), $e->getTraceAsString());
+ $logs = sprintf("%s\n%s", $e->getMessage(), $e->getTraceAsString());
$this->message->errored = true;
$this->message->sent = false;
$this->message->save();
- $attempt = new WebhookAttempt();
+ $attempt = new WebhookAttempt();
$attempt->webhookMessage()->associate($this->message);
- $attempt->status_code = 0;
+ $attempt->status_code = 0;
if (method_exists($e, 'hasResponse') && method_exists($e, 'getResponse')) {
$attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0;
app('log')->error(sprintf('The status code of the error response is: %d', $attempt->status_code));
- $body = (string)($e->hasResponse() ? $e->getResponse()->getBody() : '');
+ $body = (string)($e->hasResponse() ? $e->getResponse()->getBody() : '');
app('log')->error(sprintf('The body of the error response is: %s', $body));
}
- $attempt->logs = $logs;
+ $attempt->logs = $logs;
$attempt->save();
return;
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 68eb5c4a20..cac56dd2d7 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -55,15 +55,15 @@ class Amount
*/
public function formatFlat(string $symbol, int $decimalPlaces, string $amount, bool $coloured = null): string
{
- $locale = app('steam')->getLocale();
- $rounded = app('steam')->bcround($amount, $decimalPlaces);
+ $locale = app('steam')->getLocale();
+ $rounded = app('steam')->bcround($amount, $decimalPlaces);
$coloured ??= true;
- $fmt = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
+ $fmt = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
$fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol);
$fmt->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $decimalPlaces);
$fmt->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $decimalPlaces);
- $result = (string) $fmt->format((float) $rounded); // intentional float
+ $result = (string) $fmt->format((float) $rounded); // intentional float
if (true === $coloured) {
if (1 === bccomp($rounded, '0')) {
@@ -102,7 +102,7 @@ class Amount
public function getDefaultCurrencyByUserGroup(UserGroup $userGroup): TransactionCurrency
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty('getDefaultCurrencyByGroup');
$cache->addProperty($userGroup->id);
if ($cache->has()) {
@@ -166,7 +166,7 @@ class Amount
public static function getAmountJsConfig(bool $sepBySpace, int $signPosn, string $sign, bool $csPrecedes): string
{
// negative first:
- $space = ' ';
+ $space = ' ';
// require space between symbol and amount?
if (false === $sepBySpace) {
@@ -175,11 +175,11 @@ class Amount
// there are five possible positions for the "+" or "-" sign (if it is even used)
// pos_a and pos_e could be the ( and ) symbol.
- $posA = ''; // before everything
- $posB = ''; // before currency symbol
- $posC = ''; // after currency symbol
- $posD = ''; // before amount
- $posE = ''; // after everything
+ $posA = ''; // before everything
+ $posB = ''; // before currency symbol
+ $posC = ''; // after currency symbol
+ $posD = ''; // before amount
+ $posE = ''; // after everything
// format would be (currency before amount)
// AB%sC_D%vE
@@ -239,20 +239,20 @@ class Amount
private function getLocaleInfo(): array
{
// get config from preference, not from translation:
- $locale = app('steam')->getLocale();
- $array = app('steam')->getLocaleArray($locale);
+ $locale = app('steam')->getLocale();
+ $array = app('steam')->getLocaleArray($locale);
setlocale(LC_MONETARY, $array);
- $info = localeconv();
+ $info = localeconv();
// correct variables
- $info['n_cs_precedes'] = $this->getLocaleField($info, 'n_cs_precedes');
- $info['p_cs_precedes'] = $this->getLocaleField($info, 'p_cs_precedes');
+ $info['n_cs_precedes'] = $this->getLocaleField($info, 'n_cs_precedes');
+ $info['p_cs_precedes'] = $this->getLocaleField($info, 'p_cs_precedes');
- $info['n_sep_by_space'] = $this->getLocaleField($info, 'n_sep_by_space');
- $info['p_sep_by_space'] = $this->getLocaleField($info, 'p_sep_by_space');
+ $info['n_sep_by_space'] = $this->getLocaleField($info, 'n_sep_by_space');
+ $info['p_sep_by_space'] = $this->getLocaleField($info, 'p_sep_by_space');
- $fmt = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
+ $fmt = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
$info['mon_decimal_point'] = $fmt->getSymbol(\NumberFormatter::MONETARY_SEPARATOR_SYMBOL);
$info['mon_thousands_sep'] = $fmt->getSymbol(\NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL);
diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php
index fda3d0e223..749b3f6bf3 100644
--- a/app/Support/Authentication/RemoteUserGuard.php
+++ b/app/Support/Authentication/RemoteUserGuard.php
@@ -47,7 +47,7 @@ class RemoteUserGuard implements Guard
public function __construct(UserProvider $provider, Application $app)
{
/** @var null|Request $request */
- $request = $app->get('request');
+ $request = $app->get('request');
app('log')->debug(sprintf('Created RemoteUserGuard for %s "%s"', $request?->getMethod(), $request?->getRequestUri()));
$this->application = $app;
$this->provider = $provider;
@@ -63,8 +63,8 @@ class RemoteUserGuard implements Guard
return;
}
// Get the user identifier from $_SERVER or apache filtered headers
- $header = config('auth.guard_header', 'REMOTE_USER');
- $userID = request()->server($header) ?? null;
+ $header = config('auth.guard_header', 'REMOTE_USER');
+ $userID = request()->server($header) ?? null;
if (function_exists('apache_request_headers')) {
app('log')->debug('Use apache_request_headers to find user ID.');
@@ -83,7 +83,7 @@ class RemoteUserGuard implements Guard
$retrievedUser = $this->provider->retrieveById($userID);
// store email address if present in header and not already set.
- $header = config('auth.guard_email');
+ $header = config('auth.guard_email');
if (null !== $header) {
$emailAddress = (string)(request()->server($header) ?? apache_request_headers()[$header] ?? null);
@@ -99,7 +99,7 @@ class RemoteUserGuard implements Guard
}
app('log')->debug(sprintf('Result of getting user from provider: %s', $retrievedUser->email));
- $this->user = $retrievedUser;
+ $this->user = $retrievedUser;
}
public function guest(): bool
diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.php
index e7c8d2b7c8..79c8d65575 100644
--- a/app/Support/Binder/AccountList.php
+++ b/app/Support/Binder/AccountList.php
@@ -50,8 +50,8 @@ class AccountList implements BinderInterface
;
}
if ('allAssetAccounts' !== $value) {
- $incoming = array_map('\intval', explode(',', $value));
- $list = array_merge(array_unique($incoming), [0]);
+ $incoming = array_map('\intval', explode(',', $value));
+ $list = array_merge(array_unique($incoming), [0]);
/** @var Collection $collection */
$collection = auth()->user()->accounts()
diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.php
index 80042162c3..6526ebd38a 100644
--- a/app/Support/Binder/BudgetList.php
+++ b/app/Support/Binder/BudgetList.php
@@ -47,7 +47,7 @@ class BudgetList implements BinderInterface
;
}
- $list = array_unique(array_map('\intval', explode(',', $value)));
+ $list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) { // @phpstan-ignore-line
app('log')->warning('Budget list count is zero, return 404.');
diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.php
index 7b676fefeb..1275481fa3 100644
--- a/app/Support/Binder/CategoryList.php
+++ b/app/Support/Binder/CategoryList.php
@@ -46,7 +46,7 @@ class CategoryList implements BinderInterface
;
}
- $list = array_unique(array_map('\intval', explode(',', $value)));
+ $list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) { // @phpstan-ignore-line
throw new NotFoundHttpException();
}
diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php
index 1c9bc1f006..99c0ce4c17 100644
--- a/app/Support/Binder/Date.php
+++ b/app/Support/Binder/Date.php
@@ -43,16 +43,16 @@ class Date implements BinderInterface
/** @var FiscalHelperInterface $fiscalHelper */
$fiscalHelper = app(FiscalHelperInterface::class);
- $magicWords = [
- 'currentMonthStart' => today(config('app.timezone'))->startOfMonth(),
- 'currentMonthEnd' => today(config('app.timezone'))->endOfMonth(),
- 'currentYearStart' => today(config('app.timezone'))->startOfYear(),
- 'currentYearEnd' => today(config('app.timezone'))->endOfYear(),
+ $magicWords = [
+ 'currentMonthStart' => today(config('app.timezone'))->startOfMonth(),
+ 'currentMonthEnd' => today(config('app.timezone'))->endOfMonth(),
+ 'currentYearStart' => today(config('app.timezone'))->startOfYear(),
+ 'currentYearEnd' => today(config('app.timezone'))->endOfYear(),
- 'previousMonthStart' => today(config('app.timezone'))->startOfMonth()->subDay()->startOfMonth(),
- 'previousMonthEnd' => today(config('app.timezone'))->startOfMonth()->subDay()->endOfMonth(),
- 'previousYearStart' => today(config('app.timezone'))->startOfYear()->subDay()->startOfYear(),
- 'previousYearEnd' => today(config('app.timezone'))->startOfYear()->subDay()->endOfYear(),
+ 'previousMonthStart' => today(config('app.timezone'))->startOfMonth()->subDay()->startOfMonth(),
+ 'previousMonthEnd' => today(config('app.timezone'))->startOfMonth()->subDay()->endOfMonth(),
+ 'previousYearStart' => today(config('app.timezone'))->startOfYear()->subDay()->startOfYear(),
+ 'previousYearEnd' => today(config('app.timezone'))->startOfYear()->subDay()->endOfYear(),
'currentFiscalYearStart' => $fiscalHelper->startOfFiscalYear(today(config('app.timezone'))),
'currentFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(today(config('app.timezone'))),
diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.php
index 9cb8017e13..95b067a140 100644
--- a/app/Support/Binder/JournalList.php
+++ b/app/Support/Binder/JournalList.php
@@ -39,7 +39,7 @@ class JournalList implements BinderInterface
public static function routeBinder(string $value, Route $route): array
{
if (auth()->check()) {
- $list = self::parseList($value);
+ $list = self::parseList($value);
// get the journals by using the collector.
/** @var GroupCollectorInterface $collector */
@@ -47,7 +47,7 @@ class JournalList implements BinderInterface
$collector->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::RECONCILIATION]);
$collector->withCategoryInformation()->withBudgetInformation()->withTagInformation()->withAccountInformation();
$collector->setJournalIds($list);
- $result = $collector->getExtractedJournals();
+ $result = $collector->getExtractedJournals();
if (0 === count($result)) {
throw new NotFoundHttpException();
}
diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php
index 649a9025f6..d87c8c69b9 100644
--- a/app/Support/Binder/TagList.php
+++ b/app/Support/Binder/TagList.php
@@ -47,7 +47,7 @@ class TagList implements BinderInterface
->get()
;
}
- $list = array_unique(array_map('\strtolower', explode(',', $value)));
+ $list = array_unique(array_map('\strtolower', explode(',', $value)));
app('log')->debug('List of tags is', $list);
if (0 === count($list)) { // @phpstan-ignore-line
@@ -59,7 +59,7 @@ class TagList implements BinderInterface
/** @var TagRepositoryInterface $repository */
$repository = app(TagRepositoryInterface::class);
$repository->setUser(auth()->user());
- $allTags = $repository->get();
+ $allTags = $repository->get();
$collection = $allTags->filter(
static function (Tag $tag) use ($list) {
diff --git a/app/Support/Binder/TagOrId.php b/app/Support/Binder/TagOrId.php
index ad3a866e1a..e742fb674d 100644
--- a/app/Support/Binder/TagOrId.php
+++ b/app/Support/Binder/TagOrId.php
@@ -40,7 +40,7 @@ class TagOrId implements BinderInterface
$repository = app(TagRepositoryInterface::class);
$repository->setUser(auth()->user());
- $result = $repository->findByTag($value);
+ $result = $repository->findByTag($value);
if (null === $result) {
$result = $repository->find((int)$value);
}
diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php
index 0a0bb96c17..fdba09b8dc 100644
--- a/app/Support/CacheProperties.php
+++ b/app/Support/CacheProperties.php
@@ -83,7 +83,7 @@ class CacheProperties
private function hash(): void
{
- $content = '';
+ $content = '';
foreach ($this->properties as $property) {
try {
$content .= json_encode($property, JSON_THROW_ON_ERROR);
diff --git a/app/Support/Calendar/Calculator.php b/app/Support/Calendar/Calculator.php
index e6e9255bc5..bae3f12142 100644
--- a/app/Support/Calendar/Calculator.php
+++ b/app/Support/Calendar/Calculator.php
@@ -32,7 +32,7 @@ use FireflyIII\Exceptions\IntervalException;
*/
class Calculator
{
- public const int DEFAULT_INTERVAL = 1;
+ public const int DEFAULT_INTERVAL = 1;
private static ?\SplObjectStorage $intervalMap = null;
private static array $intervals = [];
diff --git a/app/Support/Chart/Budget/FrontpageChartGenerator.php b/app/Support/Chart/Budget/FrontpageChartGenerator.php
index 266274499b..c08e56dd1b 100644
--- a/app/Support/Chart/Budget/FrontpageChartGenerator.php
+++ b/app/Support/Chart/Budget/FrontpageChartGenerator.php
@@ -178,7 +178,7 @@ class FrontpageChartGenerator
*/
private function processRow(array $data, Budget $budget, BudgetLimit $limit, array $entry): array
{
- $title = sprintf('%s (%s)', $budget->name, $entry['currency_name']);
+ $title = sprintf('%s (%s)', $budget->name, $entry['currency_name']);
if ($limit->start_date->startOfDay()->ne($this->start->startOfDay()) || $limit->end_date->startOfDay()->ne($this->end->startOfDay())) {
$title = sprintf(
'%s (%s) (%s - %s)',
@@ -188,7 +188,7 @@ class FrontpageChartGenerator
$limit->end_date->isoFormat($this->monthAndDayFormat)
);
}
- $sumSpent = bcmul($entry['sum'], '-1'); // spent
+ $sumSpent = bcmul($entry['sum'], '-1'); // spent
$data[0]['entries'][$title] = 1 === bccomp($sumSpent, $limit->amount) ? $limit->amount : $sumSpent; // spent
$data[1]['entries'][$title] = 1 === bccomp($limit->amount, $sumSpent) ? bcadd($entry['sum'], $limit->amount) : '0'; // left to spent
diff --git a/app/Support/Chart/Category/FrontpageChartGenerator.php b/app/Support/Chart/Category/FrontpageChartGenerator.php
index 59d33e4a4e..b570dd7552 100644
--- a/app/Support/Chart/Category/FrontpageChartGenerator.php
+++ b/app/Support/Chart/Category/FrontpageChartGenerator.php
@@ -65,13 +65,13 @@ class FrontpageChartGenerator
public function generate(): array
{
- $categories = $this->repository->getCategories();
- $accounts = $this->accountRepos->getAccountsByType(
+ $categories = $this->repository->getCategories();
+ $accounts = $this->accountRepos->getAccountsByType(
[AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::ASSET, AccountType::DEFAULT]
);
// get expenses + income per category:
- $collection = [];
+ $collection = [];
/** @var Category $category */
foreach ($categories as $category) {
@@ -82,10 +82,10 @@ class FrontpageChartGenerator
// collect for no-category:
$collection[] = $this->collectNoCatExpenses($accounts);
- $tempData = array_merge(...$collection);
+ $tempData = array_merge(...$collection);
// sort temp array by amount.
- $amounts = array_column($tempData, 'sum_float');
+ $amounts = array_column($tempData, 'sum_float');
array_multisort($amounts, SORT_ASC, $tempData);
$currencyData = $this->createCurrencyGroups($tempData);
diff --git a/app/Support/Chart/Category/WholePeriodChartGenerator.php b/app/Support/Chart/Category/WholePeriodChartGenerator.php
index cff791226b..e1765dbfc9 100644
--- a/app/Support/Chart/Category/WholePeriodChartGenerator.php
+++ b/app/Support/Chart/Category/WholePeriodChartGenerator.php
@@ -37,22 +37,22 @@ class WholePeriodChartGenerator
{
public function generate(Category $category, Carbon $start, Carbon $end): array
{
- $collection = new Collection([$category]);
+ $collection = new Collection([$category]);
/** @var OperationsRepositoryInterface $opsRepository */
- $opsRepository = app(OperationsRepositoryInterface::class);
+ $opsRepository = app(OperationsRepositoryInterface::class);
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
- $types = [AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
- $accounts = $accountRepository->getAccountsByType($types);
- $step = $this->calculateStep($start, $end);
- $chartData = [];
- $spent = [];
- $earned = [];
+ $types = [AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
+ $accounts = $accountRepository->getAccountsByType($types);
+ $step = $this->calculateStep($start, $end);
+ $chartData = [];
+ $spent = [];
+ $earned = [];
- $current = clone $start;
+ $current = clone $start;
while ($current <= $end) {
$key = $current->format('Y-m-d');
@@ -62,14 +62,14 @@ class WholePeriodChartGenerator
$current = app('navigation')->addPeriod($current, $step, 0);
}
- $currencies = $this->extractCurrencies($spent) + $this->extractCurrencies($earned);
+ $currencies = $this->extractCurrencies($spent) + $this->extractCurrencies($earned);
// generate chart data (for each currency)
/** @var array $currency */
foreach ($currencies as $currency) {
- $code = $currency['currency_code'];
- $name = $currency['currency_name'];
- $chartData[sprintf('spent-in-%s', $code)] = [
+ $code = $currency['currency_code'];
+ $name = $currency['currency_name'];
+ $chartData[sprintf('spent-in-%s', $code)] = [
'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $name]),
'entries' => [],
'type' => 'bar',
@@ -84,11 +84,11 @@ class WholePeriodChartGenerator
];
}
- $current = clone $start;
+ $current = clone $start;
while ($current <= $end) {
- $key = $current->format('Y-m-d');
- $label = app('navigation')->periodShow($current, $step);
+ $key = $current->format('Y-m-d');
+ $label = app('navigation')->periodShow($current, $step);
/** @var array $currency */
foreach ($currencies as $currency) {
diff --git a/app/Support/ChartColour.php b/app/Support/ChartColour.php
index f08de5c258..9e938b9946 100644
--- a/app/Support/ChartColour.php
+++ b/app/Support/ChartColour.php
@@ -55,7 +55,7 @@ class ChartColour
public static function getColour(int $index): string
{
$index %= count(self::$colours);
- $row = self::$colours[$index];
+ $row = self::$colours[$index];
return sprintf('rgba(%d, %d, %d, 0.7)', $row[0], $row[1], $row[2]);
}
diff --git a/app/Support/Cronjobs/AutoBudgetCronjob.php b/app/Support/Cronjobs/AutoBudgetCronjob.php
index 5947f8ebcf..6ac8d0440a 100644
--- a/app/Support/Cronjobs/AutoBudgetCronjob.php
+++ b/app/Support/Cronjobs/AutoBudgetCronjob.php
@@ -68,7 +68,7 @@ class AutoBudgetCronjob extends AbstractCronjob
app('log')->info(sprintf('Will now fire auto budget cron job task for date "%s".', $this->date->format('Y-m-d')));
/** @var CreateAutoBudgetLimits $job */
- $job = app(CreateAutoBudgetLimits::class, [$this->date]);
+ $job = app(CreateAutoBudgetLimits::class, [$this->date]);
$job->setDate($this->date);
$job->handle();
diff --git a/app/Support/Cronjobs/BillWarningCronjob.php b/app/Support/Cronjobs/BillWarningCronjob.php
index af0a3c5aef..84362c2069 100644
--- a/app/Support/Cronjobs/BillWarningCronjob.php
+++ b/app/Support/Cronjobs/BillWarningCronjob.php
@@ -79,7 +79,7 @@ class BillWarningCronjob extends AbstractCronjob
app('log')->info(sprintf('Will now fire bill warning job task for date "%s".', $this->date->format('Y-m-d H:i:s')));
/** @var WarnAboutBills $job */
- $job = app(WarnAboutBills::class);
+ $job = app(WarnAboutBills::class);
$job->setDate($this->date);
$job->setForce($this->force);
$job->handle();
diff --git a/app/Support/Cronjobs/ExchangeRatesCronjob.php b/app/Support/Cronjobs/ExchangeRatesCronjob.php
index 356f71a2e4..2572b8ba1e 100644
--- a/app/Support/Cronjobs/ExchangeRatesCronjob.php
+++ b/app/Support/Cronjobs/ExchangeRatesCronjob.php
@@ -69,7 +69,7 @@ class ExchangeRatesCronjob extends AbstractCronjob
app('log')->info(sprintf('Will now fire exchange rates cron job task for date "%s".', $this->date->format('Y-m-d')));
/** @var DownloadExchangeRates $job */
- $job = app(DownloadExchangeRates::class);
+ $job = app(DownloadExchangeRates::class);
$job->setDate($this->date);
$job->handle();
diff --git a/app/Support/Cronjobs/RecurringCronjob.php b/app/Support/Cronjobs/RecurringCronjob.php
index 04f449dc23..6fd241104d 100644
--- a/app/Support/Cronjobs/RecurringCronjob.php
+++ b/app/Support/Cronjobs/RecurringCronjob.php
@@ -78,7 +78,7 @@ class RecurringCronjob extends AbstractCronjob
app('log')->info(sprintf('Will now fire recurring cron job task for date "%s".', $this->date->format('Y-m-d H:i:s')));
/** @var CreateRecurringTransactions $job */
- $job = app(CreateRecurringTransactions::class);
+ $job = app(CreateRecurringTransactions::class);
$job->setDate($this->date);
$job->setForce($this->force);
$job->handle();
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index 84f56e21b7..74822444c4 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -42,7 +42,7 @@ class ExpandedForm
*/
public function amountNoCurrency(string $name, $value = null, array $options = null): string
{
- $options ??= [];
+ $options ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
@@ -73,8 +73,8 @@ class ExpandedForm
*/
public function checkbox(string $name, int $value = null, $checked = null, array $options = null): string
{
- $options ??= [];
- $value ??= 1;
+ $options ??= [];
+ $value ??= 1;
$options['checked'] = true === $checked;
if (app('session')->has('preFilled')) {
@@ -82,10 +82,10 @@ class ExpandedForm
$options['checked'] = $preFilled[$name] ?? $options['checked'];
}
- $label = $this->label($name, $options);
- $options = $this->expandOptionArray($name, $label, $options);
- $classes = $this->getHolderClasses($name);
- $value = $this->fillFieldValue($name, $value);
+ $label = $this->label($name, $options);
+ $options = $this->expandOptionArray($name, $label, $options);
+ $classes = $this->getHolderClasses($name);
+ $value = $this->fillFieldValue($name, $value);
unset($options['placeholder'], $options['autocomplete'], $options['class']);
@@ -156,10 +156,10 @@ class ExpandedForm
public function integer(string $name, $value = null, array $options = null): string
{
$options ??= [];
- $label = $this->label($name, $options);
- $options = $this->expandOptionArray($name, $label, $options);
- $classes = $this->getHolderClasses($name);
- $value = $this->fillFieldValue($name, $value);
+ $label = $this->label($name, $options);
+ $options = $this->expandOptionArray($name, $label, $options);
+ $classes = $this->getHolderClasses($name);
+ $value = $this->fillFieldValue($name, $value);
$options['step'] ??= '1';
try {
@@ -208,9 +208,9 @@ class ExpandedForm
/** @var \Eloquent $entry */
foreach ($set as $entry) {
// All Eloquent models have an ID
- $entryId = $entry->id; // @phpstan-ignore-line
- $current = $entry->toArray();
- $title = null;
+ $entryId = $entry->id; // @phpstan-ignore-line
+ $current = $entry->toArray();
+ $title = null;
foreach ($fields as $field) {
if (array_key_exists($field, $current) && null === $title) {
$title = $current[$field];
diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php
index 8cd5caa992..d6891822a0 100644
--- a/app/Support/Export/ExportDataGenerator.php
+++ b/app/Support/Export/ExportDataGenerator.php
@@ -82,8 +82,8 @@ class ExportDataGenerator
public function __construct()
{
- $this->accounts = new Collection();
- $this->start = today(config('app.timezone'));
+ $this->accounts = new Collection();
+ $this->start = today(config('app.timezone'));
$this->start->subYear();
$this->end = today(config('app.timezone'));
$this->exportTransactions = false;
@@ -222,7 +222,7 @@ class ExportDataGenerator
*/
private function exportAccounts(): string
{
- $header = [
+ $header = [
'user_id',
'account_id',
'created_at',
@@ -243,7 +243,7 @@ class ExportDataGenerator
];
/** @var AccountRepositoryInterface $repository */
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
$allAccounts = $repository->getAccountsByType([]);
$records = [];
@@ -273,7 +273,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -306,8 +306,8 @@ class ExportDataGenerator
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$repository->setUser($this->user);
- $bills = $repository->getBills();
- $header = [
+ $bills = $repository->getBills();
+ $header = [
'user_id',
'bill_id',
'created_at',
@@ -321,7 +321,7 @@ class ExportDataGenerator
'skip',
'active',
];
- $records = [];
+ $records = [];
/** @var Bill $bill */
foreach ($bills as $bill) {
@@ -342,7 +342,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -372,7 +372,7 @@ class ExportDataGenerator
*/
private function exportBudgets(): string
{
- $header = [
+ $header = [
'user_id',
'budget_id',
'name',
@@ -386,9 +386,9 @@ class ExportDataGenerator
$budgetRepos = app(BudgetRepositoryInterface::class);
$budgetRepos->setUser($this->user);
- $limitRepos = app(BudgetLimitRepositoryInterface::class);
- $budgets = $budgetRepos->getBudgets();
- $records = [];
+ $limitRepos = app(BudgetLimitRepositoryInterface::class);
+ $budgets = $budgetRepos->getBudgets();
+ $records = [];
/** @var Budget $budget */
foreach ($budgets as $budget) {
@@ -411,7 +411,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -441,10 +441,10 @@ class ExportDataGenerator
*/
private function exportCategories(): string
{
- $header = ['user_id', 'category_id', 'created_at', 'updated_at', 'name'];
+ $header = ['user_id', 'category_id', 'created_at', 'updated_at', 'name'];
/** @var CategoryRepositoryInterface $catRepos */
- $catRepos = app(CategoryRepositoryInterface::class);
+ $catRepos = app(CategoryRepositoryInterface::class);
$catRepos->setUser($this->user);
$records = [];
@@ -462,7 +462,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -493,14 +493,14 @@ class ExportDataGenerator
private function exportPiggies(): string
{
/** @var PiggyBankRepositoryInterface $piggyRepos */
- $piggyRepos = app(PiggyBankRepositoryInterface::class);
+ $piggyRepos = app(PiggyBankRepositoryInterface::class);
$piggyRepos->setUser($this->user);
/** @var AccountRepositoryInterface $accountRepos */
$accountRepos = app(AccountRepositoryInterface::class);
$accountRepos->setUser($this->user);
- $header = [
+ $header = [
'user_id',
'piggy_bank_id',
'created_at',
@@ -516,8 +516,8 @@ class ExportDataGenerator
'order',
'active',
];
- $records = [];
- $piggies = $piggyRepos->getPiggyBanks();
+ $records = [];
+ $piggies = $piggyRepos->getPiggyBanks();
/** @var PiggyBank $piggy */
foreach ($piggies as $piggy) {
@@ -542,7 +542,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -575,7 +575,7 @@ class ExportDataGenerator
/** @var RecurringRepositoryInterface $recurringRepos */
$recurringRepos = app(RecurringRepositoryInterface::class);
$recurringRepos->setUser($this->user);
- $header = [
+ $header = [
// recurrence:
'user_id', 'recurrence_id', 'row_contains', 'created_at', 'updated_at', 'type', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active',
@@ -584,8 +584,8 @@ class ExportDataGenerator
// transactions + meta:
'currency_code', 'foreign_currency_code', 'source_name', 'source_type', 'destination_name', 'destination_type', 'amount', 'foreign_amount', 'category', 'budget', 'piggy_bank', 'tags',
];
- $records = [];
- $recurrences = $recurringRepos->getAll();
+ $records = [];
+ $recurrences = $recurringRepos->getAll();
/** @var Recurrence $recurrence */
foreach ($recurrences as $recurrence) {
@@ -618,7 +618,7 @@ class ExportDataGenerator
$piggyBankId = $recurringRepos->getPiggyBank($transaction);
$tags = $recurringRepos->getTags($transaction);
- $records[] = [
+ $records[] = [
// recurrence
$this->user->id,
$recurrence->id,
@@ -634,7 +634,7 @@ class ExportDataGenerator
}
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -667,8 +667,8 @@ class ExportDataGenerator
$header = ['user_id', 'rule_id', 'row_contains', 'created_at', 'updated_at', 'group_id', 'title', 'description', 'order', 'active', 'stop_processing', 'strict', 'trigger_type', 'trigger_value', 'trigger_order', 'trigger_active', 'trigger_stop_processing', 'action_type', 'action_value', 'action_order', 'action_active', 'action_stop_processing'];
$ruleRepos = app(RuleRepositoryInterface::class);
$ruleRepos->setUser($this->user);
- $rules = $ruleRepos->getAll();
- $records = [];
+ $rules = $ruleRepos->getAll();
+ $records = [];
/** @var Rule $rule */
foreach ($rules as $rule) {
@@ -702,7 +702,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -732,12 +732,12 @@ class ExportDataGenerator
*/
private function exportTags(): string
{
- $header = ['user_id', 'tag_id', 'created_at', 'updated_at', 'tag', 'date', 'description', 'latitude', 'longitude', 'zoom_level'];
+ $header = ['user_id', 'tag_id', 'created_at', 'updated_at', 'tag', 'date', 'description', 'latitude', 'longitude', 'zoom_level'];
$tagRepos = app(TagRepositoryInterface::class);
$tagRepos->setUser($this->user);
- $tags = $tagRepos->get();
- $records = [];
+ $tags = $tagRepos->get();
+ $records = [];
/** @var Tag $tag */
foreach ($tags as $tag) {
@@ -756,7 +756,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
@@ -787,12 +787,12 @@ class ExportDataGenerator
private function exportTransactions(): string
{
// TODO better place for keys?
- $header = ['user_id', 'group_id', 'journal_id', 'created_at', 'updated_at', 'group_title', 'type', 'amount', 'foreign_amount', 'currency_code', 'foreign_currency_code', 'description', 'date', 'source_name', 'source_iban', 'source_type', 'destination_name', 'destination_iban', 'destination_type', 'reconciled', 'category', 'budget', 'bill', 'tags', 'notes'];
+ $header = ['user_id', 'group_id', 'journal_id', 'created_at', 'updated_at', 'group_title', 'type', 'amount', 'foreign_amount', 'currency_code', 'foreign_currency_code', 'description', 'date', 'source_name', 'source_iban', 'source_type', 'destination_name', 'destination_iban', 'destination_type', 'reconciled', 'category', 'budget', 'bill', 'tags', 'notes'];
$metaFields = config('firefly.journal_meta_fields');
$header = array_merge($header, $metaFields);
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user);
$collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation()
->withBudgetInformation()->withTagInformation()->withNotes()
@@ -801,13 +801,13 @@ class ExportDataGenerator
$collector->setAccounts($this->accounts);
}
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
// get repository for meta data:
$repository = app(TransactionGroupRepositoryInterface::class);
$repository->setUser($this->user);
- $records = [];
+ $records = [];
/** @var array $journal */
foreach ($journals as $journal) {
@@ -832,7 +832,7 @@ class ExportDataGenerator
}
// load the CSV document from a string
- $csv = Writer::createFromString();
+ $csv = Writer::createFromString();
// insert the header
try {
diff --git a/app/Support/Form/AccountForm.php b/app/Support/Form/AccountForm.php
index f215357155..6f3838a539 100644
--- a/app/Support/Form/AccountForm.php
+++ b/app/Support/Form/AccountForm.php
@@ -60,9 +60,9 @@ class AccountForm
*/
public function activeWithdrawalDestinations(string $name, mixed $value = null, array $options = null): string
{
- $types = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, AccountType::EXPENSE];
- $repository = $this->getAccountRepository();
- $grouped = $this->getAccountsGrouped($types, $repository);
+ $types = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN, AccountType::EXPENSE];
+ $repository = $this->getAccountRepository();
+ $grouped = $this->getAccountsGrouped($types, $repository);
$cash = $repository->getCashAccount();
$key = (string)trans('firefly.cash_account_type');
@@ -78,15 +78,15 @@ class AccountForm
*/
public function assetAccountCheckList(string $name, array $options = null): string
{
- $options ??= [];
+ $options ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
$selected = request()->old($name) ?? [];
// get all asset accounts:
- $types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT];
- $grouped = $this->getAccountsGrouped($types);
+ $types = [AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT];
+ $grouped = $this->getAccountsGrouped($types);
unset($options['class']);
@@ -139,7 +139,7 @@ class AccountForm
/** @var Account $account */
foreach ($accountList as $account) {
- $role = (string)$repository->getMetaValue($account, 'account_role');
+ $role = (string)$repository->getMetaValue($account, 'account_role');
if (in_array($account->accountType->type, $liabilityTypes, true)) {
$role = sprintf('l_%s', $account->accountType->type);
}
diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php
index 5058bfcdfc..0a85b876c1 100644
--- a/app/Support/Form/CurrencyForm.php
+++ b/app/Support/Form/CurrencyForm.php
@@ -70,8 +70,8 @@ class CurrencyForm
$currencyRepos = app(CurrencyRepositoryInterface::class);
// get all currencies:
- $list = $currencyRepos->get();
- $array = [];
+ $list = $currencyRepos->get();
+ $array = [];
/** @var TransactionCurrency $currency */
foreach ($list as $currency) {
@@ -92,8 +92,8 @@ class CurrencyForm
$currencyRepos = app(CurrencyRepositoryInterface::class);
// get all currencies:
- $list = $currencyRepos->get();
- $array = [
+ $list = $currencyRepos->get();
+ $array = [
0 => (string)trans('firefly.no_currency'),
];
@@ -118,15 +118,15 @@ class CurrencyForm
$defaultCurrency = $options['currency'] ?? app('amount')->getDefaultCurrency();
/** @var Collection $currencies */
- $currencies = app('amount')->getCurrencies();
+ $currencies = app('amount')->getCurrencies();
unset($options['currency'], $options['placeholder']);
// perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount)
- $preFilled = session('preFilled');
+ $preFilled = session('preFilled');
if (!is_array($preFilled)) {
$preFilled = [];
}
- $key = 'amount_currency_id_'.$name;
- $sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
+ $key = 'amount_currency_id_'.$name;
+ $sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
app('log')->debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
@@ -174,16 +174,16 @@ class CurrencyForm
$defaultCurrency = $options['currency'] ?? app('amount')->getDefaultCurrency();
/** @var Collection $currencies */
- $currencies = app('amount')->getAllCurrencies();
+ $currencies = app('amount')->getAllCurrencies();
unset($options['currency'], $options['placeholder']);
// perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount)
- $preFilled = session('preFilled');
+ $preFilled = session('preFilled');
if (!is_array($preFilled)) {
$preFilled = [];
}
- $key = 'amount_currency_id_'.$name;
- $sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
+ $key = 'amount_currency_id_'.$name;
+ $sentCurrencyId = array_key_exists($key, $preFilled) ? (int)$preFilled[$key] : $defaultCurrency->id;
app('log')->debug(sprintf('Sent currency ID is %d', $sentCurrencyId));
diff --git a/app/Support/Form/FormSupport.php b/app/Support/Form/FormSupport.php
index df00b6e727..41d5b0461e 100644
--- a/app/Support/Form/FormSupport.php
+++ b/app/Support/Form/FormSupport.php
@@ -38,7 +38,7 @@ trait FormSupport
*/
public function select(string $name, array $list = null, $selected = null, array $options = null): string
{
- $list ??= [];
+ $list ??= [];
$label = $this->label($name, $options);
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
@@ -71,7 +71,7 @@ trait FormSupport
*/
protected function expandOptionArray(string $name, $label, array $options = null): array
{
- $options ??= [];
+ $options ??= [];
$name = str_replace('[]', '', $name);
$options['class'] = 'form-control';
$options['id'] = 'ffInput_'.$name;
diff --git a/app/Support/Form/PiggyBankForm.php b/app/Support/Form/PiggyBankForm.php
index fa4f9b415a..0bd0d3c311 100644
--- a/app/Support/Form/PiggyBankForm.php
+++ b/app/Support/Form/PiggyBankForm.php
@@ -61,14 +61,14 @@ class PiggyBankForm
/** @var PiggyBank $piggy */
foreach ($piggyBanks as $piggy) {
- $group = $piggy->objectGroups->first();
- $groupTitle = null;
- $groupOrder = 0;
+ $group = $piggy->objectGroups->first();
+ $groupTitle = null;
+ $groupOrder = 0;
if (null !== $group) {
$groupTitle = $group->title;
$groupOrder = $group->order;
}
- $subList[$groupOrder] ??= [
+ $subList[$groupOrder] ??= [
'group' => [
'title' => $groupTitle,
],
diff --git a/app/Support/Form/RuleForm.php b/app/Support/Form/RuleForm.php
index 3b1b3e5583..4c58209f79 100644
--- a/app/Support/Form/RuleForm.php
+++ b/app/Support/Form/RuleForm.php
@@ -40,8 +40,8 @@ class RuleForm
$groupRepos = app(RuleGroupRepositoryInterface::class);
// get all currencies:
- $list = $groupRepos->get();
- $array = [];
+ $list = $groupRepos->get();
+ $array = [];
/** @var RuleGroup $group */
foreach ($list as $group) {
@@ -56,15 +56,15 @@ class RuleForm
*/
public function ruleGroupListWithEmpty(string $name, $value = null, array $options = null): string
{
- $options ??= [];
+ $options ??= [];
$options['class'] = 'form-control';
/** @var RuleGroupRepositoryInterface $groupRepos */
- $groupRepos = app(RuleGroupRepositoryInterface::class);
+ $groupRepos = app(RuleGroupRepositoryInterface::class);
// get all currencies:
- $list = $groupRepos->get();
- $array = [
+ $list = $groupRepos->get();
+ $array = [
0 => (string)trans('firefly.none_in_select_list'),
];
diff --git a/app/Support/Http/Api/AccountBalanceGrouped.php b/app/Support/Http/Api/AccountBalanceGrouped.php
index 9b706443ef..a166317143 100644
--- a/app/Support/Http/Api/AccountBalanceGrouped.php
+++ b/app/Support/Http/Api/AccountBalanceGrouped.php
@@ -56,7 +56,7 @@ class AccountBalanceGrouped
/** @var array $currency */
foreach ($this->data as $currency) {
// income and expense array prepped:
- $income = [
+ $income = [
'label' => 'earned',
'currency_id' => (string) $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -72,7 +72,7 @@ class AccountBalanceGrouped
'entries' => [],
'native_entries' => [],
];
- $expense = [
+ $expense = [
'label' => 'spent',
'currency_id' => (string) $currency['currency_id'],
'currency_symbol' => $currency['currency_symbol'],
@@ -91,22 +91,22 @@ class AccountBalanceGrouped
// loop all possible periods between $start and $end, and add them to the correct dataset.
$currentStart = clone $this->start;
while ($currentStart <= $this->end) {
- $key = $currentStart->format($this->carbonFormat);
- $label = $currentStart->toAtomString();
+ $key = $currentStart->format($this->carbonFormat);
+ $label = $currentStart->toAtomString();
// normal entries
- $income['entries'][$label] = app('steam')->bcround($currency[$key]['earned'] ?? '0', $currency['currency_decimal_places']);
- $expense['entries'][$label] = app('steam')->bcround($currency[$key]['spent'] ?? '0', $currency['currency_decimal_places']);
+ $income['entries'][$label] = app('steam')->bcround($currency[$key]['earned'] ?? '0', $currency['currency_decimal_places']);
+ $expense['entries'][$label] = app('steam')->bcround($currency[$key]['spent'] ?? '0', $currency['currency_decimal_places']);
// converted entries
$income['native_entries'][$label] = app('steam')->bcround($currency[$key]['native_earned'] ?? '0', $currency['native_currency_decimal_places']);
$expense['native_entries'][$label] = app('steam')->bcround($currency[$key]['native_spent'] ?? '0', $currency['native_currency_decimal_places']);
// next loop
- $currentStart = app('navigation')->addPeriod($currentStart, $this->preferredRange, 0);
+ $currentStart = app('navigation')->addPeriod($currentStart, $this->preferredRange, 0);
}
- $chartData[] = $income;
- $chartData[] = $expense;
+ $chartData[] = $income;
+ $chartData[] = $expense;
}
return $chartData;
@@ -125,13 +125,13 @@ class AccountBalanceGrouped
/** @var array $journal */
foreach ($this->journals as $journal) {
// format the date according to the period
- $period = $journal['date']->format($this->carbonFormat);
- $currencyId = (int) $journal['currency_id'];
- $currency = $this->currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
- $this->currencies[$currencyId] = $currency; // may just re-assign itself, don't mind.
+ $period = $journal['date']->format($this->carbonFormat);
+ $currencyId = (int) $journal['currency_id'];
+ $currency = $this->currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
+ $this->currencies[$currencyId] = $currency; // may just re-assign itself, don't mind.
// set the array with monetary info, if it does not exist.
- $this->data[$currencyId] ??= [
+ $this->data[$currencyId] ??= [
'currency_id' => (string) $currencyId,
'currency_symbol' => $journal['currency_symbol'],
'currency_code' => $journal['currency_code'],
@@ -153,8 +153,8 @@ class AccountBalanceGrouped
'native_earned' => '0',
];
// is this journal's amount in- our outgoing?
- $key = 'spent';
- $amount = app('steam')->negative($journal['amount']);
+ $key = 'spent';
+ $amount = app('steam')->negative($journal['amount']);
// deposit = incoming
// transfer or reconcile or opening balance, and these accounts are the destination.
if (
@@ -180,7 +180,7 @@ class AccountBalanceGrouped
app('log')->error($e->getMessage());
$rate = '1';
}
- $amountConverted = bcmul($amount, $rate);
+ $amountConverted = bcmul($amount, $rate);
// perhaps transaction already has the foreign amount in the native currency.
if ((int) $journal['foreign_currency_id'] === $this->default->id) {
@@ -189,7 +189,7 @@ class AccountBalanceGrouped
}
// add normal entry
- $this->data[$currencyId][$period][$key] = bcadd($this->data[$currencyId][$period][$key], $amount);
+ $this->data[$currencyId][$period][$key] = bcadd($this->data[$currencyId][$period][$key], $amount);
// add converted entry
$convertedKey = sprintf('native_%s', $key);
diff --git a/app/Support/Http/Api/ConvertsExchangeRates.php b/app/Support/Http/Api/ConvertsExchangeRates.php
index e329c0334c..a742d5a01f 100644
--- a/app/Support/Http/Api/ConvertsExchangeRates.php
+++ b/app/Support/Http/Api/ConvertsExchangeRates.php
@@ -45,7 +45,7 @@ trait ConvertsExchangeRates
// if not enabled, return the same array but without conversion:
return $set;
- $this->enabled = false;
+ $this->enabled = false;
if (false === $this->enabled) {
$set['converted'] = false;
@@ -55,8 +55,8 @@ trait ConvertsExchangeRates
$set['converted'] = true;
/** @var TransactionCurrency $native */
- $native = app('amount')->getDefaultCurrency();
- $currency = $this->getCurrency((int)$set['currency_id']);
+ $native = app('amount')->getDefaultCurrency();
+ $currency = $this->getCurrency((int)$set['currency_id']);
if ($native->id === $currency->id) {
$set['native_currency_id'] = (string)$currency->id;
$set['native_currency_code'] = $currency->code;
@@ -66,9 +66,9 @@ trait ConvertsExchangeRates
return $set;
}
foreach ($set['entries'] as $date => $entry) {
- $carbon = Carbon::createFromFormat(\DateTimeInterface::ATOM, $date);
- $rate = $this->getRate($currency, $native, $carbon);
- $rate = '0' === $rate ? '1' : $rate;
+ $carbon = Carbon::createFromFormat(\DateTimeInterface::ATOM, $date);
+ $rate = $this->getRate($currency, $native, $carbon);
+ $rate = '0' === $rate ? '1' : $rate;
app('log')->debug(sprintf('bcmul("%s", "%s")', (string)$entry, $rate));
$set['entries'][$date] = (float)bcmul((string)$entry, $rate);
}
@@ -109,9 +109,9 @@ trait ConvertsExchangeRates
foreach ($entries as $entry) {
$currency = $this->getCurrency((int)$entry['id']);
if ($currency->id !== $native->id) {
- $amount = $this->convertAmount($entry['sum'], $currency, $native);
- $entry['converted'] = true;
- $entry['native_sum'] = $amount;
+ $amount = $this->convertAmount($entry['sum'], $currency, $native);
+ $entry['converted'] = true;
+ $entry['native_sum'] = $amount;
$entry['native_currency_id'] = (string)$native->id;
$entry['native_currency_name'] = $native->name;
$entry['native_currency_symbol'] = $native->symbol;
@@ -119,8 +119,8 @@ trait ConvertsExchangeRates
$entry['native_currency_decimal_places'] = $native->decimal_places;
}
if ($currency->id === $native->id) {
- $entry['converted'] = false;
- $entry['native_sum'] = $entry['sum'];
+ $entry['converted'] = false;
+ $entry['native_sum'] = $entry['sum'];
$entry['native_currency_id'] = (string)$native->id;
$entry['native_currency_name'] = $native->name;
$entry['native_currency_symbol'] = $native->symbol;
diff --git a/app/Support/Http/Api/ExchangeRateConverter.php b/app/Support/Http/Api/ExchangeRateConverter.php
index 70991c150d..f73de03a6f 100644
--- a/app/Support/Http/Api/ExchangeRateConverter.php
+++ b/app/Support/Http/Api/ExchangeRateConverter.php
@@ -63,7 +63,7 @@ class ExchangeRateConverter
$start->startOfDay();
$end->endOfDay();
Log::debug(sprintf('Preparing for %s to %s between %s and %s', $from->code, $to->code, $start->format('Y-m-d'), $end->format('Y-m-d')));
- $set = auth()->user()
+ $set = auth()->user()
->currencyExchangeRates()
->where('from_currency_id', $from->id)
->where('to_currency_id', $to->id)
@@ -76,7 +76,7 @@ class ExchangeRateConverter
Log::debug('No prepared rates found in this period, use the fallback');
$this->fallback($from, $to, $start);
$this->noPreparedRates = true;
- $this->isPrepared = true;
+ $this->isPrepared = true;
Log::debug('prepare DONE()');
return;
@@ -84,10 +84,10 @@ class ExchangeRateConverter
$this->isPrepared = true;
// so there is a fallback just in case. Now loop the set of rates we DO have.
- $temp = [];
- $count = 0;
+ $temp = [];
+ $count = 0;
foreach ($set as $rate) {
- $date = $rate->date->format('Y-m-d');
+ $date = $rate->date->format('Y-m-d');
$temp[$date] ??= [
$from->id => [
$to->id => $rate->rate,
@@ -96,11 +96,11 @@ class ExchangeRateConverter
++$count;
}
Log::debug(sprintf('Found %d rates in this period.', $count));
- $currentStart = clone $start;
+ $currentStart = clone $start;
while ($currentStart->lte($end)) {
- $currentDate = $currentStart->format('Y-m-d');
+ $currentDate = $currentStart->format('Y-m-d');
$this->prepared[$currentDate] ??= [];
- $fallback = $temp[$currentDate][$from->id][$to->id] ?? $this->fallback[$from->id][$to->id] ?? '0';
+ $fallback = $temp[$currentDate][$from->id][$to->id] ?? $this->fallback[$from->id][$to->id] ?? '0';
if (0 === count($this->prepared[$currentDate]) && 0 !== bccomp('0', $fallback)) {
// fill from temp or fallback or from temp (see before)
$this->prepared[$currentDate][$from->id][$to->id] = $fallback;
@@ -138,12 +138,12 @@ class ExchangeRateConverter
return $fallback;
}
// first attempt:
- $rate = $this->getFromDB($from->id, $to->id, $date->format('Y-m-d'));
+ $rate = $this->getFromDB($from->id, $to->id, $date->format('Y-m-d'));
if (null !== $rate) {
return $rate;
}
// no result. perhaps the other way around?
- $rate = $this->getFromDB($to->id, $from->id, $date->format('Y-m-d'));
+ $rate = $this->getFromDB($to->id, $from->id, $date->format('Y-m-d'));
if (null !== $rate) {
return bcdiv('1', $rate);
}
@@ -170,7 +170,7 @@ class ExchangeRateConverter
if ($from === $to) {
return '1';
}
- $key = sprintf('cer-%d-%d-%s', $from, $to, $date);
+ $key = sprintf('cer-%d-%d-%s', $from, $to, $date);
// perhaps the rate has been cached during this particular run
$preparedRate = $this->prepared[$date][$from][$to] ?? null;
@@ -180,7 +180,7 @@ class ExchangeRateConverter
return $preparedRate;
}
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($key);
if ($cache->has()) {
$rate = $cache->get();
@@ -193,7 +193,7 @@ class ExchangeRateConverter
}
/** @var null|CurrencyExchangeRate $result */
- $result = auth()->user()
+ $result = auth()->user()
->currencyExchangeRates()
->where('from_currency_id', $from)
->where('to_currency_id', $to)
@@ -202,7 +202,7 @@ class ExchangeRateConverter
->first()
;
++$this->queryCount;
- $rate = (string) $result?->rate;
+ $rate = (string) $result?->rate;
if ('' === $rate) {
app('log')->debug(sprintf('Found no rate for #%d->#%d (%s) in the DB.', $from, $to, $date));
@@ -243,13 +243,13 @@ class ExchangeRateConverter
if ($euroId === $currency->id) {
return '1';
}
- $rate = $this->getFromDB($currency->id, $euroId, $date->format('Y-m-d'));
+ $rate = $this->getFromDB($currency->id, $euroId, $date->format('Y-m-d'));
if (null !== $rate) {
// app('log')->debug(sprintf('Rate for %s to EUR is %s.', $currency->code, $rate));
return $rate;
}
- $rate = $this->getFromDB($euroId, $currency->id, $date->format('Y-m-d'));
+ $rate = $this->getFromDB($euroId, $currency->id, $date->format('Y-m-d'));
if (null !== $rate) {
return bcdiv('1', $rate);
// app('log')->debug(sprintf('Inverted rate for %s to EUR is %s.', $currency->code, $rate));
@@ -278,7 +278,7 @@ class ExchangeRateConverter
if ($cache->has()) {
return (int) $cache->get();
}
- $euro = TransactionCurrency::whereCode('EUR')->first();
+ $euro = TransactionCurrency::whereCode('EUR')->first();
++$this->queryCount;
if (null === $euro) {
throw new FireflyException('Cannot find EUR in system, cannot do currency conversion.');
diff --git a/app/Support/Http/Api/SummaryBalanceGrouped.php b/app/Support/Http/Api/SummaryBalanceGrouped.php
index db3c9636b4..be28a4f90f 100644
--- a/app/Support/Http/Api/SummaryBalanceGrouped.php
+++ b/app/Support/Http/Api/SummaryBalanceGrouped.php
@@ -29,7 +29,7 @@ use Illuminate\Support\Facades\Log;
class SummaryBalanceGrouped
{
- private const string SUM = 'sum';
+ private const string SUM = 'sum';
private TransactionCurrency $default;
private array $amounts = [];
private array $keys;
@@ -54,11 +54,11 @@ class SummaryBalanceGrouped
/** @var array $journal */
foreach ($journals as $journal) {
// transaction info:
- $currencyId = (int)$journal['currency_id'];
- $amount = bcmul($journal['amount'], $multiplier);
- $currency = $this->currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
- $this->currencies[$currencyId] = $currency;
- $nativeAmount = $converter->convert($currency, $this->default, $journal['date'], $amount);
+ $currencyId = (int)$journal['currency_id'];
+ $amount = bcmul($journal['amount'], $multiplier);
+ $currency = $this->currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
+ $this->currencies[$currencyId] = $currency;
+ $nativeAmount = $converter->convert($currency, $this->default, $journal['date'], $amount);
if ((int)$journal['foreign_currency_id'] === $this->default->id) {
// use foreign amount instead
$nativeAmount = $journal['foreign_amount'];
@@ -82,7 +82,7 @@ class SummaryBalanceGrouped
public function groupData(): array
{
\Log::debug('Now going to group data.');
- $return = [];
+ $return = [];
foreach ($this->keys as $key) {
$title = match ($key) {
'sum' => 'balance',
diff --git a/app/Support/Http/Api/ValidatesUserGroupTrait.php b/app/Support/Http/Api/ValidatesUserGroupTrait.php
index 0f1e01609b..5a698ce75c 100644
--- a/app/Support/Http/Api/ValidatesUserGroupTrait.php
+++ b/app/Support/Http/Api/ValidatesUserGroupTrait.php
@@ -48,14 +48,14 @@ trait ValidatesUserGroupTrait
}
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
if (!$request->has('user_group_id')) {
$group = $user->userGroup;
app('log')->debug(sprintf('validateUserGroup: no user group submitted, return default group #%d.', $group?->id));
return $group;
}
- $groupId = (int)$request->get('user_group_id');
+ $groupId = (int)$request->get('user_group_id');
/** @var null|GroupMembership $membership */
$membership = $user->groupMemberships()->where('user_group_id', $groupId)->first();
diff --git a/app/Support/Http/Controllers/AugumentData.php b/app/Support/Http/Controllers/AugumentData.php
index 47822de750..489be0445f 100644
--- a/app/Support/Http/Controllers/AugumentData.php
+++ b/app/Support/Http/Controllers/AugumentData.php
@@ -54,10 +54,10 @@ trait AugumentData
/** @var Account $expenseAccount */
foreach ($accounts as $expenseAccount) {
- $collection = new Collection();
+ $collection = new Collection();
$collection->push($expenseAccount);
- $revenue = $repository->findByName($expenseAccount->name, [AccountType::REVENUE]);
+ $revenue = $repository->findByName($expenseAccount->name, [AccountType::REVENUE]);
if (null !== $revenue) {
$collection->push($revenue);
}
@@ -114,7 +114,7 @@ trait AugumentData
$return[$accountId] = $grouped[$accountId][0]['name'];
}
}
- $return[0] = '(no name)';
+ $return[0] = '(no name)';
return $return;
}
@@ -134,7 +134,7 @@ trait AugumentData
$return[$budgetId] = $grouped[$budgetId][0]['name'];
}
}
- $return[0] = (string)trans('firefly.no_budget');
+ $return[0] = (string)trans('firefly.no_budget');
return $return;
}
@@ -156,7 +156,7 @@ trait AugumentData
$return[$categoryId] = $grouped[$categoryId][0]['name'];
}
}
- $return[0] = (string)trans('firefly.no_category');
+ $return[0] = (string)trans('firefly.no_category');
return $return;
}
@@ -167,12 +167,12 @@ trait AugumentData
protected function getLimits(Budget $budget, Carbon $start, Carbon $end): Collection // get data + augment with info
{
/** @var OperationsRepositoryInterface $opsRepository */
- $opsRepository = app(OperationsRepositoryInterface::class);
+ $opsRepository = app(OperationsRepositoryInterface::class);
/** @var BudgetLimitRepositoryInterface $blRepository */
- $blRepository = app(BudgetLimitRepositoryInterface::class);
+ $blRepository = app(BudgetLimitRepositoryInterface::class);
// properties for cache
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($budget->id);
@@ -188,7 +188,7 @@ trait AugumentData
/** @var BudgetLimit $entry */
foreach ($set as $entry) {
- $currency = $entry->transactionCurrency;
+ $currency = $entry->transactionCurrency;
if (null === $currency) {
$currency = app('amount')->getDefaultCurrency();
@@ -224,7 +224,7 @@ trait AugumentData
/** @var array $journal */
foreach ($array as $journal) {
- $name = '(no name)';
+ $name = '(no name)';
if (TransactionType::WITHDRAWAL === $journal['transaction_type_type']) {
$name = $journal['destination_account_name'];
}
@@ -247,16 +247,16 @@ trait AugumentData
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
- $total = $assets->merge($opposing);
+ $total = $assets->merge($opposing);
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAccounts($total);
- $journals = $collector->getExtractedJournals();
- $sum = [
+ $journals = $collector->getExtractedJournals();
+ $sum = [
'grand_sum' => '0',
'per_currency' => [],
];
// loop to support multi currency
foreach ($journals as $journal) {
- $currencyId = (int)$journal['currency_id'];
+ $currencyId = (int)$journal['currency_id'];
// if not set, set to zero:
if (!array_key_exists($currencyId, $sum['per_currency'])) {
diff --git a/app/Support/Http/Controllers/ChartGeneration.php b/app/Support/Http/Controllers/ChartGeneration.php
index fd0c32255a..cce65122fa 100644
--- a/app/Support/Http/Controllers/ChartGeneration.php
+++ b/app/Support/Http/Controllers/ChartGeneration.php
@@ -44,7 +44,7 @@ trait ChartGeneration
protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method.
{
// chart properties for cache:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.account.account-balance-chart');
@@ -53,25 +53,25 @@ trait ChartGeneration
return $cache->get();
}
app('log')->debug('Regenerate chart.account.account-balance-chart from scratch.');
- $locale = app('steam')->getLocale();
+ $locale = app('steam')->getLocale();
/** @var GeneratorInterface $generator */
- $generator = app(GeneratorInterface::class);
+ $generator = app(GeneratorInterface::class);
/** @var AccountRepositoryInterface $accountRepos */
$accountRepos = app(AccountRepositoryInterface::class);
- $default = app('amount')->getDefaultCurrency();
- $chartData = [];
+ $default = app('amount')->getDefaultCurrency();
+ $chartData = [];
/** @var Account $account */
foreach ($accounts as $account) {
// TODO we can use getAccountCurrency instead.
- $currency = $accountRepos->getAccountCurrency($account);
+ $currency = $accountRepos->getAccountCurrency($account);
if (null === $currency) {
$currency = $default;
}
- $currentSet = [
+ $currentSet = [
'label' => $account->name,
'currency_symbol' => $currency->symbol,
'entries' => [],
@@ -81,16 +81,16 @@ trait ChartGeneration
$range = app('steam')->balanceInRange($account, $start, clone $end);
$previous = array_values($range)[0];
while ($currentStart <= $end) {
- $format = $currentStart->format('Y-m-d');
- $label = trim($currentStart->isoFormat((string)trans('config.month_and_day_js', [], $locale)));
- $balance = $range[$format] ?? $previous;
- $previous = $balance;
+ $format = $currentStart->format('Y-m-d');
+ $label = trim($currentStart->isoFormat((string)trans('config.month_and_day_js', [], $locale)));
+ $balance = $range[$format] ?? $previous;
+ $previous = $balance;
$currentStart->addDay();
$currentSet['entries'][$label] = $balance;
}
- $chartData[] = $currentSet;
+ $chartData[] = $currentSet;
}
- $data = $generator->multiSet($chartData);
+ $data = $generator->multiSet($chartData);
$cache->store($data);
return $data;
diff --git a/app/Support/Http/Controllers/CreateStuff.php b/app/Support/Http/Controllers/CreateStuff.php
index d340a1c28c..ebd702e5a2 100644
--- a/app/Support/Http/Controllers/CreateStuff.php
+++ b/app/Support/Http/Controllers/CreateStuff.php
@@ -101,7 +101,7 @@ trait CreateStuff
return;
}
- $key = RSA::createKey(4096);
+ $key = RSA::createKey(4096);
Log::alert('NO OAuth keys were found. They have been created.');
diff --git a/app/Support/Http/Controllers/DateCalculation.php b/app/Support/Http/Controllers/DateCalculation.php
index c846eaeec6..320734d456 100644
--- a/app/Support/Http/Controllers/DateCalculation.php
+++ b/app/Support/Http/Controllers/DateCalculation.php
@@ -90,19 +90,19 @@ trait DateCalculation
protected function getNextPeriods(Carbon $date, string $range): array
{
// select thing for next 12 periods:
- $loop = [];
+ $loop = [];
/** @var Carbon $current */
$current = app('navigation')->startOfPeriod($date, $range);
$current = app('navigation')->endOfPeriod($current, $range);
$current->addDay();
- $count = 0;
+ $count = 0;
while ($count < 12) {
$current = app('navigation')->endOfPeriod($current, $range);
$currentStart = app('navigation')->startOfPeriod($current, $range);
- $loop[] = [
+ $loop[] = [
'label' => $current->format('Y-m-d'),
'title' => app('navigation')->periodShow($current, $range),
'start' => clone $currentStart,
@@ -122,7 +122,7 @@ trait DateCalculation
protected function getPreviousPeriods(Carbon $date, string $range): array
{
// select thing for last 12 periods:
- $loop = [];
+ $loop = [];
/** @var Carbon $current */
$current = app('navigation')->startOfPeriod($date, $range);
diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php
index c40f469917..db23befbc2 100644
--- a/app/Support/Http/Controllers/GetConfigurationData.php
+++ b/app/Support/Http/Controllers/GetConfigurationData.php
@@ -59,13 +59,13 @@ trait GetConfigurationData
$steps = [];
if (is_array($elements) && count($elements) > 0) {
foreach ($elements as $key => $options) {
- $currentStep = $options;
+ $currentStep = $options;
// get the text:
$currentStep['intro'] = (string)trans('intro.'.$route.'_'.$key);
// save in array:
- $steps[] = $currentStep;
+ $steps[] = $currentStep;
}
}
app('log')->debug(sprintf('Total basic steps for %s is %d', $routeKey, count($steps)));
@@ -80,20 +80,20 @@ trait GetConfigurationData
*/
protected function getDateRangeConfig(): array // get configuration + get preferences.
{
- $viewRange = app('navigation')->getViewRange(false);
+ $viewRange = app('navigation')->getViewRange(false);
/** @var Carbon $start */
- $start = session('start');
+ $start = session('start');
/** @var Carbon $end */
- $end = session('end');
+ $end = session('end');
/** @var Carbon $first */
- $first = session('first');
- $title = sprintf('%s - %s', $start->isoFormat($this->monthAndDayFormat), $end->isoFormat($this->monthAndDayFormat));
- $isCustom = true === session('is_custom_range', false);
- $today = today(config('app.timezone'));
- $ranges = [
+ $first = session('first');
+ $title = sprintf('%s - %s', $start->isoFormat($this->monthAndDayFormat), $end->isoFormat($this->monthAndDayFormat));
+ $isCustom = true === session('is_custom_range', false);
+ $today = today(config('app.timezone'));
+ $ranges = [
// first range is the current range:
$title => [$start, $end],
];
@@ -122,10 +122,10 @@ trait GetConfigurationData
// today:
/** @var Carbon $todayStart */
- $todayStart = app('navigation')->startOfPeriod($today, $viewRange);
+ $todayStart = app('navigation')->startOfPeriod($today, $viewRange);
/** @var Carbon $todayEnd */
- $todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
+ $todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);
if ($todayStart->ne($start) || $todayEnd->ne($end)) {
$ranges[ucfirst((string)trans('firefly.today'))] = [$todayStart, $todayEnd];
}
@@ -183,13 +183,13 @@ trait GetConfigurationData
$elements = config(sprintf('intro.%s', $routeKey.'_'.$specificPage));
if (is_array($elements) && count($elements) > 0) {
foreach ($elements as $key => $options) {
- $currentStep = $options;
+ $currentStep = $options;
// get the text:
$currentStep['intro'] = (string)trans('intro.'.$route.'_'.$specificPage.'_'.$key);
// save in array:
- $steps[] = $currentStep;
+ $steps[] = $currentStep;
}
}
}
diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php
index c0f3eff785..accf008e3b 100644
--- a/app/Support/Http/Controllers/ModelInformation.php
+++ b/app/Support/Http/Controllers/ModelInformation.php
@@ -72,14 +72,14 @@ trait ModelInformation
protected function getLiabilityTypes(): array
{
/** @var AccountRepositoryInterface $repository */
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
// types of liability:
/** @var AccountType $debt */
- $debt = $repository->getAccountTypeByType(AccountType::DEBT);
+ $debt = $repository->getAccountTypeByType(AccountType::DEBT);
/** @var AccountType $loan */
- $loan = $repository->getAccountTypeByType(AccountType::LOAN);
+ $loan = $repository->getAccountTypeByType(AccountType::LOAN);
/** @var AccountType $mortgage */
$mortgage = $repository->getAccountTypeByType(AccountType::MORTGAGE);
@@ -111,8 +111,8 @@ trait ModelInformation
protected function getTriggersForBill(Bill $bill): array // get info and augument
{
// TODO duplicate code
- $operators = config('search.operators');
- $triggers = [];
+ $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));
@@ -162,8 +162,8 @@ trait ModelInformation
private function getTriggersForJournal(TransactionJournal $journal): array
{
// TODO duplicated code.
- $operators = config('search.operators');
- $triggers = [];
+ $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));
@@ -171,18 +171,18 @@ trait ModelInformation
}
asort($triggers);
- $result = [];
- $journalTriggers = [];
- $values = [];
- $index = 0;
+ $result = [];
+ $journalTriggers = [];
+ $values = [];
+ $index = 0;
// amount, description, category, budget, tags, source, destination, notes, currency type
// ,type
/** @var null|Transaction $source */
- $source = $journal->transactions()->where('amount', '<', 0)->first();
+ $source = $journal->transactions()->where('amount', '<', 0)->first();
/** @var null|Transaction $destination */
- $destination = $journal->transactions()->where('amount', '>', 0)->first();
+ $destination = $journal->transactions()->where('amount', '>', 0)->first();
if (null === $destination || null === $source) {
return $result;
}
@@ -217,21 +217,21 @@ trait ModelInformation
++$index;
// category (if)
- $category = $journal->categories()->first();
+ $category = $journal->categories()->first();
if (null !== $category) {
$journalTriggers[$index] = 'category_is';
$values[$index] = $category->name;
++$index;
}
// budget (if)
- $budget = $journal->budgets()->first();
+ $budget = $journal->budgets()->first();
if (null !== $budget) {
$journalTriggers[$index] = 'budget_is';
$values[$index] = $budget->name;
++$index;
}
// tags (if)
- $tags = $journal->tags()->get();
+ $tags = $journal->tags()->get();
/** @var Tag $tag */
foreach ($tags as $tag) {
@@ -240,7 +240,7 @@ trait ModelInformation
++$index;
}
// notes (if)
- $notes = $journal->notes()->first();
+ $notes = $journal->notes()->first();
if (null !== $notes) {
$journalTriggers[$index] = 'notes_are';
$values[$index] = $notes->text;
diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php
index 7f2eb36ed7..9a09e68db1 100644
--- a/app/Support/Http/Controllers/PeriodOverview.php
+++ b/app/Support/Http/Controllers/PeriodOverview.php
@@ -74,11 +74,11 @@ trait PeriodOverview
*/
protected function getAccountPeriodOverview(Account $account, Carbon $start, Carbon $end): array
{
- $range = app('navigation')->getViewRange(true);
+ $range = app('navigation')->getViewRange(true);
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
// properties for cache
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('account-show-period-entries');
@@ -88,32 +88,32 @@ trait PeriodOverview
}
/** @var array $dates */
- $dates = app('navigation')->blockPeriods($start, $end, $range);
- $entries = [];
+ $dates = app('navigation')->blockPeriods($start, $end, $range);
+ $entries = [];
// collect all expenses in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]));
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::DEPOSIT]);
- $earnedSet = $collector->getExtractedJournals();
+ $earnedSet = $collector->getExtractedJournals();
// collect all income in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]));
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::WITHDRAWAL]);
- $spentSet = $collector->getExtractedJournals();
+ $spentSet = $collector->getExtractedJournals();
// collect all transfers in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]));
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::TRANSFER]);
- $transferSet = $collector->getExtractedJournals();
+ $transferSet = $collector->getExtractedJournals();
// loop dates
foreach ($dates as $currentDate) {
@@ -124,8 +124,8 @@ trait PeriodOverview
$transferredIn = $this->filterTransferredIn($account, $this->filterJournalsByDate($transferSet, $currentDate['start'], $currentDate['end']));
$entries[]
= [
- 'title' => $title,
- 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]),
+ 'title' => $title,
+ 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]),
'total_transactions' => count($spent) + count($earned) + count($transferredAway) + count($transferredIn),
'spent' => $this->groupByCurrency($spent),
@@ -146,11 +146,11 @@ trait PeriodOverview
*/
protected function getCategoryPeriodOverview(Category $category, Carbon $start, Carbon $end): array
{
- $range = app('navigation')->getViewRange(true);
+ $range = app('navigation')->getViewRange(true);
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
// properties for entries with their amounts.
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($range);
@@ -162,32 +162,32 @@ trait PeriodOverview
}
/** @var array $dates */
- $dates = app('navigation')->blockPeriods($start, $end, $range);
- $entries = [];
+ $dates = app('navigation')->blockPeriods($start, $end, $range);
+ $entries = [];
// collect all expenses in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setCategory($category);
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::DEPOSIT]);
- $earnedSet = $collector->getExtractedJournals();
+ $earnedSet = $collector->getExtractedJournals();
// collect all income in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setCategory($category);
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::WITHDRAWAL]);
- $spentSet = $collector->getExtractedJournals();
+ $spentSet = $collector->getExtractedJournals();
// collect all transfers in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setCategory($category);
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::TRANSFER]);
- $transferSet = $collector->getExtractedJournals();
+ $transferSet = $collector->getExtractedJournals();
foreach ($dates as $currentDate) {
$spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']);
$earned = $this->filterJournalsByDate($earnedSet, $currentDate['start'], $currentDate['end']);
@@ -221,11 +221,11 @@ trait PeriodOverview
*/
protected function getNoBudgetPeriodOverview(Carbon $start, Carbon $end): array
{
- $range = app('navigation')->getViewRange(true);
+ $range = app('navigation')->getViewRange(true);
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('no-budget-period-entries');
@@ -235,14 +235,14 @@ trait PeriodOverview
}
/** @var array $dates */
- $dates = app('navigation')->blockPeriods($start, $end, $range);
- $entries = [];
+ $dates = app('navigation')->blockPeriods($start, $end, $range);
+ $entries = [];
// get all expenses without a budget.
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->withoutBudget()->withAccountInformation()->setTypes([TransactionType::WITHDRAWAL]);
- $journals = $collector->getExtractedJournals();
+ $journals = $collector->getExtractedJournals();
foreach ($dates as $currentDate) {
$set = $this->filterJournalsByDate($journals, $currentDate['start'], $currentDate['end']);
@@ -273,37 +273,37 @@ trait PeriodOverview
protected function getNoCategoryPeriodOverview(Carbon $theDate): array
{
app('log')->debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d')));
- $range = app('navigation')->getViewRange(true);
- $first = $this->journalRepos->firstNull();
- $start = null === $first ? new Carbon() : $first->date;
- $end = clone $theDate;
+ $range = app('navigation')->getViewRange(true);
+ $first = $this->journalRepos->firstNull();
+ $start = null === $first ? new Carbon() : $first->date;
+ $end = clone $theDate;
app('log')->debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d')));
app('log')->debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d')));
// properties for cache
- $dates = app('navigation')->blockPeriods($start, $end, $range);
- $entries = [];
+ $dates = app('navigation')->blockPeriods($start, $end, $range);
+ $entries = [];
// collect all expenses in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->withoutCategory();
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::DEPOSIT]);
- $earnedSet = $collector->getExtractedJournals();
+ $earnedSet = $collector->getExtractedJournals();
// collect all income in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->withoutCategory();
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::WITHDRAWAL]);
- $spentSet = $collector->getExtractedJournals();
+ $spentSet = $collector->getExtractedJournals();
// collect all transfers in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->withoutCategory();
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::TRANSFER]);
@@ -337,11 +337,11 @@ trait PeriodOverview
*/
protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags.
{
- $range = app('navigation')->getViewRange(true);
+ $range = app('navigation')->getViewRange(true);
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
// properties for cache
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('tag-period-entries');
@@ -351,37 +351,37 @@ trait PeriodOverview
}
/** @var array $dates */
- $dates = app('navigation')->blockPeriods($start, $end, $range);
- $entries = [];
+ $dates = app('navigation')->blockPeriods($start, $end, $range);
+ $entries = [];
// collect all expenses in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setTag($tag);
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::DEPOSIT]);
- $earnedSet = $collector->getExtractedJournals();
+ $earnedSet = $collector->getExtractedJournals();
// collect all income in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setTag($tag);
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::WITHDRAWAL]);
- $spentSet = $collector->getExtractedJournals();
+ $spentSet = $collector->getExtractedJournals();
// collect all transfers in this period:
/** @var GroupCollectorInterface $collector */
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setTag($tag);
$collector->setRange($start, $end);
$collector->setTypes([TransactionType::TRANSFER]);
- $transferSet = $collector->getExtractedJournals();
+ $transferSet = $collector->getExtractedJournals();
// filer all of them:
- $earnedSet = $this->filterJournalsByTag($earnedSet, $tag);
- $spentSet = $this->filterJournalsByTag($spentSet, $tag);
- $transferSet = $this->filterJournalsByTag($transferSet, $tag);
+ $earnedSet = $this->filterJournalsByTag($earnedSet, $tag);
+ $spentSet = $this->filterJournalsByTag($spentSet, $tag);
+ $transferSet = $this->filterJournalsByTag($transferSet, $tag);
foreach ($dates as $currentDate) {
$spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']);
@@ -411,12 +411,12 @@ trait PeriodOverview
*/
protected function getTransactionPeriodOverview(string $transactionType, Carbon $start, Carbon $end): array
{
- $range = app('navigation')->getViewRange(true);
- $types = config(sprintf('firefly.transactionTypesByType.%s', $transactionType));
+ $range = app('navigation')->getViewRange(true);
+ $types = config(sprintf('firefly.transactionTypesByType.%s', $transactionType));
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
// properties for cache
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('transactions-period-entries');
@@ -426,13 +426,13 @@ trait PeriodOverview
}
/** @var array $dates */
- $dates = app('navigation')->blockPeriods($start, $end, $range);
- $entries = [];
+ $dates = app('navigation')->blockPeriods($start, $end, $range);
+ $entries = [];
// collect all journals in this period (regardless of type)
- $collector = app(GroupCollectorInterface::class);
+ $collector = app(GroupCollectorInterface::class);
$collector->setTypes($types)->setRange($start, $end);
- $genericSet = $collector->getExtractedJournals();
+ $genericSet = $collector->getExtractedJournals();
foreach ($dates as $currentDate) {
$spent = [];
@@ -451,7 +451,7 @@ trait PeriodOverview
$transferred = $this->filterJournalsByDate($genericSet, $currentDate['start'], $currentDate['end']);
}
$entries[]
- = [
+ = [
'title' => $title,
'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]),
'total_transactions' => count($spent) + count($earned) + count($transferred),
@@ -521,8 +521,8 @@ trait PeriodOverview
/** @var array $journal */
foreach ($journals as $journal) {
- $currencyId = (int) $journal['currency_id'];
- $foreignCurrencyId = $journal['foreign_currency_id'];
+ $currencyId = (int) $journal['currency_id'];
+ $foreignCurrencyId = $journal['foreign_currency_id'];
if (!array_key_exists($currencyId, $return)) {
$return[$currencyId] = [
'amount' => '0',
@@ -561,7 +561,7 @@ trait PeriodOverview
{
$return = [];
foreach ($set as $entry) {
- $found = false;
+ $found = false;
/** @var array $localTag */
foreach ($entry['tags'] as $localTag) {
diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php
index 2873235c56..d03ecb2835 100644
--- a/app/Support/Http/Controllers/RenderPartialViews.php
+++ b/app/Support/Http/Controllers/RenderPartialViews.php
@@ -50,20 +50,20 @@ trait RenderPartialViews
protected function budgetEntry(array $attributes): string // generate view for report.
{
/** @var PopupReportInterface $popupHelper */
- $popupHelper = app(PopupReportInterface::class);
+ $popupHelper = app(PopupReportInterface::class);
/** @var BudgetRepositoryInterface $budgetRepository */
$budgetRepository = app(BudgetRepositoryInterface::class);
$budget = $budgetRepository->find((int)$attributes['budgetId']);
- $accountRepos = app(AccountRepositoryInterface::class);
- $account = $accountRepos->find((int)$attributes['accountId']);
+ $accountRepos = app(AccountRepositoryInterface::class);
+ $account = $accountRepos->find((int)$attributes['accountId']);
if (null === $budget || null === $account) {
throw new FireflyException('Could not render popup.report.balance-amount because budget or account is null.');
}
- $journals = $popupHelper->balanceForBudget($budget, $account, $attributes);
+ $journals = $popupHelper->balanceForBudget($budget, $account, $attributes);
try {
$view = view('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render();
@@ -111,13 +111,13 @@ trait RenderPartialViews
$budgetRepository = app(BudgetRepositoryInterface::class);
/** @var PopupReportInterface $popupHelper */
- $popupHelper = app(PopupReportInterface::class);
+ $popupHelper = app(PopupReportInterface::class);
- $budget = $budgetRepository->find((int)$attributes['budgetId']);
+ $budget = $budgetRepository->find((int)$attributes['budgetId']);
if (null === $budget) {
$budget = new Budget();
}
- $journals = $popupHelper->byBudget($budget, $attributes);
+ $journals = $popupHelper->byBudget($budget, $attributes);
try {
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
@@ -139,7 +139,7 @@ trait RenderPartialViews
protected function categoryEntry(array $attributes): string // generate view for report.
{
/** @var PopupReportInterface $popupHelper */
- $popupHelper = app(PopupReportInterface::class);
+ $popupHelper = app(PopupReportInterface::class);
/** @var CategoryRepositoryInterface $categoryRepository */
$categoryRepository = app(CategoryRepositoryInterface::class);
@@ -234,15 +234,15 @@ trait RenderPartialViews
$accountRepository = app(AccountRepositoryInterface::class);
/** @var PopupReportInterface $popupHelper */
- $popupHelper = app(PopupReportInterface::class);
+ $popupHelper = app(PopupReportInterface::class);
- $account = $accountRepository->find((int)$attributes['accountId']);
+ $account = $accountRepository->find((int)$attributes['accountId']);
if (null === $account) {
return 'This is an unknown account. Apologies.';
}
- $journals = $popupHelper->byExpenses($account, $attributes);
+ $journals = $popupHelper->byExpenses($account, $attributes);
try {
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
@@ -263,8 +263,8 @@ trait RenderPartialViews
*/
protected function getCurrentActions(Rule $rule): array // get info from object and present.
{
- $index = 0;
- $actions = [];
+ $index = 0;
+ $actions = [];
// must be repos
$currentActions = $rule->ruleActions()->orderBy('order', 'ASC')->get();
@@ -303,8 +303,8 @@ trait RenderPartialViews
protected function getCurrentTriggers(Rule $rule): array // get info from object and present.
{
// TODO duplicated code.
- $operators = config('search.operators');
- $triggers = [];
+ $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));
@@ -322,7 +322,7 @@ trait RenderPartialViews
$count = ($index + 1);
try {
- $rootOperator = OperatorQuerySearch::getRootOperator((string)$entry->trigger_type);
+ $rootOperator = OperatorQuerySearch::getRootOperator((string)$entry->trigger_type);
if (str_starts_with($rootOperator, '-')) {
$rootOperator = substr($rootOperator, 1);
}
@@ -362,14 +362,14 @@ trait RenderPartialViews
$accountRepository = app(AccountRepositoryInterface::class);
/** @var PopupReportInterface $popupHelper */
- $popupHelper = app(PopupReportInterface::class);
- $account = $accountRepository->find((int)$attributes['accountId']);
+ $popupHelper = app(PopupReportInterface::class);
+ $account = $accountRepository->find((int)$attributes['accountId']);
if (null === $account) {
return 'This is an unknown category. Apologies.';
}
- $journals = $popupHelper->byIncome($account, $attributes);
+ $journals = $popupHelper->byIncome($account, $attributes);
try {
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
diff --git a/app/Support/Http/Controllers/RequestInformation.php b/app/Support/Http/Controllers/RequestInformation.php
index 77cfd2ec0d..96fdcd2ef7 100644
--- a/app/Support/Http/Controllers/RequestInformation.php
+++ b/app/Support/Http/Controllers/RequestInformation.php
@@ -81,13 +81,13 @@ trait RequestInformation
$page = $this->getPageName();
$specificPage = $this->getSpecificPageName();
// indicator if user has seen the help for this page ( + special page):
- $key = sprintf('shown_demo_%s%s', $page, $specificPage);
+ $key = sprintf('shown_demo_%s%s', $page, $specificPage);
// is there an intro for this route?
$intro = config(sprintf('intro.%s', $page)) ?? [];
$specialIntro = config(sprintf('intro.%s%s', $page, $specificPage)) ?? [];
// some routes have a "what" parameter, which indicates a special page:
- $shownDemo = true;
+ $shownDemo = true;
// both must be array and either must be > 0
if (count($intro) > 0 || count($specialIntro) > 0) {
$shownDemo = app('preferences')->get($key, false)->data;
@@ -121,7 +121,7 @@ trait RequestInformation
final protected function notInSessionRange(Carbon $date): bool // Validate a preference
{
/** @var Carbon $start */
- $start = session('start', today(config('app.timezone'))->startOfMonth());
+ $start = session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $end */
$end = session('end', today(config('app.timezone'))->endOfMonth());
@@ -143,20 +143,20 @@ trait RequestInformation
final protected function parseAttributes(array $attributes): array // parse input + return result
{
$attributes['location'] ??= '';
- $attributes['accounts'] = AccountList::routeBinder($attributes['accounts'] ?? '', new Route('get', '', []));
- $date = Carbon::createFromFormat('Ymd', $attributes['startDate']);
+ $attributes['accounts'] = AccountList::routeBinder($attributes['accounts'] ?? '', new Route('get', '', []));
+ $date = Carbon::createFromFormat('Ymd', $attributes['startDate']);
if (false === $date) {
$date = today(config('app.timezone'));
}
$date->startOfMonth();
$attributes['startDate'] = $date;
- $date2 = Carbon::createFromFormat('Ymd', $attributes['endDate']);
+ $date2 = Carbon::createFromFormat('Ymd', $attributes['endDate']);
if (false === $date2) {
$date2 = today(config('app.timezone'));
}
$date2->endOfDay();
- $attributes['endDate'] = $date2;
+ $attributes['endDate'] = $date2;
return $attributes;
}
diff --git a/app/Support/Http/Controllers/RuleManagement.php b/app/Support/Http/Controllers/RuleManagement.php
index f3aae1afc0..8a6b527bfd 100644
--- a/app/Support/Http/Controllers/RuleManagement.php
+++ b/app/Support/Http/Controllers/RuleManagement.php
@@ -72,8 +72,8 @@ trait RuleManagement
protected function getPreviousTriggers(Request $request): array
{
// TODO duplicated code.
- $operators = config('search.operators');
- $triggers = [];
+ $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));
@@ -127,7 +127,7 @@ trait RuleManagement
}
asort($triggers);
- $index = 0;
+ $index = 0;
foreach ($submittedOperators as $operator) {
$rootOperator = OperatorQuerySearch::getRootOperator($operator['type']);
$needsContext = (bool)config(sprintf('search.operators.%s.needs_context', $rootOperator));
diff --git a/app/Support/Http/Controllers/TransactionCalculation.php b/app/Support/Http/Controllers/TransactionCalculation.php
index e43fa9f847..db847dad41 100644
--- a/app/Support/Http/Controllers/TransactionCalculation.php
+++ b/app/Support/Http/Controllers/TransactionCalculation.php
@@ -38,7 +38,7 @@ trait TransactionCalculation
*/
protected function getExpensesForOpposing(Collection $accounts, Collection $opposing, Carbon $start, Carbon $end): array
{
- $total = $accounts->merge($opposing);
+ $total = $accounts->merge($opposing);
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
@@ -117,7 +117,7 @@ trait TransactionCalculation
*/
protected function getIncomeForOpposing(Collection $accounts, Collection $opposing, Carbon $start, Carbon $end): array
{
- $total = $accounts->merge($opposing);
+ $total = $accounts->merge($opposing);
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
diff --git a/app/Support/Http/Controllers/UserNavigation.php b/app/Support/Http/Controllers/UserNavigation.php
index f60fc97bd3..22065bb0c0 100644
--- a/app/Support/Http/Controllers/UserNavigation.php
+++ b/app/Support/Http/Controllers/UserNavigation.php
@@ -68,7 +68,7 @@ trait UserNavigation
final protected function isEditableGroup(TransactionGroup $group): bool
{
/** @var null|TransactionJournal $journal */
- $journal = $group->transactionJournals()->first();
+ $journal = $group->transactionJournals()->first();
if (null === $journal) {
return false;
}
@@ -95,10 +95,10 @@ trait UserNavigation
return redirect(route('index'));
}
- $journal = $transaction->transactionJournal;
+ $journal = $transaction->transactionJournal;
/** @var null|Transaction $other */
- $other = $journal->transactions()->where('id', '!=', $transaction->id)->first();
+ $other = $journal->transactions()->where('id', '!=', $transaction->id)->first();
if (null === $other) {
app('log')->error(sprintf('Account #%d has no valid journals. Dont know where it belongs.', $account->id));
session()->flash('error', trans('firefly.cant_find_redirect_account'));
@@ -118,7 +118,7 @@ trait UserNavigation
final protected function redirectGroupToAccount(TransactionGroup $group)
{
/** @var null|TransactionJournal $journal */
- $journal = $group->transactionJournals()->first();
+ $journal = $group->transactionJournals()->first();
if (null === $journal) {
app('log')->error(sprintf('No journals in group #%d', $group->id));
diff --git a/app/Support/Models/BillDateCalculator.php b/app/Support/Models/BillDateCalculator.php
index e2683a4a8f..5a525b355f 100644
--- a/app/Support/Models/BillDateCalculator.php
+++ b/app/Support/Models/BillDateCalculator.php
@@ -48,7 +48,7 @@ class BillDateCalculator
// 2023-06-23 subDay to fix 7655
$currentStart->subDay();
- $loop = 0;
+ $loop = 0;
Log::debug('Start of loop');
while ($currentStart <= $latest) {
Log::debug(sprintf('Current start is %s', $currentStart->format('Y-m-d')));
@@ -82,7 +82,7 @@ class BillDateCalculator
// 2023-10
// for the next loop, go to end of period, THEN add day.
$nextExpectedMatch->addDay();
- $currentStart = clone $nextExpectedMatch;
+ $currentStart = clone $nextExpectedMatch;
++$loop;
if ($loop > 12) {
@@ -92,7 +92,7 @@ class BillDateCalculator
}
}
Log::debug('end of loop');
- $simple = $set->map(
+ $simple = $set->map(
static function (Carbon $date) {
return $date->format('Y-m-d');
}
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index cb37988a42..ae9c6e3c83 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -110,7 +110,7 @@ class Navigation
if ($end < $start) {
[$start, $end] = [$end, $start];
}
- $periods = [];
+ $periods = [];
// first, 13 periods of [range]
$loopCount = 0;
$loopDate = clone $end;
@@ -160,7 +160,7 @@ class Navigation
public function startOfPeriod(Carbon $theDate, string $repeatFreq): Carbon
{
- $date = clone $theDate;
+ $date = clone $theDate;
$functionMap = [
'1D' => 'startOfDay',
@@ -191,7 +191,7 @@ class Navigation
return $date;
}
- $result = match ($repeatFreq) {
+ $result = match ($repeatFreq) {
'last7' => $date->subDays(7)->startOfDay(),
'last30' => $date->subDays(30)->startOfDay(),
'last90' => $date->subDays(90)->startOfDay(),
@@ -215,7 +215,7 @@ class Navigation
public function endOfPeriod(Carbon $end, string $repeatFreq): Carbon
{
- $currentEnd = clone $end;
+ $currentEnd = clone $end;
$functionMap = [
'1D' => 'endOfDay',
@@ -245,14 +245,14 @@ class Navigation
'6M' => 6,
];
- $subDay = ['week', 'weekly', '1W', 'month', 'monthly', '1M', '3M', 'quarter', 'quarterly', '6M', 'half-year', 'half_year', '1Y', 'year', 'yearly'];
+ $subDay = ['week', 'weekly', '1W', 'month', 'monthly', '1M', '3M', 'quarter', 'quarterly', '6M', 'half-year', 'half_year', '1Y', 'year', 'yearly'];
// if the range is custom, the end of the period
// is another X days (x is the difference between start)
// and end added to $theCurrentEnd
if ('custom' === $repeatFreq) {
/** @var Carbon $tStart */
- $tStart = session('start', today(config('app.timezone'))->startOfMonth());
+ $tStart = session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $tEnd */
$tEnd = session('end', today(config('app.timezone'))->endOfMonth());
@@ -262,7 +262,7 @@ class Navigation
return $currentEnd;
}
- $result = match ($repeatFreq) {
+ $result = match ($repeatFreq) {
'last7' => $currentEnd->addDays(7)->startOfDay(),
'last30' => $currentEnd->addDays(30)->startOfDay(),
'last90' => $currentEnd->addDays(90)->startOfDay(),
@@ -282,7 +282,7 @@ class Navigation
return $end;
}
- $function = $functionMap[$repeatFreq];
+ $function = $functionMap[$repeatFreq];
if (array_key_exists($repeatFreq, $modifierMap)) {
$currentEnd->{$function}($modifierMap[$repeatFreq]); // @phpstan-ignore-line
@@ -311,7 +311,7 @@ class Navigation
$beginning->format('Y-m-d'),
$end->format('Y-m-d')
));
- $map = [
+ $map = [
'daily' => 'floatDiffInDays',
'weekly' => 'floatDiffInWeeks',
'monthly' => 'floatDiffInMonths',
@@ -324,7 +324,7 @@ class Navigation
return 1;
}
- $func = $map[$period];
+ $func = $map[$period];
// first do the diff
$floatDiff = $beginning->{$func}($end); // @phpstan-ignore-line
@@ -339,7 +339,7 @@ class Navigation
}
// then do ceil()
- $diff = ceil($floatDiff);
+ $diff = ceil($floatDiff);
Log::debug(sprintf('Diff is %f periods (%d rounded up)', $floatDiff, $diff));
@@ -376,7 +376,7 @@ class Navigation
'yearly' => 'endOfYear',
];
- $currentEnd = clone $theCurrentEnd;
+ $currentEnd = clone $theCurrentEnd;
if (array_key_exists($repeatFreq, $functionMap)) {
$function = $functionMap[$repeatFreq];
@@ -431,7 +431,7 @@ class Navigation
*/
public function listOfPeriods(Carbon $start, Carbon $end): array
{
- $locale = app('steam')->getLocale();
+ $locale = app('steam')->getLocale();
// define period to increment
$increment = 'addDay';
$format = $this->preferredCarbonFormat($start, $end);
@@ -447,8 +447,8 @@ class Navigation
$increment = 'addYear';
$displayFormat = (string)trans('config.year_js');
}
- $begin = clone $start;
- $entries = [];
+ $begin = clone $start;
+ $entries = [];
while ($begin < $end) {
$formatted = $begin->format($format);
$displayed = $begin->isoFormat($displayFormat);
@@ -606,7 +606,7 @@ class Navigation
public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = null): Carbon
{
$subtract ??= 1;
- $date = clone $theDate;
+ $date = clone $theDate;
// 1D 1W 1M 3M 6M 1Y
$functionMap = [
'1D' => 'subDays',
@@ -645,7 +645,7 @@ class Navigation
// this is then subtracted from $theDate (* $subtract).
if ('custom' === $repeatFreq) {
/** @var Carbon $tStart */
- $tStart = session('start', today(config('app.timezone'))->startOfMonth());
+ $tStart = session('start', today(config('app.timezone'))->startOfMonth());
/** @var Carbon $tEnd */
$tEnd = session('end', today(config('app.timezone'))->endOfMonth());
@@ -737,7 +737,7 @@ class Navigation
return $fiscalHelper->endOfFiscalYear($end);
}
- $list = [
+ $list = [
'last7',
'last30',
'last90',
diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php
index a5c8d4f024..d529c2f430 100644
--- a/app/Support/ParseDateString.php
+++ b/app/Support/ParseDateString.php
@@ -76,15 +76,15 @@ class ParseDateString
public function parseDate(string $date): Carbon
{
app('log')->debug(sprintf('parseDate("%s")', $date));
- $date = strtolower($date);
+ $date = strtolower($date);
// parse keywords:
if (in_array($date, $this->keywords, true)) {
return $this->parseKeyword($date);
}
// if regex for YYYY-MM-DD:
- $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
- $result = preg_match($pattern, $date);
+ $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/';
+ $result = preg_match($pattern, $date);
if (false !== $result && 0 !== $result) {
return $this->parseDefaultDate($date);
}
@@ -222,11 +222,11 @@ class ParseDateString
foreach ($parts as $part) {
app('log')->debug(sprintf('Now parsing part "%s"', $part));
- $part = trim($part);
+ $part = trim($part);
// verify if correct
- $pattern = '/[+-]\d+[wqmdy]/';
- $result = preg_match($pattern, $part);
+ $pattern = '/[+-]\d+[wqmdy]/';
+ $result = preg_match($pattern, $part);
if (0 === $result || false === $result) {
app('log')->error(sprintf('Part "%s" does not match regular expression. Will be skipped.', $part));
@@ -240,7 +240,7 @@ class ParseDateString
continue;
}
- $func = $functions[$direction][$period];
+ $func = $functions[$direction][$period];
app('log')->debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
$today->{$func}($number); // @phpstan-ignore-line
app('log')->debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 3a78f0b551..5d1f6aa6d3 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -129,11 +129,11 @@ class Preferences
if ('currencyPreference' === $name) {
throw new FireflyException('No longer supports "currencyPreference", please refactor me.');
}
- $fullName = sprintf('preference%s%s', $user->id, $name);
+ $fullName = sprintf('preference%s%s', $user->id, $name);
\Cache::forget($fullName);
/** @var null|Preference $pref */
- $pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
+ $pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
if (null !== $pref && null === $value) {
$pref->delete();
diff --git a/app/Support/Report/Budget/BudgetReportGenerator.php b/app/Support/Report/Budget/BudgetReportGenerator.php
index 80b123baf4..7628b36d1a 100644
--- a/app/Support/Report/Budget/BudgetReportGenerator.php
+++ b/app/Support/Report/Budget/BudgetReportGenerator.php
@@ -76,7 +76,7 @@ class BudgetReportGenerator
/** @var Account $account */
foreach ($this->accounts as $account) {
- $accountId = $account->id;
+ $accountId = $account->id;
$this->report[$accountId] ??= [
'name' => $account->name,
'id' => $account->id,
@@ -177,7 +177,7 @@ class BudgetReportGenerator
??= '0';
$this->report[$sourceAccountId]['currencies'][$currencyId]['budgets'][$budgetId]
- = bcadd($this->report[$sourceAccountId]['currencies'][$currencyId]['budgets'][$budgetId], $journal['amount']);
+ = bcadd($this->report[$sourceAccountId]['currencies'][$currencyId]['budgets'][$budgetId], $journal['amount']);
}
}
@@ -199,7 +199,7 @@ class BudgetReportGenerator
*/
private function processBudget(Budget $budget): void
{
- $budgetId = $budget->id;
+ $budgetId = $budget->id;
$this->report['budgets'][$budgetId] ??= [
'budget_id' => $budgetId,
'budget_name' => $budget->name,
@@ -208,7 +208,7 @@ class BudgetReportGenerator
];
// get all budget limits for budget in period:
- $limits = $this->blRepository->getBudgetLimits($budget, $this->start, $this->end);
+ $limits = $this->blRepository->getBudgetLimits($budget, $this->start, $this->end);
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
@@ -221,14 +221,14 @@ class BudgetReportGenerator
*/
private function processLimit(Budget $budget, BudgetLimit $limit): void
{
- $budgetId = $budget->id;
- $limitId = $limit->id;
- $limitCurrency = $limit->transactionCurrency ?? $this->currency;
- $currencyId = $limitCurrency->id;
- $expenses = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, $this->accounts, new Collection([$budget]));
- $spent = $expenses[$currencyId]['sum'] ?? '0';
- $left = -1 === bccomp(bcadd($limit->amount, $spent), '0') ? '0' : bcadd($limit->amount, $spent);
- $overspent = 1 === bccomp(bcmul($spent, '-1'), $limit->amount) ? bcadd($spent, $limit->amount) : '0';
+ $budgetId = $budget->id;
+ $limitId = $limit->id;
+ $limitCurrency = $limit->transactionCurrency ?? $this->currency;
+ $currencyId = $limitCurrency->id;
+ $expenses = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, $this->accounts, new Collection([$budget]));
+ $spent = $expenses[$currencyId]['sum'] ?? '0';
+ $left = -1 === bccomp(bcadd($limit->amount, $spent), '0') ? '0' : bcadd($limit->amount, $spent);
+ $overspent = 1 === bccomp(bcmul($spent, '-1'), $limit->amount) ? bcadd($spent, $limit->amount) : '0';
$this->report['budgets'][$budgetId]['budget_limits'][$limitId] ??= [
'budget_limit_id' => $limitId,
@@ -249,7 +249,7 @@ class BudgetReportGenerator
// make sum information:
$this->report['sums'][$currencyId]
- ??= [
+ ??= [
'budgeted' => '0',
'spent' => '0',
'left' => '0',
@@ -279,16 +279,16 @@ class BudgetReportGenerator
'budget_limits' => [],
];
- $noBudget = $this->nbRepository->sumExpenses($this->start, $this->end, $this->accounts);
+ $noBudget = $this->nbRepository->sumExpenses($this->start, $this->end, $this->accounts);
foreach ($noBudget as $noBudgetEntry) {
// currency information:
- $nbCurrencyId = (int)($noBudgetEntry['currency_id'] ?? $this->currency->id);
- $nbCurrencyCode = $noBudgetEntry['currency_code'] ?? $this->currency->code;
- $nbCurrencyName = $noBudgetEntry['currency_name'] ?? $this->currency->name;
- $nbCurrencySymbol = $noBudgetEntry['currency_symbol'] ?? $this->currency->symbol;
- $nbCurrencyDp = $noBudgetEntry['currency_decimal_places'] ?? $this->currency->decimal_places;
+ $nbCurrencyId = (int)($noBudgetEntry['currency_id'] ?? $this->currency->id);
+ $nbCurrencyCode = $noBudgetEntry['currency_code'] ?? $this->currency->code;
+ $nbCurrencyName = $noBudgetEntry['currency_name'] ?? $this->currency->name;
+ $nbCurrencySymbol = $noBudgetEntry['currency_symbol'] ?? $this->currency->symbol;
+ $nbCurrencyDp = $noBudgetEntry['currency_decimal_places'] ?? $this->currency->decimal_places;
- $this->report['budgets'][0]['budget_limits'][] = [
+ $this->report['budgets'][0]['budget_limits'][] = [
'budget_limit_id' => null,
'start_date' => $this->start,
'end_date' => $this->end,
@@ -304,7 +304,7 @@ class BudgetReportGenerator
'currency_symbol' => $nbCurrencySymbol,
'currency_decimal_places' => $nbCurrencyDp,
];
- $this->report['sums'][$nbCurrencyId]['spent'] = bcadd($this->report['sums'][$nbCurrencyId]['spent'] ?? '0', $noBudgetEntry['sum']);
+ $this->report['sums'][$nbCurrencyId]['spent'] = bcadd($this->report['sums'][$nbCurrencyId]['spent'] ?? '0', $noBudgetEntry['sum']);
// append currency info because it may be missing:
$this->report['sums'][$nbCurrencyId]['currency_id'] = $nbCurrencyId;
$this->report['sums'][$nbCurrencyId]['currency_code'] = $nbCurrencyCode;
@@ -327,15 +327,15 @@ class BudgetReportGenerator
// make percentages based on total amount.
foreach ($this->report['budgets'] as $budgetId => $data) {
foreach ($data['budget_limits'] as $limitId => $entry) {
- $budgetId = (int)$budgetId;
- $limitId = (int)$limitId;
- $currencyId = (int)$entry['currency_id'];
- $spent = $entry['spent'];
- $totalSpent = $this->report['sums'][$currencyId]['spent'] ?? '0';
- $spentPct = '0';
- $budgeted = $entry['budgeted'];
- $totalBudgeted = $this->report['sums'][$currencyId]['budgeted'] ?? '0';
- $budgetedPct = '0';
+ $budgetId = (int)$budgetId;
+ $limitId = (int)$limitId;
+ $currencyId = (int)$entry['currency_id'];
+ $spent = $entry['spent'];
+ $totalSpent = $this->report['sums'][$currencyId]['spent'] ?? '0';
+ $spentPct = '0';
+ $budgeted = $entry['budgeted'];
+ $totalBudgeted = $this->report['sums'][$currencyId]['budgeted'] ?? '0';
+ $budgetedPct = '0';
if (0 !== bccomp($spent, '0') && 0 !== bccomp($totalSpent, '0')) {
$spentPct = round((float)bcmul(bcdiv($spent, $totalSpent), '100'));
@@ -343,7 +343,7 @@ class BudgetReportGenerator
if (0 !== bccomp($budgeted, '0') && 0 !== bccomp($totalBudgeted, '0')) {
$budgetedPct = round((float)bcmul(bcdiv($budgeted, $totalBudgeted), '100'));
}
- $this->report['sums'][$currencyId]['budgeted'] ??= '0';
+ $this->report['sums'][$currencyId]['budgeted'] ??= '0';
$this->report['budgets'][$budgetId]['budget_limits'][$limitId]['spent_pct'] = $spentPct;
$this->report['budgets'][$budgetId]['budget_limits'][$limitId]['budgeted_pct'] = $budgetedPct;
}
diff --git a/app/Support/Report/Category/CategoryReportGenerator.php b/app/Support/Report/Category/CategoryReportGenerator.php
index 67b4b1fe18..ea7971191a 100644
--- a/app/Support/Report/Category/CategoryReportGenerator.php
+++ b/app/Support/Report/Category/CategoryReportGenerator.php
@@ -61,17 +61,17 @@ class CategoryReportGenerator
*/
public function operations(): void
{
- $earnedWith = $this->opsRepository->listIncome($this->start, $this->end, $this->accounts);
- $spentWith = $this->opsRepository->listExpenses($this->start, $this->end, $this->accounts);
+ $earnedWith = $this->opsRepository->listIncome($this->start, $this->end, $this->accounts);
+ $spentWith = $this->opsRepository->listExpenses($this->start, $this->end, $this->accounts);
// also transferred out and transferred into these accounts in this category:
$transferredIn = $this->opsRepository->listTransferredIn($this->start, $this->end, $this->accounts);
$transferredOut = $this->opsRepository->listTransferredOut($this->start, $this->end, $this->accounts);
- $earnedWithout = $this->noCatRepository->listIncome($this->start, $this->end, $this->accounts);
- $spentWithout = $this->noCatRepository->listExpenses($this->start, $this->end, $this->accounts);
+ $earnedWithout = $this->noCatRepository->listIncome($this->start, $this->end, $this->accounts);
+ $spentWithout = $this->noCatRepository->listExpenses($this->start, $this->end, $this->accounts);
- $this->report = [
+ $this->report = [
'categories' => [],
'sums' => [],
];
@@ -141,7 +141,7 @@ class CategoryReportGenerator
private function processCategoryRow(int $currencyId, array $currencyRow, int $categoryId, array $categoryRow): void
{
- $key = sprintf('%s-%s', $currencyId, $categoryId);
+ $key = sprintf('%s-%s', $currencyId, $categoryId);
$this->report['categories'][$key] ??= [
'id' => $categoryId,
'title' => $categoryRow['name'],
@@ -157,9 +157,9 @@ class CategoryReportGenerator
// loop journals:
foreach ($categoryRow['transaction_journals'] as $journal) {
// sum of sums
- $this->report['sums'][$currencyId]['sum'] = bcadd($this->report['sums'][$currencyId]['sum'], $journal['amount']);
+ $this->report['sums'][$currencyId]['sum'] = bcadd($this->report['sums'][$currencyId]['sum'], $journal['amount']);
// sum of spent:
- $this->report['sums'][$currencyId]['spent'] = -1 === bccomp($journal['amount'], '0') ? bcadd(
+ $this->report['sums'][$currencyId]['spent'] = -1 === bccomp($journal['amount'], '0') ? bcadd(
$this->report['sums'][$currencyId]['spent'],
$journal['amount']
) : $this->report['sums'][$currencyId]['spent'];
@@ -170,14 +170,14 @@ class CategoryReportGenerator
) : $this->report['sums'][$currencyId]['earned'];
// sum of category
- $this->report['categories'][$key]['sum'] = bcadd($this->report['categories'][$key]['sum'], $journal['amount']);
+ $this->report['categories'][$key]['sum'] = bcadd($this->report['categories'][$key]['sum'], $journal['amount']);
// total spent in category
- $this->report['categories'][$key]['spent'] = -1 === bccomp($journal['amount'], '0') ? bcadd(
+ $this->report['categories'][$key]['spent'] = -1 === bccomp($journal['amount'], '0') ? bcadd(
$this->report['categories'][$key]['spent'],
$journal['amount']
) : $this->report['categories'][$key]['spent'];
// total earned in category
- $this->report['categories'][$key]['earned'] = 1 === bccomp($journal['amount'], '0') ? bcadd(
+ $this->report['categories'][$key]['earned'] = 1 === bccomp($journal['amount'], '0') ? bcadd(
$this->report['categories'][$key]['earned'],
$journal['amount']
) : $this->report['categories'][$key]['earned'];
diff --git a/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php b/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php
index 4ca2c8c29e..df73a72f60 100644
--- a/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php
+++ b/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php
@@ -82,8 +82,8 @@ trait CalculateRangeOccurrences
*/
protected function getNdomInRange(Carbon $start, Carbon $end, int $skipMod, string $moment): array
{
- $return = [];
- $attempts = 0;
+ $return = [];
+ $attempts = 0;
$start->startOfMonth();
// this feels a bit like a cop out but why reinvent the wheel?
$counters = [1 => 'first', 2 => 'second', 3 => 'third', 4 => 'fourth', 5 => 'fifth'];
@@ -108,12 +108,12 @@ trait CalculateRangeOccurrences
*/
protected function getWeeklyInRange(Carbon $start, Carbon $end, int $skipMod, string $moment): array
{
- $return = [];
- $attempts = 0;
+ $return = [];
+ $attempts = 0;
app('log')->debug('Rep is weekly.');
// monday = 1
// sunday = 7
- $dayOfWeek = (int)$moment;
+ $dayOfWeek = (int)$moment;
app('log')->debug(sprintf('DoW in repetition is %d, in mutator is %d', $dayOfWeek, $start->dayOfWeekIso));
if ($start->dayOfWeekIso > $dayOfWeek) {
// day has already passed this week, add one week:
@@ -154,8 +154,8 @@ trait CalculateRangeOccurrences
}
// is $date between $start and $end?
- $obj = clone $date;
- $count = 0;
+ $obj = clone $date;
+ $count = 0;
while ($obj <= $end && $obj >= $start && $count < 10) {
if (0 === $attempts % $skipMod) {
$return[] = clone $obj;
diff --git a/app/Support/Repositories/Recurring/CalculateXOccurrences.php b/app/Support/Repositories/Recurring/CalculateXOccurrences.php
index 602cb03d02..f31171810f 100644
--- a/app/Support/Repositories/Recurring/CalculateXOccurrences.php
+++ b/app/Support/Repositories/Recurring/CalculateXOccurrences.php
@@ -89,10 +89,10 @@ trait CalculateXOccurrences
*/
protected function getXNDomOccurrences(Carbon $date, int $count, int $skipMod, string $moment): array
{
- $return = [];
- $total = 0;
- $attempts = 0;
- $mutator = clone $date;
+ $return = [];
+ $total = 0;
+ $attempts = 0;
+ $mutator = clone $date;
$mutator->addDay(); // always assume today has passed.
$mutator->startOfMonth();
// this feels a bit like a cop out but why reinvent the wheel?
@@ -120,14 +120,14 @@ trait CalculateXOccurrences
*/
protected function getXWeeklyOccurrences(Carbon $date, int $count, int $skipMod, string $moment): array
{
- $return = [];
- $total = 0;
- $attempts = 0;
- $mutator = clone $date;
+ $return = [];
+ $total = 0;
+ $attempts = 0;
+ $mutator = clone $date;
// monday = 1
// sunday = 7
$mutator->addDay(); // always assume today has passed.
- $dayOfWeek = (int)$moment;
+ $dayOfWeek = (int)$moment;
if ($mutator->dayOfWeekIso > $dayOfWeek) {
// day has already passed this week, add one week:
$mutator->addWeek();
@@ -164,7 +164,7 @@ trait CalculateXOccurrences
if ($mutator > $date) {
$date->addYear();
}
- $obj = clone $date;
+ $obj = clone $date;
while ($total < $count) {
if (0 === $attempts % $skipMod) {
$return[] = clone $obj;
diff --git a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
index c5e5924601..26eb8b8b98 100644
--- a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
+++ b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
@@ -84,7 +84,7 @@ trait CalculateXOccurrencesSince
++$total;
}
++$attempts;
- $mutator = $mutator->endOfMonth()->addDay();
+ $mutator = $mutator->endOfMonth()->addDay();
app('log')->debug(sprintf('Mutator is now %s', $mutator->format('Y-m-d')));
}
@@ -100,10 +100,10 @@ trait CalculateXOccurrencesSince
protected function getXNDomOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod, string $moment): array
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
- $return = [];
- $total = 0;
- $attempts = 0;
- $mutator = clone $date;
+ $return = [];
+ $total = 0;
+ $attempts = 0;
+ $mutator = clone $date;
$mutator->addDay(); // always assume today has passed.
$mutator->startOfMonth();
// this feels a bit like a cop out but why reinvent the wheel?
@@ -134,15 +134,15 @@ trait CalculateXOccurrencesSince
protected function getXWeeklyOccurrencesSince(Carbon $date, Carbon $afterDate, int $count, int $skipMod, string $moment): array
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
- $return = [];
- $total = 0;
- $attempts = 0;
- $mutator = clone $date;
+ $return = [];
+ $total = 0;
+ $attempts = 0;
+ $mutator = clone $date;
// monday = 1
// sunday = 7
// Removed assumption today has passed, see issue https://github.com/firefly-iii/firefly-iii/issues/4798
// $mutator->addDay(); // always assume today has passed.
- $dayOfWeek = (int)$moment;
+ $dayOfWeek = (int)$moment;
if ($mutator->dayOfWeekIso > $dayOfWeek) {
// day has already passed this week, add one week:
$mutator->addWeek();
@@ -186,7 +186,7 @@ trait CalculateXOccurrencesSince
$date->addYear();
app('log')->debug(sprintf('Date is now %s', $date->format('Y-m-d')));
}
- $obj = clone $date;
+ $obj = clone $date;
while ($total < $count) {
app('log')->debug(sprintf('total (%d) < count (%d) so go.', $total, $count));
app('log')->debug(sprintf('attempts (%d) %% skipmod (%d) === %d', $attempts, $skipMod, $attempts % $skipMod));
diff --git a/app/Support/Repositories/Recurring/FiltersWeekends.php b/app/Support/Repositories/Recurring/FiltersWeekends.php
index 552115a3a9..e5b4108c93 100644
--- a/app/Support/Repositories/Recurring/FiltersWeekends.php
+++ b/app/Support/Repositories/Recurring/FiltersWeekends.php
@@ -44,7 +44,7 @@ trait FiltersWeekends
return $dates;
}
- $return = [];
+ $return = [];
/** @var Carbon $date */
foreach ($dates as $date) {
@@ -58,7 +58,7 @@ trait FiltersWeekends
// is weekend and must set back to Friday?
if (RecurrenceRepetition::WEEKEND_TO_FRIDAY === $repetition->weekend) {
- $clone = clone $date;
+ $clone = clone $date;
$clone->addDays(5 - $date->dayOfWeekIso);
app('log')->debug(
sprintf('Date is %s, and this is in the weekend, so corrected to %s (Friday).', $date->format('D d M Y'), $clone->format('D d M Y'))
@@ -70,7 +70,7 @@ trait FiltersWeekends
// postpone to Monday?
if (RecurrenceRepetition::WEEKEND_TO_MONDAY === $repetition->weekend) {
- $clone = clone $date;
+ $clone = clone $date;
$clone->addDays(8 - $date->dayOfWeekIso);
app('log')->debug(
sprintf('Date is %s, and this is in the weekend, so corrected to %s (Monday).', $date->format('D d M Y'), $clone->format('D d M Y'))
diff --git a/app/Support/Repositories/UserGroup/UserGroupTrait.php b/app/Support/Repositories/UserGroup/UserGroupTrait.php
index a4c12d5d62..72559775ec 100644
--- a/app/Support/Repositories/UserGroup/UserGroupTrait.php
+++ b/app/Support/Repositories/UserGroup/UserGroupTrait.php
@@ -57,7 +57,7 @@ trait UserGroupTrait
public function setUser(null|Authenticatable|User $user): void
{
if ($user instanceof User) {
- $this->user = $user;
+ $this->user = $user;
if (null === $user->userGroup) {
throw new FireflyException(sprintf('User #%d has no user group.', $user->id));
}
@@ -70,7 +70,7 @@ trait UserGroupTrait
*/
public function setUserGroupById(int $userGroupId): void
{
- $memberships = GroupMembership::where('user_id', $this->user->id)
+ $memberships = GroupMembership::where('user_id', $this->user->id)
->where('user_group_id', $userGroupId)
->count()
;
@@ -79,7 +79,7 @@ trait UserGroupTrait
}
/** @var null|UserGroup $userGroup */
- $userGroup = UserGroup::find($userGroupId);
+ $userGroup = UserGroup::find($userGroupId);
if (null === $userGroup) {
throw new FireflyException(sprintf('Cannot find administration for user #%d', $this->user->id));
}
diff --git a/app/Support/Request/AppendsLocationData.php b/app/Support/Request/AppendsLocationData.php
index ed6ec863ff..cb84c513ae 100644
--- a/app/Support/Request/AppendsLocationData.php
+++ b/app/Support/Request/AppendsLocationData.php
@@ -78,12 +78,12 @@ trait AppendsLocationData
$data['latitude'] = null;
$data['zoom_level'] = null;
- $longitudeKey = $this->getLocationKey($prefix, 'longitude');
- $latitudeKey = $this->getLocationKey($prefix, 'latitude');
- $zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
- $isValidPOST = $this->isValidPost($prefix);
- $isValidPUT = $this->isValidPUT($prefix);
- $isValidEmptyPUT = $this->isValidEmptyPUT($prefix);
+ $longitudeKey = $this->getLocationKey($prefix, 'longitude');
+ $latitudeKey = $this->getLocationKey($prefix, 'latitude');
+ $zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
+ $isValidPOST = $this->isValidPost($prefix);
+ $isValidPUT = $this->isValidPUT($prefix);
+ $isValidEmptyPUT = $this->isValidEmptyPUT($prefix);
// for a POST (store), all fields must be present and not NULL.
if ($isValidPOST) {
diff --git a/app/Support/Request/ChecksLogin.php b/app/Support/Request/ChecksLogin.php
index aaddbb603e..af635bac7e 100644
--- a/app/Support/Request/ChecksLogin.php
+++ b/app/Support/Request/ChecksLogin.php
@@ -39,7 +39,7 @@ trait ChecksLogin
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
// Only allow logged-in users
- $check = auth()->check();
+ $check = auth()->check();
if (!$check) {
return false;
}
@@ -77,7 +77,7 @@ trait ChecksLogin
public function getUserGroup(): ?UserGroup
{
/** @var User $user */
- $user = auth()->user();
+ $user = auth()->user();
app('log')->debug('Now in getUserGroup()');
/** @var null|UserGroup $userGroup */
@@ -89,7 +89,7 @@ trait ChecksLogin
app('log')->debug(sprintf('Request class has no user_group_id parameter, grab default from user (group #%d).', $user->user_group_id));
$userGroupId = (int)$user->user_group_id;
}
- $userGroup = UserGroup::find($userGroupId);
+ $userGroup = UserGroup::find($userGroupId);
if (null === $userGroup) {
app('log')->error(sprintf('Request class has user_group_id (#%d), but group does not exist.', $userGroupId));
diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php
index 1e5bcb25f3..60214a1290 100644
--- a/app/Support/Search/AccountSearch.php
+++ b/app/Support/Search/AccountSearch.php
@@ -35,16 +35,16 @@ use Illuminate\Support\Collection;
class AccountSearch implements GenericSearchInterface
{
/** @var string */
- public const string SEARCH_ALL = 'all';
+ public const string SEARCH_ALL = 'all';
/** @var string */
- public const string SEARCH_IBAN = 'iban';
+ public const string SEARCH_IBAN = 'iban';
/** @var string */
- public const string SEARCH_ID = 'id';
+ public const string SEARCH_ID = 'id';
/** @var string */
- public const string SEARCH_NAME = 'name';
+ public const string SEARCH_NAME = 'name';
/** @var string */
public const string SEARCH_NUMBER = 'number';
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index e02349f863..aef75bb722 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -172,7 +172,7 @@ class OperatorQuerySearch implements SearchInterface
$operator = substr($operator, 1);
}
- $config = config(sprintf('search.operators.%s', $operator));
+ $config = config(sprintf('search.operators.%s', $operator));
if (null === $config) {
throw new FireflyException(sprintf('No configuration for search operator "%s"', $operator));
}
@@ -274,7 +274,7 @@ class OperatorQuerySearch implements SearchInterface
case Emoticon::class:
case Emoji::class:
case Mention::class:
- $allWords = (string) $searchNode->getValue();
+ $allWords = (string) $searchNode->getValue();
app('log')->debug(sprintf('Add words "%s" to search string, because Node class is "%s"', $allWords, $class));
$this->words[] = $allWords;
@@ -285,10 +285,10 @@ class OperatorQuerySearch implements SearchInterface
/** @var Field $searchNode */
// used to search for x:y
- $operator = strtolower($searchNode->getValue());
- $value = $searchNode->getNode()->getValue();
- $prohibited = BoolOperator::PROHIBITED === $searchNode->getBoolOperator();
- $context = config(sprintf('search.operators.%s.needs_context', $operator));
+ $operator = strtolower($searchNode->getValue());
+ $value = $searchNode->getNode()->getValue();
+ $prohibited = BoolOperator::PROHIBITED === $searchNode->getBoolOperator();
+ $context = config(sprintf('search.operators.%s.needs_context', $operator));
// is an operator that needs no context, and value is false, then prohibited = true.
if ('false' === $value && in_array($operator, $this->validOperators, true) && false === $context && !$prohibited) {
@@ -518,7 +518,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'source_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int) $value);
if (null !== $account) {
$this->collector->setSourceAccounts(new Collection([$account]));
}
@@ -530,7 +530,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-source_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int) $value);
if (null !== $account) {
$this->collector->excludeSourceAccounts(new Collection([$account]));
}
@@ -542,25 +542,25 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'journal_id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->setJournalIds($parts);
break;
case '-journal_id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->excludeJournalIds($parts);
break;
case 'id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->setIds($parts);
break;
case '-id':
- $parts = explode(',', $value);
+ $parts = explode(',', $value);
$this->collector->excludeIds($parts);
break;
@@ -646,7 +646,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'destination_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int) $value);
if (null !== $account) {
$this->collector->setDestinationAccounts(new Collection([$account]));
}
@@ -657,7 +657,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-destination_account_id':
- $account = $this->accountRepository->find((int) $value);
+ $account = $this->accountRepository->find((int) $value);
if (null !== $account) {
$this->collector->excludeDestinationAccounts(new Collection([$account]));
}
@@ -668,8 +668,8 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'account_id':
- $parts = explode(',', $value);
- $collection = new Collection();
+ $parts = explode(',', $value);
+ $collection = new Collection();
foreach ($parts as $accountId) {
$account = $this->accountRepository->find((int) $accountId);
if (null !== $account) {
@@ -686,8 +686,8 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-account_id':
- $parts = explode(',', $value);
- $collection = new Collection();
+ $parts = explode(',', $value);
+ $collection = new Collection();
foreach ($parts as $accountId) {
$account = $this->accountRepository->find((int) $accountId);
if (null !== $account) {
@@ -707,37 +707,37 @@ class OperatorQuerySearch implements SearchInterface
// cash account
//
case 'source_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->setSourceAccounts(new Collection([$account]));
break;
case '-source_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->excludeSourceAccounts(new Collection([$account]));
break;
case 'destination_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->setDestinationAccounts(new Collection([$account]));
break;
case '-destination_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->excludeDestinationAccounts(new Collection([$account]));
break;
case 'account_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->setAccounts(new Collection([$account]));
break;
case '-account_is_cash':
- $account = $this->getCashAccount();
+ $account = $this->getCashAccount();
$this->collector->excludeAccounts(new Collection([$account]));
break;
@@ -766,7 +766,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'description_contains':
- $this->words[] = $value;
+ $this->words[] = $value;
return false;
@@ -789,7 +789,7 @@ class OperatorQuerySearch implements SearchInterface
// currency
//
case 'currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if (null !== $currency) {
$this->collector->setCurrency($currency);
}
@@ -800,7 +800,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if (null !== $currency) {
$this->collector->excludeCurrency($currency);
}
@@ -811,7 +811,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'foreign_currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if (null !== $currency) {
$this->collector->setForeignCurrency($currency);
}
@@ -822,7 +822,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-foreign_currency_is':
- $currency = $this->findCurrency($value);
+ $currency = $this->findCurrency($value);
if (null !== $currency) {
$this->collector->excludeForeignCurrency($currency);
}
@@ -864,7 +864,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_is':
- $category = $this->categoryRepository->findByName($value);
+ $category = $this->categoryRepository->findByName($value);
if (null !== $category) {
$this->collector->setCategory($category);
@@ -875,7 +875,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_is':
- $category = $this->categoryRepository->findByName($value);
+ $category = $this->categoryRepository->findByName($value);
if (null !== $category) {
$this->collector->excludeCategory($category);
@@ -885,7 +885,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_ends':
- $result = $this->categoryRepository->categoryEndsWith($value, 1337);
+ $result = $this->categoryRepository->categoryEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setCategories($result);
}
@@ -896,7 +896,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_ends':
- $result = $this->categoryRepository->categoryEndsWith($value, 1337);
+ $result = $this->categoryRepository->categoryEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeCategories($result);
}
@@ -907,7 +907,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_starts':
- $result = $this->categoryRepository->categoryStartsWith($value, 1337);
+ $result = $this->categoryRepository->categoryStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setCategories($result);
}
@@ -918,7 +918,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_starts':
- $result = $this->categoryRepository->categoryStartsWith($value, 1337);
+ $result = $this->categoryRepository->categoryStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeCategories($result);
}
@@ -929,7 +929,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'category_contains':
- $result = $this->categoryRepository->searchCategory($value, 1337);
+ $result = $this->categoryRepository->searchCategory($value, 1337);
if ($result->count() > 0) {
$this->collector->setCategories($result);
}
@@ -940,7 +940,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-category_contains':
- $result = $this->categoryRepository->searchCategory($value, 1337);
+ $result = $this->categoryRepository->searchCategory($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeCategories($result);
}
@@ -966,7 +966,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_contains':
- $result = $this->budgetRepository->searchBudget($value, 1337);
+ $result = $this->budgetRepository->searchBudget($value, 1337);
if ($result->count() > 0) {
$this->collector->setBudgets($result);
}
@@ -977,7 +977,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_contains':
- $result = $this->budgetRepository->searchBudget($value, 1337);
+ $result = $this->budgetRepository->searchBudget($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBudgets($result);
}
@@ -988,7 +988,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_is':
- $budget = $this->budgetRepository->findByName($value);
+ $budget = $this->budgetRepository->findByName($value);
if (null !== $budget) {
$this->collector->setBudget($budget);
@@ -999,7 +999,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_is':
- $budget = $this->budgetRepository->findByName($value);
+ $budget = $this->budgetRepository->findByName($value);
if (null !== $budget) {
$this->collector->excludeBudget($budget);
@@ -1010,7 +1010,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_ends':
- $result = $this->budgetRepository->budgetEndsWith($value, 1337);
+ $result = $this->budgetRepository->budgetEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBudgets($result);
}
@@ -1021,7 +1021,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_ends':
- $result = $this->budgetRepository->budgetEndsWith($value, 1337);
+ $result = $this->budgetRepository->budgetEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBudgets($result);
}
@@ -1032,7 +1032,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'budget_starts':
- $result = $this->budgetRepository->budgetStartsWith($value, 1337);
+ $result = $this->budgetRepository->budgetStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBudgets($result);
}
@@ -1043,7 +1043,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-budget_starts':
- $result = $this->budgetRepository->budgetStartsWith($value, 1337);
+ $result = $this->budgetRepository->budgetStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBudgets($result);
}
@@ -1069,7 +1069,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_contains':
- $result = $this->billRepository->searchBill($value, 1337);
+ $result = $this->billRepository->searchBill($value, 1337);
if ($result->count() > 0) {
$this->collector->setBills($result);
@@ -1080,7 +1080,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_contains':
- $result = $this->billRepository->searchBill($value, 1337);
+ $result = $this->billRepository->searchBill($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBills($result);
@@ -1091,7 +1091,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_is':
- $bill = $this->billRepository->findByName($value);
+ $bill = $this->billRepository->findByName($value);
if (null !== $bill) {
$this->collector->setBill($bill);
@@ -1102,7 +1102,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_is':
- $bill = $this->billRepository->findByName($value);
+ $bill = $this->billRepository->findByName($value);
if (null !== $bill) {
$this->collector->excludeBills(new Collection([$bill]));
@@ -1113,7 +1113,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_ends':
- $result = $this->billRepository->billEndsWith($value, 1337);
+ $result = $this->billRepository->billEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBills($result);
}
@@ -1124,7 +1124,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_ends':
- $result = $this->billRepository->billEndsWith($value, 1337);
+ $result = $this->billRepository->billEndsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBills($result);
}
@@ -1135,7 +1135,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'bill_starts':
- $result = $this->billRepository->billStartsWith($value, 1337);
+ $result = $this->billRepository->billStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->setBills($result);
}
@@ -1146,7 +1146,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-bill_starts':
- $result = $this->billRepository->billStartsWith($value, 1337);
+ $result = $this->billRepository->billStartsWith($value, 1337);
if ($result->count() > 0) {
$this->collector->excludeBills($result);
}
@@ -1173,7 +1173,7 @@ class OperatorQuerySearch implements SearchInterface
case '-tag_is_not':
case 'tag_is':
- $result = $this->tagRepository->findByTag($value);
+ $result = $this->tagRepository->findByTag($value);
if (null !== $result) {
$this->includeTags[] = $result->id;
$this->includeTags = array_unique($this->includeTags);
@@ -1187,7 +1187,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'tag_contains':
- $tags = $this->tagRepository->searchTag($value);
+ $tags = $this->tagRepository->searchTag($value);
if (0 === $tags->count()) {
app('log')->info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
$this->collector->findNothing();
@@ -1200,7 +1200,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'tag_starts':
- $tags = $this->tagRepository->tagStartsWith($value);
+ $tags = $this->tagRepository->tagStartsWith($value);
if (0 === $tags->count()) {
app('log')->info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
$this->collector->findNothing();
@@ -1213,7 +1213,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-tag_starts':
- $tags = $this->tagRepository->tagStartsWith($value);
+ $tags = $this->tagRepository->tagStartsWith($value);
if (0 === $tags->count()) {
app('log')->info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
$this->collector->findNothing();
@@ -1226,7 +1226,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case 'tag_ends':
- $tags = $this->tagRepository->tagEndsWith($value);
+ $tags = $this->tagRepository->tagEndsWith($value);
if (0 === $tags->count()) {
app('log')->info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
$this->collector->findNothing();
@@ -1239,7 +1239,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-tag_ends':
- $tags = $this->tagRepository->tagEndsWith($value);
+ $tags = $this->tagRepository->tagEndsWith($value);
if (0 === $tags->count()) {
app('log')->info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
$this->collector->findNothing();
@@ -1252,7 +1252,7 @@ class OperatorQuerySearch implements SearchInterface
break;
case '-tag_contains':
- $tags = $this->tagRepository->searchTag($value)->keyBy('id');
+ $tags = $this->tagRepository->searchTag($value)->keyBy('id');
if (0 === $tags->count()) {
app('log')->info(sprintf('No valid tags in "%s"-operator, so search will not return ANY results.', $operator));
@@ -1267,7 +1267,7 @@ class OperatorQuerySearch implements SearchInterface
case '-tag_is':
case 'tag_is_not':
- $result = $this->tagRepository->findByTag($value);
+ $result = $this->tagRepository->findByTag($value);
if (null !== $result) {
$this->excludeTags[] = $result->id;
$this->excludeTags = array_unique($this->excludeTags);
@@ -1346,8 +1346,8 @@ class OperatorQuerySearch implements SearchInterface
case 'amount_is':
// strip comma's, make dots.
app('log')->debug(sprintf('Original value "%s"', $value));
- $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIs($amount);
@@ -1356,8 +1356,8 @@ class OperatorQuerySearch implements SearchInterface
case '-amount_is':
// strip comma's, make dots.
app('log')->debug(sprintf('Original value "%s"', $value));
- $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIsNot($amount);
@@ -1365,9 +1365,9 @@ class OperatorQuerySearch implements SearchInterface
case 'foreign_amount_is':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIs($amount);
@@ -1375,9 +1375,9 @@ class OperatorQuerySearch implements SearchInterface
case '-foreign_amount_is':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIsNot($amount);
@@ -1386,9 +1386,9 @@ class OperatorQuerySearch implements SearchInterface
case '-amount_more':
case 'amount_less':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountLess($amount);
@@ -1397,9 +1397,9 @@ class OperatorQuerySearch implements SearchInterface
case '-foreign_amount_more':
case 'foreign_amount_less':
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
+ $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountLess($amount);
@@ -1409,8 +1409,8 @@ class OperatorQuerySearch implements SearchInterface
case 'amount_more':
app('log')->debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountMore($amount);
@@ -1420,8 +1420,8 @@ class OperatorQuerySearch implements SearchInterface
case 'foreign_amount_more':
app('log')->debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots.
- $value = str_replace(',', '.', $value);
- $amount = app('steam')->positive($value);
+ $value = str_replace(',', '.', $value);
+ $amount = app('steam')->positive($value);
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountMore($amount);
@@ -1447,147 +1447,147 @@ class OperatorQuerySearch implements SearchInterface
//
case '-date_on':
case 'date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactDateParams($range, $prohibited);
return false;
case 'date_before':
case '-date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setDateBeforeParams($range);
return false;
case 'date_after':
case '-date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setDateAfterParams($range);
return false;
case 'interest_date_on':
case '-interest_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('interest_date', $range, $prohibited);
return false;
case 'interest_date_before':
case '-interest_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('interest_date', $range);
return false;
case 'interest_date_after':
case '-interest_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('interest_date', $range);
return false;
case 'book_date_on':
case '-book_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('book_date', $range, $prohibited);
return false;
case 'book_date_before':
case '-book_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('book_date', $range);
return false;
case 'book_date_after':
case '-book_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('book_date', $range);
return false;
case 'process_date_on':
case '-process_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('process_date', $range, $prohibited);
return false;
case 'process_date_before':
case '-process_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('process_date', $range);
return false;
case 'process_date_after':
case '-process_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('process_date', $range);
return false;
case 'due_date_on':
case '-due_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('due_date', $range, $prohibited);
return false;
case 'due_date_before':
case '-due_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('due_date', $range);
return false;
case 'due_date_after':
case '-due_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('due_date', $range);
return false;
case 'payment_date_on':
case '-payment_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('payment_date', $range, $prohibited);
return false;
case 'payment_date_before':
case '-payment_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('payment_date', $range);
return false;
case 'payment_date_after':
case '-payment_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('payment_date', $range);
return false;
case 'invoice_date_on':
case '-invoice_date_on':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactMetaDateParams('invoice_date', $range, $prohibited);
return false;
case 'invoice_date_before':
case '-invoice_date_after':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateBeforeParams('invoice_date', $range);
return false;
case 'invoice_date_after':
case '-invoice_date_before':
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setMetaDateAfterParams('invoice_date', $range);
return false;
@@ -1595,7 +1595,7 @@ class OperatorQuerySearch implements SearchInterface
case 'created_at_on':
case '-created_at_on':
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactObjectDateParams('created_at', $range, $prohibited);
return false;
@@ -1603,7 +1603,7 @@ class OperatorQuerySearch implements SearchInterface
case 'created_at_before':
case '-created_at_after':
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateBeforeParams('created_at', $range);
return false;
@@ -1611,7 +1611,7 @@ class OperatorQuerySearch implements SearchInterface
case 'created_at_after':
case '-created_at_before':
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateAfterParams('created_at', $range);
return false;
@@ -1619,7 +1619,7 @@ class OperatorQuerySearch implements SearchInterface
case 'updated_at_on':
case '-updated_at_on':
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setExactObjectDateParams('updated_at', $range, $prohibited);
return false;
@@ -1627,7 +1627,7 @@ class OperatorQuerySearch implements SearchInterface
case 'updated_at_before':
case '-updated_at_after':
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateBeforeParams('updated_at', $range);
return false;
@@ -1635,7 +1635,7 @@ class OperatorQuerySearch implements SearchInterface
case 'updated_at_after':
case '-updated_at_before':
app('log')->debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
- $range = $this->parseDateRange($operator, $value);
+ $range = $this->parseDateRange($operator, $value);
$this->setObjectDateAfterParams('updated_at', $range);
return false;
@@ -1934,7 +1934,7 @@ class OperatorQuerySearch implements SearchInterface
}
}
// string position (default): starts with:
- $stringMethod = 'str_starts_with';
+ $stringMethod = 'str_starts_with';
// string position: ends with:
if (StringPosition::ENDS === $stringPosition) {
@@ -1948,7 +1948,7 @@ class OperatorQuerySearch implements SearchInterface
}
// get accounts:
- $accounts = $this->accountRepository->searchAccount($value, $searchTypes, 1337);
+ $accounts = $this->accountRepository->searchAccount($value, $searchTypes, 1337);
if (0 === $accounts->count()) {
app('log')->debug('Found zero accounts, search for non existing account, NO results will be returned.');
$this->collector->findNothing();
@@ -1956,7 +1956,7 @@ class OperatorQuerySearch implements SearchInterface
return;
}
app('log')->debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
- $filtered = $accounts->filter(
+ $filtered = $accounts->filter(
static function (Account $account) use ($value, $stringMethod) {
return $stringMethod(strtolower($account->name), strtolower($value));
}
@@ -2011,7 +2011,7 @@ class OperatorQuerySearch implements SearchInterface
}
// string position (default): starts with:
- $stringMethod = 'str_starts_with';
+ $stringMethod = 'str_starts_with';
// string position: ends with:
if (StringPosition::ENDS === $stringPosition) {
@@ -2025,7 +2025,7 @@ class OperatorQuerySearch implements SearchInterface
}
// search for accounts:
- $accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 1337);
+ $accounts = $this->accountRepository->searchAccountNr($value, $searchTypes, 1337);
if (0 === $accounts->count()) {
app('log')->debug('Found zero accounts, search for invalid account.');
$this->collector->findNothing();
@@ -2035,7 +2035,7 @@ class OperatorQuerySearch implements SearchInterface
// if found, do filter
app('log')->debug(sprintf('Found %d accounts, will filter.', $accounts->count()));
- $filtered = $accounts->filter(
+ $filtered = $accounts->filter(
static function (Account $account) use ($value, $stringMethod) {
// either IBAN or account number
$ibanMatch = $stringMethod(strtolower((string) $account->iban), strtolower($value));
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index ece110766b..492656baef 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -41,20 +41,20 @@ class Steam
public function balanceIgnoreVirtual(Account $account, Carbon $date): string
{
/** @var AccountRepositoryInterface $repository */
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($account->user);
- $currencyId = (int) $repository->getMetaValue($account, 'currency_id');
- $transactions = $account->transactions()
+ $currencyId = (int) $repository->getMetaValue($account, 'currency_id');
+ $transactions = $account->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->where('transactions.transaction_currency_id', $currencyId)
->get(['transactions.amount'])->toArray()
;
- $nativeBalance = $this->sumTransactions($transactions, 'amount');
+ $nativeBalance = $this->sumTransactions($transactions, 'amount');
// get all balances in foreign currency:
- $transactions = $account->transactions()
+ $transactions = $account->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->where('transactions.foreign_currency_id', $currencyId)
@@ -90,7 +90,7 @@ class Steam
*/
public function balanceInRange(Account $account, Carbon $start, Carbon $end, ?TransactionCurrency $currency = null): array
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance-in-range');
$cache->addProperty(null !== $currency ? $currency->id : 0);
@@ -102,22 +102,22 @@ class Steam
$start->subDay();
$end->addDay();
- $balances = [];
- $formatted = $start->format('Y-m-d');
- $startBalance = $this->balance($account, $start, $currency);
+ $balances = [];
+ $formatted = $start->format('Y-m-d');
+ $startBalance = $this->balance($account, $start, $currency);
$balances[$formatted] = $startBalance;
if (null === $currency) {
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($account->user);
- $currency = $repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
+ $currency = $repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
}
- $currencyId = $currency->id;
+ $currencyId = $currency->id;
$start->addDay();
// query!
- $set = $account->transactions()
+ $set = $account->transactions()
->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))
->where('transaction_journals.date', '<=', $end->format('Y-m-d 23:59:59'))
@@ -137,7 +137,7 @@ class Steam
)
;
- $currentBalance = $startBalance;
+ $currentBalance = $startBalance;
/** @var Transaction $entry */
foreach ($set as $entry) {
@@ -173,7 +173,7 @@ class Steam
public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string
{
// abuse chart properties:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance');
$cache->addProperty($date);
@@ -183,18 +183,18 @@ class Steam
}
/** @var AccountRepositoryInterface $repository */
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
if (null === $currency) {
$currency = $repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
}
// first part: get all balances in own currency:
- $transactions = $account->transactions()
+ $transactions = $account->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->where('transactions.transaction_currency_id', $currency->id)
->get(['transactions.amount'])->toArray()
;
- $nativeBalance = $this->sumTransactions($transactions, 'amount');
+ $nativeBalance = $this->sumTransactions($transactions, 'amount');
// get all balances in foreign currency:
$transactions = $account->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
@@ -220,7 +220,7 @@ class Steam
*/
public function balanceInRangeConverted(Account $account, Carbon $start, Carbon $end, TransactionCurrency $native): array
{
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance-in-range-converted');
$cache->addProperty($native->id);
@@ -240,13 +240,13 @@ class Steam
Log::debug(sprintf('Start balance on %s is %s', $formatted, $startBalance));
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
- $converter = new ExchangeRateConverter();
+ $converter = new ExchangeRateConverter();
// not sure why this is happening:
$start->addDay();
// grab all transactions between start and end:
- $set = $account->transactions()
+ $set = $account->transactions()
->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00'))
->where('transaction_journals.date', '<=', $end->format('Y-m-d 23:59:59'))
@@ -264,15 +264,15 @@ class Steam
;
// loop the set and convert if necessary:
- $currentBalance = $startBalance;
+ $currentBalance = $startBalance;
/** @var Transaction $transaction */
foreach ($set as $transaction) {
- $day = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date'], config('app.timezone'));
+ $day = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date'], config('app.timezone'));
if (false === $day) {
$day = today(config('app.timezone'));
}
- $format = $day->format('Y-m-d');
+ $format = $day->format('Y-m-d');
// if the transaction is in the expected currency, change nothing.
if ((int) $transaction['transaction_currency_id'] === $native->id) {
// change the current balance, set it to today, continue the loop.
@@ -295,10 +295,10 @@ class Steam
$currency = $currencies[$currencyId] ?? TransactionCurrency::find($currencyId);
$currencies[$currencyId] = $currency;
- $rate = $converter->getCurrencyRate($currency, $native, $day);
- $convertedAmount = bcmul($transaction['amount'], $rate);
- $currentBalance = bcadd($currentBalance, $convertedAmount);
- $balances[$format] = $currentBalance;
+ $rate = $converter->getCurrencyRate($currency, $native, $day);
+ $convertedAmount = bcmul($transaction['amount'], $rate);
+ $currentBalance = bcadd($currentBalance, $convertedAmount);
+ $balances[$format] = $currentBalance;
Log::debug(sprintf(
'%s: transaction in %s(!). Conversion rate is %s. %s %s = %s %s',
@@ -340,7 +340,7 @@ class Steam
public function balanceConverted(Account $account, Carbon $date, TransactionCurrency $native): string
{
Log::debug(sprintf('Now in balanceConverted (%s) for account #%d, converting to %s', $date->format('Y-m-d'), $account->id, $native->code));
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance');
$cache->addProperty($date);
@@ -361,9 +361,9 @@ class Steam
return $this->balance($account, $date);
}
- $new = [];
- $existing = [];
- $new[] = $account->transactions() // 1
+ $new = [];
+ $existing = [];
+ $new[] = $account->transactions() // 1
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->where('transactions.transaction_currency_id', $currency->id)
@@ -379,7 +379,7 @@ class Steam
->get(['transactions.amount'])->toArray()
;
Log::debug(sprintf('%d transaction(s) in set #2', count($existing[0])));
- $new[] = $account->transactions() // 3
+ $new[] = $account->transactions() // 3
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->where('transactions.transaction_currency_id', '!=', $currency->id)
@@ -396,7 +396,7 @@ class Steam
->get(['transactions.foreign_amount'])->toArray()
;
Log::debug(sprintf('%d transactions in set #4', count($existing[1])));
- $new[] = $account->transactions()// 5
+ $new[] = $account->transactions()// 5
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->where('transactions.transaction_currency_id', $currency->id)
@@ -405,7 +405,7 @@ class Steam
->get(['transaction_journals.date', 'transactions.amount'])->toArray()
;
Log::debug(sprintf('%d transactions in set #5', count($new[2])));
- $new[] = $account->transactions()// 6
+ $new[] = $account->transactions()// 6
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d 23:59:59'))
->where('transactions.transaction_currency_id', '!=', $currency->id)
@@ -416,17 +416,17 @@ class Steam
Log::debug(sprintf('%d transactions in set #6', count($new[3])));
// process both sets of transactions. Of course, no need to convert set "existing".
- $balance = $this->sumTransactions($existing[0], 'amount');
- $balance = bcadd($balance, $this->sumTransactions($existing[1], 'foreign_amount'));
+ $balance = $this->sumTransactions($existing[0], 'amount');
+ $balance = bcadd($balance, $this->sumTransactions($existing[1], 'foreign_amount'));
Log::debug(sprintf('Balance from set #2 and #4 is %f', $balance));
// need to convert the others. All sets use the "amount" value as their base (that's easy)
// but we need to convert each transaction separately because the date difference may
// incur huge currency changes.
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
- $start = clone $date;
- $end = clone $date;
- $converter = new ExchangeRateConverter();
+ $start = clone $date;
+ $end = clone $date;
+ $converter = new ExchangeRateConverter();
foreach ($new as $set) {
foreach ($set as $transaction) {
$currentDate = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date']);
@@ -443,7 +443,7 @@ class Steam
foreach ($new as $set) {
foreach ($set as $transaction) {
- $currentDate = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date']);
+ $currentDate = Carbon::createFromFormat('Y-m-d H:i:s', $transaction['date']);
if (false === $currentDate) {
$currentDate = today(config('app.timezone'));
}
@@ -454,9 +454,9 @@ class Steam
}
// add virtual balance (also needs conversion)
- $virtual = null === $account->virtual_balance ? '0' : $account->virtual_balance;
- $virtual = $converter->convert($currency, $native, $account->created_at, $virtual);
- $balance = bcadd($balance, $virtual);
+ $virtual = null === $account->virtual_balance ? '0' : $account->virtual_balance;
+ $virtual = $converter->convert($currency, $native, $account->created_at, $virtual);
+ $balance = bcadd($balance, $virtual);
$converter->summarize();
$cache->store($balance);
@@ -472,9 +472,9 @@ class Steam
*/
public function balancesByAccounts(Collection $accounts, Carbon $date): array
{
- $ids = $accounts->pluck('id')->toArray();
+ $ids = $accounts->pluck('id')->toArray();
// cache this property.
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($ids);
$cache->addProperty('balances');
$cache->addProperty($date);
@@ -502,9 +502,9 @@ class Steam
*/
public function balancesByAccountsConverted(Collection $accounts, Carbon $date): array
{
- $ids = $accounts->pluck('id')->toArray();
+ $ids = $accounts->pluck('id')->toArray();
// cache this property.
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($ids);
$cache->addProperty('balances-converted');
$cache->addProperty($date);
@@ -535,9 +535,9 @@ class Steam
*/
public function balancesPerCurrencyByAccounts(Collection $accounts, Carbon $date): array
{
- $ids = $accounts->pluck('id')->toArray();
+ $ids = $accounts->pluck('id')->toArray();
// cache this property.
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($ids);
$cache->addProperty('balances-per-currency');
$cache->addProperty($date);
@@ -561,7 +561,7 @@ class Steam
public function balancePerCurrency(Account $account, Carbon $date): array
{
// abuse chart properties:
- $cache = new CacheProperties();
+ $cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty('balance-per-currency');
$cache->addProperty($date);
@@ -688,7 +688,7 @@ class Steam
{
$list = [];
- $set = auth()->user()->transactions()
+ $set = auth()->user()->transactions()
->whereIn('transactions.account_id', $accounts)
->groupBy(['transactions.account_id', 'transaction_journals.user_id'])
->get(['transactions.account_id', \DB::raw('MAX(transaction_journals.date) AS max_date')]) // @phpstan-ignore-line
@@ -696,7 +696,7 @@ class Steam
/** @var Transaction $entry */
foreach ($set as $entry) {
- $date = new Carbon($entry->max_date, config('app.timezone'));
+ $date = new Carbon($entry->max_date, config('app.timezone'));
$date->setTimezone(config('app.timezone'));
$list[$entry->account_id] = $date;
}
@@ -771,9 +771,9 @@ class Steam
public function getSafeUrl(string $unknownUrl, string $safeUrl): string
{
// Log::debug(sprintf('getSafeUrl(%s, %s)', $unknownUrl, $safeUrl));
- $returnUrl = $safeUrl;
- $unknownHost = parse_url($unknownUrl, PHP_URL_HOST);
- $safeHost = parse_url($safeUrl, PHP_URL_HOST);
+ $returnUrl = $safeUrl;
+ $unknownHost = parse_url($unknownUrl, PHP_URL_HOST);
+ $safeHost = parse_url($safeUrl, PHP_URL_HOST);
if (null !== $unknownHost && $unknownHost === $safeHost) {
$returnUrl = $unknownUrl;
@@ -810,7 +810,7 @@ class Steam
*/
public function floatalize(string $value): string
{
- $value = strtoupper($value);
+ $value = strtoupper($value);
if (!str_contains($value, 'E')) {
return $value;
}
diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php
index 08f7c61a2a..f46af222c1 100644
--- a/app/Support/System/OAuthKeys.php
+++ b/app/Support/System/OAuthKeys.php
@@ -120,8 +120,8 @@ class OAuthKeys
return false;
}
- $private = storage_path('oauth-private.key');
- $public = storage_path('oauth-public.key');
+ $private = storage_path('oauth-private.key');
+ $public = storage_path('oauth-public.key');
file_put_contents($private, $privateContent);
file_put_contents($public, $publicContent);
diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php
index ad9d4d8fbe..2fe0ac4be5 100644
--- a/app/Support/Twig/AmountFormat.php
+++ b/app/Support/Twig/AmountFormat.php
@@ -109,8 +109,8 @@ class AmountFormat extends AbstractExtension
return new TwigFunction(
'formatAmountBySymbol',
static function (string $amount, string $symbol, int $decimalPlaces = null, bool $coloured = null): string {
- $decimalPlaces ??= 2;
- $coloured ??= true;
+ $decimalPlaces ??= 2;
+ $coloured ??= true;
$currency = new TransactionCurrency();
$currency->symbol = $symbol;
$currency->decimal_places = $decimalPlaces;
diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index e53c38b8ca..804207fd6b 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -293,7 +293,7 @@ class General extends AbstractExtension
'activeRoutePartialObjectType',
static function ($context): string {
[, $route, $objectType] = func_get_args();
- $activeObjectType = $context['objectType'] ?? false;
+ $activeObjectType = $context['objectType'] ?? false;
if ($objectType === $activeObjectType
&& false !== stripos(
diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php
index 21e081796d..e3c26adaba 100644
--- a/app/Support/Twig/TransactionGroupTwig.php
+++ b/app/Support/Twig/TransactionGroupTwig.php
@@ -165,7 +165,7 @@ class TransactionGroupTwig extends AbstractExtension
$colored = false;
}
- $result = app('amount')->formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored);
+ $result = app('amount')->formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored);
if (TransactionType::TRANSFER === $type) {
$result = sprintf('%s', $result);
}
@@ -198,9 +198,9 @@ class TransactionGroupTwig extends AbstractExtension
*/
private function foreignJournalArrayAmount(array $array): string
{
- $type = $array['transaction_type_type'] ?? TransactionType::WITHDRAWAL;
- $amount = $array['foreign_amount'] ?? '0';
- $colored = true;
+ $type = $array['transaction_type_type'] ?? TransactionType::WITHDRAWAL;
+ $amount = $array['foreign_amount'] ?? '0';
+ $colored = true;
$sourceType = $array['source_account_type'] ?? 'invalid';
$amount = $this->signAmount($amount, $type, $sourceType);
@@ -208,7 +208,7 @@ class TransactionGroupTwig extends AbstractExtension
if (TransactionType::TRANSFER === $type) {
$colored = false;
}
- $result = app('amount')->formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored);
+ $result = app('amount')->formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored);
if (TransactionType::TRANSFER === $type) {
$result = sprintf('%s', $result);
}
@@ -228,12 +228,12 @@ class TransactionGroupTwig extends AbstractExtension
$colored = true;
$sourceType = $first->account()->first()->accountType()->first()->type;
- $amount = $this->signAmount($amount, $type, $sourceType);
+ $amount = $this->signAmount($amount, $type, $sourceType);
if (TransactionType::TRANSFER === $type) {
$colored = false;
}
- $result = app('amount')->formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored);
+ $result = app('amount')->formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored);
if (TransactionType::TRANSFER === $type) {
$result = sprintf('%s', $result);
}
@@ -254,7 +254,7 @@ class TransactionGroupTwig extends AbstractExtension
*/
private function foreignJournalObjectAmount(TransactionJournal $journal): string
{
- $type = $journal->transactionType->type;
+ $type = $journal->transactionType->type;
/** @var Transaction $first */
$first = $journal->transactions()->where('amount', '<', 0)->first();
@@ -263,12 +263,12 @@ class TransactionGroupTwig extends AbstractExtension
$colored = true;
$sourceType = $first->account()->first()->accountType()->first()->type;
- $amount = $this->signAmount($amount, $type, $sourceType);
+ $amount = $this->signAmount($amount, $type, $sourceType);
if (TransactionType::TRANSFER === $type) {
$colored = false;
}
- $result = app('amount')->formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored);
+ $result = app('amount')->formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored);
if (TransactionType::TRANSFER === $type) {
$result = sprintf('%s', $result);
}
diff --git a/app/TransactionRules/Actions/AddTag.php b/app/TransactionRules/Actions/AddTag.php
index d231d732ba..e9a0ed716d 100644
--- a/app/TransactionRules/Actions/AddTag.php
+++ b/app/TransactionRules/Actions/AddTag.php
@@ -52,9 +52,9 @@ class AddTag implements ActionInterface
$factory = app(TagFactory::class);
/** @var User $user */
- $user = User::find($journal['user_id']);
+ $user = User::find($journal['user_id']);
$factory->setUser($user);
- $tag = $factory->findOrCreate($this->action->action_value);
+ $tag = $factory->findOrCreate($this->action->action_value);
if (null === $tag) {
// could not find, could not create tag.
@@ -63,7 +63,7 @@ class AddTag implements ActionInterface
return false;
}
- $count = \DB::table('tag_transaction_journal')
+ $count = \DB::table('tag_transaction_journal')
->where('tag_id', $tag->id)
->where('transaction_journal_id', $journal['transaction_journal_id'])
->count()
diff --git a/app/TransactionRules/Actions/AppendDescription.php b/app/TransactionRules/Actions/AppendDescription.php
index 1c460a3cd6..5b5b318ce0 100644
--- a/app/TransactionRules/Actions/AppendDescription.php
+++ b/app/TransactionRules/Actions/AppendDescription.php
@@ -49,7 +49,7 @@ class AppendDescription implements ActionInterface
// event for audit log entry
/** @var TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
event(new TriggeredAuditLog($this->action->rule, $object, 'update_description', $journal['description'], $description));
return true;
diff --git a/app/TransactionRules/Actions/AppendDescriptionToNotes.php b/app/TransactionRules/Actions/AppendDescriptionToNotes.php
index 8c6f385821..eb5e32815c 100644
--- a/app/TransactionRules/Actions/AppendDescriptionToNotes.php
+++ b/app/TransactionRules/Actions/AppendDescriptionToNotes.php
@@ -55,9 +55,9 @@ class AppendDescriptionToNotes implements ActionInterface
return false;
}
- $note = $object->notes()->first();
+ $note = $object->notes()->first();
if (null === $note) {
- $note = new Note();
+ $note = new Note();
$note->noteable()->associate($object);
$note->text = '';
}
@@ -68,7 +68,7 @@ class AppendDescriptionToNotes implements ActionInterface
if ('' === $note->text) {
$note->text = (string)$object->description;
}
- $after = $note->text;
+ $after = $note->text;
// event for audit log entry
event(new TriggeredAuditLog($this->action->rule, $object, 'update_notes', $before, $after));
diff --git a/app/TransactionRules/Actions/AppendNotes.php b/app/TransactionRules/Actions/AppendNotes.php
index 196fe79f45..bb990d438f 100644
--- a/app/TransactionRules/Actions/AppendNotes.php
+++ b/app/TransactionRules/Actions/AppendNotes.php
@@ -45,7 +45,7 @@ class AppendNotes implements ActionInterface
public function actOnArray(array $journal): bool
{
- $dbNote = Note::where('noteable_id', (int)$journal['transaction_journal_id'])
+ $dbNote = Note::where('noteable_id', (int)$journal['transaction_journal_id'])
->where('noteable_type', TransactionJournal::class)
->first(['notes.*'])
;
@@ -62,7 +62,7 @@ class AppendNotes implements ActionInterface
$dbNote->save();
/** @var TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
event(new TriggeredAuditLog($this->action->rule, $object, 'update_notes', $before, $text));
diff --git a/app/TransactionRules/Actions/AppendNotesToDescription.php b/app/TransactionRules/Actions/AppendNotesToDescription.php
index 7ba8abd032..3cc4a16709 100644
--- a/app/TransactionRules/Actions/AppendNotesToDescription.php
+++ b/app/TransactionRules/Actions/AppendNotesToDescription.php
@@ -60,10 +60,10 @@ class AppendNotesToDescription implements ActionInterface
return false;
}
- $note = $object->notes()->first();
+ $note = $object->notes()->first();
if (null === $note) {
app('log')->debug('Journal has no notes.');
- $note = new Note();
+ $note = new Note();
$note->noteable()->associate($object);
$note->text = '';
}
diff --git a/app/TransactionRules/Actions/ClearNotes.php b/app/TransactionRules/Actions/ClearNotes.php
index 296198735b..61d588d542 100644
--- a/app/TransactionRules/Actions/ClearNotes.php
+++ b/app/TransactionRules/Actions/ClearNotes.php
@@ -50,7 +50,7 @@ class ClearNotes implements ActionInterface
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
/** @var null|Note $notes */
- $notes = $object->notes()->first();
+ $notes = $object->notes()->first();
if (null === $notes) {
app('log')->debug(sprintf('RuleAction ClearNotes, journal #%d has no notes.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_already_no_notes')));
diff --git a/app/TransactionRules/Actions/ConvertToDeposit.php b/app/TransactionRules/Actions/ConvertToDeposit.php
index 874aaca2b8..e8f9abf59e 100644
--- a/app/TransactionRules/Actions/ConvertToDeposit.php
+++ b/app/TransactionRules/Actions/ConvertToDeposit.php
@@ -54,7 +54,7 @@ class ConvertToDeposit implements ActionInterface
{
// make object from array (so the data is fresh).
/** @var null|TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
app('log')->error(sprintf('Cannot find journal #%d, cannot convert to deposit.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_not_found')));
@@ -70,7 +70,7 @@ class ConvertToDeposit implements ActionInterface
}
app('log')->debug(sprintf('Convert journal #%d to deposit.', $journal['transaction_journal_id']));
- $type = $object->transactionType->type;
+ $type = $object->transactionType->type;
if (TransactionType::DEPOSIT === $type) {
app('log')->error(sprintf('Journal #%d is already a deposit (rule #%d).', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_already_deposit')));
@@ -124,22 +124,22 @@ class ConvertToDeposit implements ActionInterface
*/
private function convertWithdrawalArray(TransactionJournal $journal): bool
{
- $user = $journal->user;
+ $user = $journal->user;
// find or create revenue account.
/** @var AccountFactory $factory */
- $factory = app(AccountFactory::class);
+ $factory = app(AccountFactory::class);
$factory->setUser($user);
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($user);
- $destAccount = $this->getDestinationAccount($journal);
- $sourceAccount = $this->getSourceAccount($journal);
+ $destAccount = $this->getDestinationAccount($journal);
+ $sourceAccount = $this->getSourceAccount($journal);
// get the action value, or use the original destination name in case the action value is empty:
// this becomes a new or existing (revenue) account, which is the source of the new deposit.
- $opposingName = '' === $this->action->action_value ? $destAccount->name : $this->action->action_value;
+ $opposingName = '' === $this->action->action_value ? $destAccount->name : $this->action->action_value;
// we check all possible source account types if one exists:
$validTypes = config('firefly.expected_source_types.source.Deposit');
$opposingAccount = $repository->findByName($opposingName, $validTypes);
@@ -164,7 +164,7 @@ class ConvertToDeposit implements ActionInterface
;
// change transaction type of journal:
- $newType = TransactionType::whereType(TransactionType::DEPOSIT)->first();
+ $newType = TransactionType::whereType(TransactionType::DEPOSIT)->first();
\DB::table('transaction_journals')
->where('id', '=', $journal->id)
@@ -213,21 +213,21 @@ class ConvertToDeposit implements ActionInterface
*/
private function convertTransferArray(TransactionJournal $journal): bool
{
- $user = $journal->user;
+ $user = $journal->user;
// find or create revenue account.
/** @var AccountFactory $factory */
- $factory = app(AccountFactory::class);
+ $factory = app(AccountFactory::class);
$factory->setUser($user);
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($user);
- $sourceAccount = $this->getSourceAccount($journal);
+ $sourceAccount = $this->getSourceAccount($journal);
// get the action value, or use the original source name in case the action value is empty:
// this becomes a new or existing (revenue) account, which is the source of the new deposit.
- $opposingName = '' === $this->action->action_value ? $sourceAccount->name : $this->action->action_value;
+ $opposingName = '' === $this->action->action_value ? $sourceAccount->name : $this->action->action_value;
// we check all possible source account types if one exists:
$validTypes = config('firefly.expected_source_types.source.Deposit');
$opposingAccount = $repository->findByName($opposingName, $validTypes);
@@ -245,7 +245,7 @@ class ConvertToDeposit implements ActionInterface
;
// change transaction type of journal:
- $newType = TransactionType::whereType(TransactionType::DEPOSIT)->first();
+ $newType = TransactionType::whereType(TransactionType::DEPOSIT)->first();
\DB::table('transaction_journals')
->where('id', '=', $journal->id)
diff --git a/app/TransactionRules/Actions/ConvertToTransfer.php b/app/TransactionRules/Actions/ConvertToTransfer.php
index 9a2878186f..3472c72d07 100644
--- a/app/TransactionRules/Actions/ConvertToTransfer.php
+++ b/app/TransactionRules/Actions/ConvertToTransfer.php
@@ -57,14 +57,14 @@ class ConvertToTransfer implements ActionInterface
{
// make object from array (so the data is fresh).
/** @var null|TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
app('log')->error(sprintf('Cannot find journal #%d, cannot convert to transfer.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_not_found')));
return false;
}
- $groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
+ $groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
if ($groupCount > 1) {
app('log')->error(sprintf('Group #%d has more than one transaction in it, cannot convert to transfer.', $journal['transaction_group_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.split_group')));
@@ -72,9 +72,9 @@ class ConvertToTransfer implements ActionInterface
return false;
}
- $type = $object->transactionType->type;
- $user = $object->user;
- $journalId = $object->id;
+ $type = $object->transactionType->type;
+ $user = $object->user;
+ $journalId = $object->id;
if (TransactionType::TRANSFER === $type) {
app('log')->error(
sprintf('Journal #%d is already a transfer so cannot be converted (rule #%d).', $object->id, $this->action->rule_id)
@@ -91,7 +91,7 @@ class ConvertToTransfer implements ActionInterface
// find the asset account in the action value.
/** @var AccountRepositoryInterface $repository */
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($user);
$expectedType = null;
if (TransactionType::WITHDRAWAL === $type) {
@@ -102,7 +102,7 @@ class ConvertToTransfer implements ActionInterface
$expectedType = $this->getDestinationType($journalId);
// Deposit? Replace source with account with same type as destination.
}
- $opposing = $repository->findByName($this->action->action_value, [$expectedType]);
+ $opposing = $repository->findByName($this->action->action_value, [$expectedType]);
if (null === $opposing) {
app('log')->error(
@@ -212,7 +212,7 @@ class ConvertToTransfer implements ActionInterface
;
// change transaction type of journal:
- $newType = TransactionType::whereType(TransactionType::TRANSFER)->first();
+ $newType = TransactionType::whereType(TransactionType::TRANSFER)->first();
\DB::table('transaction_journals')
->where('id', '=', $journal->id)
@@ -267,7 +267,7 @@ class ConvertToTransfer implements ActionInterface
;
// change transaction type of journal:
- $newType = TransactionType::whereType(TransactionType::TRANSFER)->first();
+ $newType = TransactionType::whereType(TransactionType::TRANSFER)->first();
\DB::table('transaction_journals')
->where('id', '=', $journal->id)
diff --git a/app/TransactionRules/Actions/ConvertToWithdrawal.php b/app/TransactionRules/Actions/ConvertToWithdrawal.php
index e9fe15633d..d7b9684826 100644
--- a/app/TransactionRules/Actions/ConvertToWithdrawal.php
+++ b/app/TransactionRules/Actions/ConvertToWithdrawal.php
@@ -54,7 +54,7 @@ class ConvertToWithdrawal implements ActionInterface
{
// make object from array (so the data is fresh).
/** @var null|TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
app('log')->error(sprintf('Cannot find journal #%d, cannot convert to withdrawal.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_not_found')));
@@ -69,7 +69,7 @@ class ConvertToWithdrawal implements ActionInterface
return false;
}
- $type = $object->transactionType->type;
+ $type = $object->transactionType->type;
if (TransactionType::WITHDRAWAL === $type) {
app('log')->error(sprintf('Journal #%d is already a withdrawal (rule #%d).', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_already_withdrawal')));
@@ -119,21 +119,21 @@ class ConvertToWithdrawal implements ActionInterface
*/
private function convertDepositArray(TransactionJournal $journal): bool
{
- $user = $journal->user;
+ $user = $journal->user;
/** @var AccountFactory $factory */
- $factory = app(AccountFactory::class);
+ $factory = app(AccountFactory::class);
$factory->setUser($user);
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($user);
- $sourceAccount = $this->getSourceAccount($journal);
- $destAccount = $this->getDestinationAccount($journal);
+ $sourceAccount = $this->getSourceAccount($journal);
+ $destAccount = $this->getDestinationAccount($journal);
// get the action value, or use the original source name in case the action value is empty:
// this becomes a new or existing (expense) account, which is the destination of the new withdrawal.
- $opposingName = '' === $this->action->action_value ? $sourceAccount->name : $this->action->action_value;
+ $opposingName = '' === $this->action->action_value ? $sourceAccount->name : $this->action->action_value;
// we check all possible source account types if one exists:
$validTypes = config('firefly.expected_source_types.destination.Withdrawal');
$opposingAccount = $repository->findByName($opposingName, $validTypes);
@@ -158,7 +158,7 @@ class ConvertToWithdrawal implements ActionInterface
;
// change transaction type of journal:
- $newType = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
+ $newType = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
\DB::table('transaction_journals')
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id])
@@ -206,20 +206,20 @@ class ConvertToWithdrawal implements ActionInterface
private function convertTransferArray(TransactionJournal $journal): bool
{
// find or create expense account.
- $user = $journal->user;
+ $user = $journal->user;
/** @var AccountFactory $factory */
- $factory = app(AccountFactory::class);
+ $factory = app(AccountFactory::class);
$factory->setUser($user);
- $repository = app(AccountRepositoryInterface::class);
+ $repository = app(AccountRepositoryInterface::class);
$repository->setUser($user);
- $destAccount = $this->getDestinationAccount($journal);
+ $destAccount = $this->getDestinationAccount($journal);
// get the action value, or use the original source name in case the action value is empty:
// this becomes a new or existing (expense) account, which is the destination of the new withdrawal.
- $opposingName = '' === $this->action->action_value ? $destAccount->name : $this->action->action_value;
+ $opposingName = '' === $this->action->action_value ? $destAccount->name : $this->action->action_value;
// we check all possible source account types if one exists:
$validTypes = config('firefly.expected_source_types.destination.Withdrawal');
$opposingAccount = $repository->findByName($opposingName, $validTypes);
@@ -237,7 +237,7 @@ class ConvertToWithdrawal implements ActionInterface
;
// change transaction type of journal:
- $newType = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
+ $newType = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
\DB::table('transaction_journals')
->where('id', '=', $journal->id)
->update(['transaction_type_id' => $newType->id])
diff --git a/app/TransactionRules/Actions/DeleteTransaction.php b/app/TransactionRules/Actions/DeleteTransaction.php
index 0597695eac..5863422fa3 100644
--- a/app/TransactionRules/Actions/DeleteTransaction.php
+++ b/app/TransactionRules/Actions/DeleteTransaction.php
@@ -47,7 +47,7 @@ class DeleteTransaction implements ActionInterface
public function actOnArray(array $journal): bool
{
- $count = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
+ $count = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
// destroy entire group.
if (1 === $count) {
diff --git a/app/TransactionRules/Actions/LinkToBill.php b/app/TransactionRules/Actions/LinkToBill.php
index 91f8243a4a..f9e0406d34 100644
--- a/app/TransactionRules/Actions/LinkToBill.php
+++ b/app/TransactionRules/Actions/LinkToBill.php
@@ -49,16 +49,16 @@ class LinkToBill implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var User $user */
- $user = User::find($journal['user_id']);
+ $user = User::find($journal['user_id']);
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$repository->setUser($user);
- $billName = (string)$this->action->action_value;
- $bill = $repository->findByName($billName);
+ $billName = (string)$this->action->action_value;
+ $bill = $repository->findByName($billName);
if (null !== $bill && TransactionType::WITHDRAWAL === $journal['transaction_type_type']) {
- $count = \DB::table('transaction_journals')->where('id', '=', $journal['transaction_journal_id'])
+ $count = \DB::table('transaction_journals')->where('id', '=', $journal['transaction_journal_id'])
->where('bill_id', $bill->id)->count()
;
if (0 !== $count) {
diff --git a/app/TransactionRules/Actions/MoveDescriptionToNotes.php b/app/TransactionRules/Actions/MoveDescriptionToNotes.php
index 0e5bda4381..9b611f7db2 100644
--- a/app/TransactionRules/Actions/MoveDescriptionToNotes.php
+++ b/app/TransactionRules/Actions/MoveDescriptionToNotes.php
@@ -48,7 +48,7 @@ class MoveDescriptionToNotes implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var null|TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
app('log')->error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_other_user')));
@@ -57,9 +57,9 @@ class MoveDescriptionToNotes implements ActionInterface
}
/** @var null|Note $note */
- $note = $object->notes()->first();
+ $note = $object->notes()->first();
if (null === $note) {
- $note = new Note();
+ $note = new Note();
$note->noteable()->associate($object);
$note->text = '';
}
@@ -73,7 +73,7 @@ class MoveDescriptionToNotes implements ActionInterface
$note->text = (string)$object->description;
$object->description = '(no description)';
}
- $after = $note->text;
+ $after = $note->text;
event(new TriggeredAuditLog($this->action->rule, $object, 'update_description', $beforeDescription, $object->description));
event(new TriggeredAuditLog($this->action->rule, $object, 'update_notes', $before, $after));
diff --git a/app/TransactionRules/Actions/MoveNotesToDescription.php b/app/TransactionRules/Actions/MoveNotesToDescription.php
index 2a8b51fce7..1814370f51 100644
--- a/app/TransactionRules/Actions/MoveNotesToDescription.php
+++ b/app/TransactionRules/Actions/MoveNotesToDescription.php
@@ -54,14 +54,14 @@ class MoveNotesToDescription implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var null|TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
app('log')->error(sprintf('No journal #%d belongs to user #%d.', $journal['transaction_journal_id'], $journal['user_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.journal_other_user')));
return false;
}
- $note = $object->notes()->first();
+ $note = $object->notes()->first();
if (null === $note) {
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_notes_to_move')));
diff --git a/app/TransactionRules/Actions/PrependNotes.php b/app/TransactionRules/Actions/PrependNotes.php
index 6c03ea481b..7bbfd70f71 100644
--- a/app/TransactionRules/Actions/PrependNotes.php
+++ b/app/TransactionRules/Actions/PrependNotes.php
@@ -45,7 +45,7 @@ class PrependNotes implements ActionInterface
public function actOnArray(array $journal): bool
{
- $dbNote = Note::where('noteable_id', (int)$journal['transaction_journal_id'])
+ $dbNote = Note::where('noteable_id', (int)$journal['transaction_journal_id'])
->where('noteable_type', TransactionJournal::class)
->first(['notes.*'])
;
@@ -55,7 +55,7 @@ class PrependNotes implements ActionInterface
$dbNote->noteable_type = TransactionJournal::class;
$dbNote->text = '';
}
- $before = $dbNote->text;
+ $before = $dbNote->text;
app('log')->debug(sprintf('RuleAction PrependNotes prepended "%s" to "%s".', $this->action->action_value, $dbNote->text));
$text = sprintf('%s%s', $this->action->action_value, $dbNote->text);
$dbNote->text = $text;
@@ -63,7 +63,7 @@ class PrependNotes implements ActionInterface
// journal
/** @var TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
// audit log
event(new TriggeredAuditLog($this->action->rule, $object, 'update_notes', $before, $text));
diff --git a/app/TransactionRules/Actions/RemoveAllTags.php b/app/TransactionRules/Actions/RemoveAllTags.php
index 37da4d8768..8952d9532d 100644
--- a/app/TransactionRules/Actions/RemoveAllTags.php
+++ b/app/TransactionRules/Actions/RemoveAllTags.php
@@ -46,7 +46,7 @@ class RemoveAllTags implements ActionInterface
public function actOnArray(array $journal): bool
{
\DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->delete();
- $count = \DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->count();
+ $count = \DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->count();
if (0 === $count) {
app('log')->debug(sprintf('RuleAction RemoveAllTags, journal #%d has no tags.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_tags_to_remove')));
diff --git a/app/TransactionRules/Actions/RemoveTag.php b/app/TransactionRules/Actions/RemoveTag.php
index 207c7cdeeb..55ef91531a 100644
--- a/app/TransactionRules/Actions/RemoveTag.php
+++ b/app/TransactionRules/Actions/RemoveTag.php
@@ -47,11 +47,11 @@ class RemoveTag implements ActionInterface
public function actOnArray(array $journal): bool
{
// if tag does not exist, no need to continue:
- $name = $this->action->action_value;
+ $name = $this->action->action_value;
/** @var User $user */
- $user = User::find($journal['user_id']);
- $tag = $user->tags()->where('tag', $name)->first();
+ $user = User::find($journal['user_id']);
+ $tag = $user->tags()->where('tag', $name)->first();
if (null === $tag) {
app('log')->debug(
@@ -61,7 +61,7 @@ class RemoveTag implements ActionInterface
return false;
}
- $count = \DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->where('tag_id', $tag->id)->count();
+ $count = \DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->where('tag_id', $tag->id)->count();
if (0 === $count) {
app('log')->debug(
sprintf('RuleAction RemoveTag tried to remove tag "%s" from journal #%d but no such tag is linked.', $name, $journal['transaction_journal_id'])
diff --git a/app/TransactionRules/Actions/SetBudget.php b/app/TransactionRules/Actions/SetBudget.php
index 0d616b50ba..260ea63cb5 100644
--- a/app/TransactionRules/Actions/SetBudget.php
+++ b/app/TransactionRules/Actions/SetBudget.php
@@ -48,10 +48,10 @@ class SetBudget implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var User $user */
- $user = User::find($journal['user_id']);
- $search = $this->action->action_value;
+ $user = User::find($journal['user_id']);
+ $search = $this->action->action_value;
- $budget = $user->budgets()->where('name', $search)->first();
+ $budget = $user->budgets()->where('name', $search)->first();
if (null === $budget) {
app('log')->debug(
sprintf(
@@ -98,7 +98,7 @@ class SetBudget implements ActionInterface
\DB::table('budget_transaction_journal')->insert(['transaction_journal_id' => $journal['transaction_journal_id'], 'budget_id' => $budget->id]);
/** @var TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
event(new TriggeredAuditLog($this->action->rule, $object, 'set_budget', $oldBudgetName, $budget->name));
return true;
diff --git a/app/TransactionRules/Actions/SetCategory.php b/app/TransactionRules/Actions/SetCategory.php
index cc95ab919d..9e184a30ed 100644
--- a/app/TransactionRules/Actions/SetCategory.php
+++ b/app/TransactionRules/Actions/SetCategory.php
@@ -48,8 +48,8 @@ class SetCategory implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var null|User $user */
- $user = User::find($journal['user_id']);
- $search = $this->action->action_value;
+ $user = User::find($journal['user_id']);
+ $search = $this->action->action_value;
if (null === $user) {
app('log')->error(sprintf('Journal has no valid user ID so action SetCategory("%s") cannot be applied', $search), $journal);
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
@@ -58,9 +58,9 @@ class SetCategory implements ActionInterface
}
/** @var CategoryFactory $factory */
- $factory = app(CategoryFactory::class);
+ $factory = app(CategoryFactory::class);
$factory->setUser($user);
- $category = $factory->findOrCreate(null, $search);
+ $category = $factory->findOrCreate(null, $search);
if (null === $category) {
app('log')->debug(
sprintf(
@@ -98,7 +98,7 @@ class SetCategory implements ActionInterface
\DB::table('category_transaction_journal')->insert(['transaction_journal_id' => $journal['transaction_journal_id'], 'category_id' => $category->id]);
/** @var TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
event(new TriggeredAuditLog($this->action->rule, $object, 'set_category', $oldCategoryName, $category->name));
return true;
diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.php
index e8e3750cc5..455acb4dfd 100644
--- a/app/TransactionRules/Actions/SetDestinationAccount.php
+++ b/app/TransactionRules/Actions/SetDestinationAccount.php
@@ -52,7 +52,7 @@ class SetDestinationAccount implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var User $user */
- $user = User::find($journal['user_id']);
+ $user = User::find($journal['user_id']);
/** @var null|TransactionJournal $object */
$object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']);
@@ -64,11 +64,11 @@ class SetDestinationAccount implements ActionInterface
return false;
}
- $type = $object->transactionType->type;
+ $type = $object->transactionType->type;
$this->repository->setUser($user);
// if this is a transfer or a deposit, the new destination account must be an asset account or a default account, and it MUST exist:
- $newAccount = $this->findAssetAccount($type);
+ $newAccount = $this->findAssetAccount($type);
if ((TransactionType::DEPOSIT === $type || TransactionType::TRANSFER === $type) && null === $newAccount) {
app('log')->error(
sprintf(
@@ -84,7 +84,7 @@ class SetDestinationAccount implements ActionInterface
// new destination account must be different from the current source account:
/** @var null|Transaction $source */
- $source = $object->transactions()->where('amount', '<', 0)->first();
+ $source = $object->transactions()->where('amount', '<', 0)->first();
if (null === $source) {
app('log')->error('Could not find source transaction.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_source_transaction')));
diff --git a/app/TransactionRules/Actions/SetDestinationToCashAccount.php b/app/TransactionRules/Actions/SetDestinationToCashAccount.php
index 6dfd024b6c..0e21126e16 100644
--- a/app/TransactionRules/Actions/SetDestinationToCashAccount.php
+++ b/app/TransactionRules/Actions/SetDestinationToCashAccount.php
@@ -50,11 +50,11 @@ class SetDestinationToCashAccount implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var User $user */
- $user = User::find($journal['user_id']);
+ $user = User::find($journal['user_id']);
/** @var null|TransactionJournal $object */
- $object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']);
- $repository = app(AccountRepositoryInterface::class);
+ $object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']);
+ $repository = app(AccountRepositoryInterface::class);
if (null === $object) {
app('log')->error('Could not find journal.');
@@ -62,7 +62,7 @@ class SetDestinationToCashAccount implements ActionInterface
return false;
}
- $type = $object->transactionType->type;
+ $type = $object->transactionType->type;
if (TransactionType::WITHDRAWAL !== $type) {
app('log')->error('Transaction must be withdrawal.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.not_withdrawal')));
@@ -76,7 +76,7 @@ class SetDestinationToCashAccount implements ActionInterface
// new destination account must be different from the current source account:
/** @var null|Transaction $source */
- $source = $object->transactions()->where('amount', '<', 0)->first();
+ $source = $object->transactions()->where('amount', '<', 0)->first();
if (null === $source) {
app('log')->error('Could not find source transaction.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_source_transaction')));
diff --git a/app/TransactionRules/Actions/SetNotes.php b/app/TransactionRules/Actions/SetNotes.php
index 4e0235baea..c1ea311cb3 100644
--- a/app/TransactionRules/Actions/SetNotes.php
+++ b/app/TransactionRules/Actions/SetNotes.php
@@ -45,7 +45,7 @@ class SetNotes implements ActionInterface
public function actOnArray(array $journal): bool
{
- $dbNote = Note::where('noteable_id', $journal['transaction_journal_id'])
+ $dbNote = Note::where('noteable_id', $journal['transaction_journal_id'])
->where('noteable_type', TransactionJournal::class)->first()
;
if (null === $dbNote) {
@@ -68,7 +68,7 @@ class SetNotes implements ActionInterface
);
/** @var TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
event(new TriggeredAuditLog($this->action->rule, $object, 'update_notes', $oldNotes, $this->action->action_value));
diff --git a/app/TransactionRules/Actions/SetSourceAccount.php b/app/TransactionRules/Actions/SetSourceAccount.php
index c957dfec9d..aafe75569b 100644
--- a/app/TransactionRules/Actions/SetSourceAccount.php
+++ b/app/TransactionRules/Actions/SetSourceAccount.php
@@ -52,7 +52,7 @@ class SetSourceAccount implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var User $user */
- $user = User::find($journal['user_id']);
+ $user = User::find($journal['user_id']);
/** @var null|TransactionJournal $object */
$object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']);
@@ -63,11 +63,11 @@ class SetSourceAccount implements ActionInterface
return false;
}
- $type = $object->transactionType->type;
+ $type = $object->transactionType->type;
$this->repository->setUser($user);
// if this is a transfer or a withdrawal, the new source account must be an asset account or a default account, and it MUST exist:
- $newAccount = $this->findAssetAccount($type);
+ $newAccount = $this->findAssetAccount($type);
if ((TransactionType::WITHDRAWAL === $type || TransactionType::TRANSFER === $type) && null === $newAccount) {
app('log')->error(
sprintf('Cant change source account of journal #%d because no asset account with name "%s" exists.', $object->id, $this->action->action_value)
@@ -79,7 +79,7 @@ class SetSourceAccount implements ActionInterface
// new source account must be different from the current destination account:
/** @var null|Transaction $destination */
- $destination = $object->transactions()->where('amount', '>', 0)->first();
+ $destination = $object->transactions()->where('amount', '>', 0)->first();
if (null === $destination) {
app('log')->error('Could not find destination transaction.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_destination_transaction')));
diff --git a/app/TransactionRules/Actions/SetSourceToCashAccount.php b/app/TransactionRules/Actions/SetSourceToCashAccount.php
index 179ce4aab3..f8a4b91565 100644
--- a/app/TransactionRules/Actions/SetSourceToCashAccount.php
+++ b/app/TransactionRules/Actions/SetSourceToCashAccount.php
@@ -50,11 +50,11 @@ class SetSourceToCashAccount implements ActionInterface
public function actOnArray(array $journal): bool
{
/** @var User $user */
- $user = User::find($journal['user_id']);
+ $user = User::find($journal['user_id']);
/** @var null|TransactionJournal $object */
- $object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']);
- $repository = app(AccountRepositoryInterface::class);
+ $object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']);
+ $repository = app(AccountRepositoryInterface::class);
if (null === $object) {
app('log')->error('Could not find journal.');
@@ -62,7 +62,7 @@ class SetSourceToCashAccount implements ActionInterface
return false;
}
- $type = $object->transactionType->type;
+ $type = $object->transactionType->type;
if (TransactionType::DEPOSIT !== $type) {
app('log')->error('Transaction must be deposit.');
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.not_deposit')));
diff --git a/app/TransactionRules/Actions/SwitchAccounts.php b/app/TransactionRules/Actions/SwitchAccounts.php
index a9bd99384b..e7df491e32 100644
--- a/app/TransactionRules/Actions/SwitchAccounts.php
+++ b/app/TransactionRules/Actions/SwitchAccounts.php
@@ -49,14 +49,14 @@ class SwitchAccounts implements ActionInterface
{
// make object from array (so the data is fresh).
/** @var null|TransactionJournal $object */
- $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
+ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
if (null === $object) {
app('log')->error(sprintf('Cannot find journal #%d, cannot switch accounts.', $journal['transaction_journal_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
return false;
}
- $groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
+ $groupCount = TransactionJournal::where('transaction_group_id', $journal['transaction_group_id'])->count();
if ($groupCount > 1) {
app('log')->error(sprintf('Group #%d has more than one transaction in it, cannot switch accounts.', $journal['transaction_group_id']));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.split_group')));
@@ -64,7 +64,7 @@ class SwitchAccounts implements ActionInterface
return false;
}
- $type = $object->transactionType->type;
+ $type = $object->transactionType->type;
if (TransactionType::TRANSFER !== $type) {
app('log')->error(sprintf('Journal #%d is NOT a transfer (rule #%d), cannot switch accounts.', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.is_not_transfer')));
@@ -73,10 +73,10 @@ class SwitchAccounts implements ActionInterface
}
/** @var null|Transaction $sourceTransaction */
- $sourceTransaction = $object->transactions()->where('amount', '<', 0)->first();
+ $sourceTransaction = $object->transactions()->where('amount', '<', 0)->first();
/** @var null|Transaction $destTransaction */
- $destTransaction = $object->transactions()->where('amount', '>', 0)->first();
+ $destTransaction = $object->transactions()->where('amount', '>', 0)->first();
if (null === $sourceTransaction || null === $destTransaction) {
app('log')->error(sprintf('Journal #%d has no source or destination transaction (rule #%d), cannot switch accounts.', $journal['transaction_journal_id'], $this->action->rule_id));
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_accounts')));
diff --git a/app/TransactionRules/Actions/UpdatePiggybank.php b/app/TransactionRules/Actions/UpdatePiggybank.php
index 6fabeb3923..4bd1d1de19 100644
--- a/app/TransactionRules/Actions/UpdatePiggybank.php
+++ b/app/TransactionRules/Actions/UpdatePiggybank.php
@@ -54,12 +54,12 @@ class UpdatePiggybank implements ActionInterface
// refresh the transaction type.
/** @var User $user */
- $user = User::find($journal['user_id']);
+ $user = User::find($journal['user_id']);
/** @var TransactionJournal $journalObj */
- $journalObj = $user->transactionJournals()->find($journal['transaction_journal_id']);
+ $journalObj = $user->transactionJournals()->find($journal['transaction_journal_id']);
- $piggyBank = $this->findPiggyBank($user);
+ $piggyBank = $this->findPiggyBank($user);
if (null === $piggyBank) {
app('log')->info(
sprintf('No piggy bank named "%s", cant execute action #%d of rule #%d', $this->action->action_value, $this->action->id, $this->action->rule_id)
@@ -72,7 +72,7 @@ class UpdatePiggybank implements ActionInterface
app('log')->debug(sprintf('Found piggy bank #%d ("%s")', $piggyBank->id, $piggyBank->name));
/** @var Transaction $source */
- $source = $journalObj->transactions()->where('amount', '<', 0)->first();
+ $source = $journalObj->transactions()->where('amount', '<', 0)->first();
/** @var Transaction $destination */
$destination = $journalObj->transactions()->where('amount', '>', 0)->first();
@@ -142,11 +142,11 @@ class UpdatePiggybank implements ActionInterface
$repository->setUser($journal->user);
// how much can we remove from this piggy bank?
- $toRemove = $repository->getCurrentAmount($piggyBank);
+ $toRemove = $repository->getCurrentAmount($piggyBank);
app('log')->debug(sprintf('Amount is %s, max to remove is %s', $amount, $toRemove));
// if $amount is bigger than $toRemove, shrink it.
- $amount = -1 === bccomp($amount, $toRemove) ? $amount : $toRemove;
+ $amount = -1 === bccomp($amount, $toRemove) ? $amount : $toRemove;
app('log')->debug(sprintf('Amount is now %s', $amount));
// if amount is zero, stop.
@@ -174,7 +174,7 @@ class UpdatePiggybank implements ActionInterface
// how much can we add to the piggy bank?
if (0 !== bccomp($piggyBank->targetamount, '0')) {
- $toAdd = bcsub($piggyBank->targetamount, $repository->getCurrentAmount($piggyBank));
+ $toAdd = bcsub($piggyBank->targetamount, $repository->getCurrentAmount($piggyBank));
app('log')->debug(sprintf('Max amount to add to piggy bank is %s, amount is %s', $toAdd, $amount));
// update amount to fit:
diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php
index 4853c3ba09..d0697f1826 100644
--- a/app/TransactionRules/Engine/SearchRuleEngine.php
+++ b/app/TransactionRules/Engine/SearchRuleEngine.php
@@ -50,10 +50,10 @@ class SearchRuleEngine implements RuleEngineInterface
public function __construct()
{
- $this->rules = new Collection();
- $this->groups = new Collection();
- $this->operators = [];
- $this->resultCount = [];
+ $this->rules = new Collection();
+ $this->groups = new Collection();
+ $this->operators = [];
+ $this->resultCount = [];
// always collect the triggers from the database, unless indicated otherwise.
$this->refreshTriggers = true;
@@ -70,7 +70,7 @@ class SearchRuleEngine implements RuleEngineInterface
app('log')->debug('SearchRuleEngine::find()');
$collection = new Collection();
foreach ($this->rules as $rule) {
- $found = new Collection();
+ $found = new Collection();
if (true === $rule->strict) {
$found = $this->findStrictRule($rule);
}
@@ -168,8 +168,8 @@ class SearchRuleEngine implements RuleEngineInterface
private function findStrictRule(Rule $rule): Collection
{
app('log')->debug(sprintf('Now in findStrictRule(#%d)', $rule->id ?? 0));
- $searchArray = [];
- $triggers = [];
+ $searchArray = [];
+ $triggers = [];
if ($this->refreshTriggers) {
$triggers = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
}
@@ -200,7 +200,7 @@ class SearchRuleEngine implements RuleEngineInterface
app('log')->debug(sprintf('SearchRuleEngine:: add local added operator: %s:"%s"', $operator['type'], $operator['value']));
$searchArray[$operator['type']][] = sprintf('"%s"', $operator['value']);
}
- $date = today(config('app.timezone'));
+ $date = today(config('app.timezone'));
if ($this->hasSpecificJournalTrigger($searchArray)) {
$date = $this->setDateFromJournalTrigger($searchArray);
}
@@ -220,7 +220,7 @@ class SearchRuleEngine implements RuleEngineInterface
}
}
- $result = $searchEngine->searchTransactions();
+ $result = $searchEngine->searchTransactions();
return $result->getCollection();
}
@@ -245,7 +245,7 @@ class SearchRuleEngine implements RuleEngineInterface
$dateTrigger = true;
}
}
- $result = $journalTrigger && $dateTrigger;
+ $result = $journalTrigger && $dateTrigger;
app('log')->debug(sprintf('Result of hasSpecificJournalTrigger is %s.', var_export($result, true)));
return $result;
@@ -264,7 +264,7 @@ class SearchRuleEngine implements RuleEngineInterface
if (0 !== $journalId) {
$repository = app(JournalRepositoryInterface::class);
$repository->setUser($this->user);
- $journal = $repository->find($journalId);
+ $journal = $repository->find($journalId);
if (null !== $journal) {
$date = $journal->date;
app('log')->debug(sprintf('Found journal #%d with date %s.', $journal->id, $journal->date->format('Y-m-d')));
@@ -327,10 +327,10 @@ class SearchRuleEngine implements RuleEngineInterface
$searchEngine->parseQuery(sprintf('%s:%s', $type, $value));
}
- $result = $searchEngine->searchTransactions();
- $collection = $result->getCollection();
+ $result = $searchEngine->searchTransactions();
+ $collection = $result->getCollection();
app('log')->debug(sprintf('Found in this run, %d transactions', $collection->count()));
- $total = $total->merge($collection);
+ $total = $total->merge($collection);
app('log')->debug(sprintf('Total collection is now %d transactions', $total->count()));
++$count;
// if trigger says stop processing, do so.
@@ -344,7 +344,7 @@ class SearchRuleEngine implements RuleEngineInterface
app('log')->debug(sprintf('Done running %d trigger(s)', $count));
// make collection unique
- $unique = $total->unique(
+ $unique = $total->unique(
static function (array $group) {
$str = '';
foreach ($group['transactions'] as $transaction) {
@@ -397,7 +397,7 @@ class SearchRuleEngine implements RuleEngineInterface
$this->processResults($rule, $collection);
app('log')->debug(sprintf('SearchRuleEngine:: done processing strict rule #%d', $rule->id));
- $result = $collection->count() > 0;
+ $result = $collection->count() > 0;
if (true === $result) {
app('log')->debug(sprintf('SearchRuleEngine:: rule #%d was triggered (on %d transaction(s)).', $rule->id, $collection->count()));
diff --git a/app/TransactionRules/Factory/ActionFactory.php b/app/TransactionRules/Factory/ActionFactory.php
index 4dda98e4c2..23780bce6d 100644
--- a/app/TransactionRules/Factory/ActionFactory.php
+++ b/app/TransactionRules/Factory/ActionFactory.php
@@ -67,7 +67,7 @@ class ActionFactory
throw new FireflyException('No such action exists ("'.e($actionType).'").');
}
- $class = $actionTypes[$actionType];
+ $class = $actionTypes[$actionType];
if (!class_exists($class)) {
throw new FireflyException('Could not instantiate class for rule action type "'.e($actionType).'" ('.e($class).').');
}
diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php
index 81c1b7e040..7b00805465 100644
--- a/app/Transformers/AccountTransformer.php
+++ b/app/Transformers/AccountTransformer.php
@@ -55,28 +55,28 @@ class AccountTransformer extends AbstractTransformer
$this->repository->setUser($account->user);
// get account type:
- $fullType = $account->accountType->type;
- $accountType = (string)config(sprintf('firefly.shortNamesByFullName.%s', $fullType));
- $liabilityType = (string)config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));
- $liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);
- $liabilityDirection = $this->repository->getMetaValue($account, 'liability_direction');
+ $fullType = $account->accountType->type;
+ $accountType = (string)config(sprintf('firefly.shortNamesByFullName.%s', $fullType));
+ $liabilityType = (string)config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));
+ $liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);
+ $liabilityDirection = $this->repository->getMetaValue($account, 'liability_direction');
// get account role (will only work if the type is asset.
- $accountRole = $this->getAccountRole($account, $accountType);
- $date = $this->getDate();
+ $accountRole = $this->getAccountRole($account, $accountType);
+ $date = $this->getDate();
$date->endOfDay();
[$currencyId, $currencyCode, $currencySymbol, $decimalPlaces] = $this->getCurrency($account);
- [$creditCardType, $monthlyPaymentDate] = $this->getCCInfo($account, $accountRole, $accountType);
- [$openingBalance, $openingBalanceDate] = $this->getOpeningBalance($account, $accountType);
- [$interest, $interestPeriod] = $this->getInterest($account, $accountType);
+ [$creditCardType, $monthlyPaymentDate] = $this->getCCInfo($account, $accountRole, $accountType);
+ [$openingBalance, $openingBalanceDate] = $this->getOpeningBalance($account, $accountType);
+ [$interest, $interestPeriod] = $this->getInterest($account, $accountType);
- $openingBalance = app('steam')->bcround($openingBalance, $decimalPlaces);
- $includeNetWorth = '0' !== $this->repository->getMetaValue($account, 'include_net_worth');
- $longitude = null;
- $latitude = null;
- $zoomLevel = null;
- $location = $this->repository->getLocation($account);
+ $openingBalance = app('steam')->bcround($openingBalance, $decimalPlaces);
+ $includeNetWorth = '0' !== $this->repository->getMetaValue($account, 'include_net_worth');
+ $longitude = null;
+ $latitude = null;
+ $zoomLevel = null;
+ $location = $this->repository->getLocation($account);
if (null !== $location) {
$longitude = $location->longitude;
$latitude = $location->latitude;
@@ -84,7 +84,7 @@ class AccountTransformer extends AbstractTransformer
}
// no order for some accounts:
- $order = $account->order;
+ $order = $account->order;
if (!in_array(strtolower($accountType), ['liability', 'liabilities', 'asset'], true)) {
$order = null;
}
@@ -159,7 +159,7 @@ class AccountTransformer extends AbstractTransformer
*/
private function getCurrency(Account $account): array
{
- $currency = $this->repository->getAccountCurrency($account);
+ $currency = $this->repository->getAccountCurrency($account);
// only grab default when result is null:
if (null === $currency) {
@@ -184,7 +184,7 @@ class AccountTransformer extends AbstractTransformer
if (null !== $monthlyPaymentDate) {
// try classic date:
if (10 === strlen($monthlyPaymentDate)) {
- $object = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'));
+ $object = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'));
if (false === $object) {
$object = today(config('app.timezone'));
}
@@ -213,7 +213,7 @@ class AccountTransformer extends AbstractTransformer
$openingBalanceDate = $this->repository->getOpeningBalanceDate($account);
}
if (null !== $openingBalanceDate) {
- $object = Carbon::createFromFormat('Y-m-d H:i:s', $openingBalanceDate, config('app.timezone'));
+ $object = Carbon::createFromFormat('Y-m-d H:i:s', $openingBalanceDate, config('app.timezone'));
if (false === $object) {
$object = today(config('app.timezone'));
}
diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php
index e0002fb637..422231ae0e 100644
--- a/app/Transformers/BillTransformer.php
+++ b/app/Transformers/BillTransformer.php
@@ -57,21 +57,21 @@ class BillTransformer extends AbstractTransformer
*/
public function transform(Bill $bill): array
{
- $paidData = $this->paidData($bill);
- $lastPaidDate = $this->getLastPaidDate($paidData);
- $start = $this->parameters->get('start') ?? today()->subYears(10);
- $end = $this->parameters->get('end') ?? today()->addYears(10);
- $payDates = $this->calculator->getPayDates($start, $end, $bill->date, $bill->repeat_freq, $bill->skip, $lastPaidDate);
- $currency = $bill->transactionCurrency;
- $notes = $this->repository->getNoteText($bill);
- $notes = '' === $notes ? null : $notes;
- $objectGroupId = null;
- $objectGroupOrder = null;
- $objectGroupTitle = null;
+ $paidData = $this->paidData($bill);
+ $lastPaidDate = $this->getLastPaidDate($paidData);
+ $start = $this->parameters->get('start') ?? today()->subYears(10);
+ $end = $this->parameters->get('end') ?? today()->addYears(10);
+ $payDates = $this->calculator->getPayDates($start, $end, $bill->date, $bill->repeat_freq, $bill->skip, $lastPaidDate);
+ $currency = $bill->transactionCurrency;
+ $notes = $this->repository->getNoteText($bill);
+ $notes = '' === $notes ? null : $notes;
+ $objectGroupId = null;
+ $objectGroupOrder = null;
+ $objectGroupTitle = null;
$this->repository->setUser($bill->user);
/** @var null|ObjectGroup $objectGroup */
- $objectGroup = $bill->objectGroups->first();
+ $objectGroup = $bill->objectGroups->first();
if (null !== $objectGroup) {
$objectGroupId = $objectGroup->id;
$objectGroupOrder = $objectGroup->order;
@@ -81,7 +81,7 @@ class BillTransformer extends AbstractTransformer
$paidDataFormatted = [];
$payDatesFormatted = [];
foreach ($paidData as $object) {
- $date = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'));
+ $date = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'));
if (false === $date) {
$date = today(config('app.timezone'));
}
@@ -90,24 +90,24 @@ class BillTransformer extends AbstractTransformer
}
foreach ($payDates as $string) {
- $date = Carbon::createFromFormat('!Y-m-d', $string, config('app.timezone'));
+ $date = Carbon::createFromFormat('!Y-m-d', $string, config('app.timezone'));
if (false === $date) {
$date = today(config('app.timezone'));
}
$payDatesFormatted[] = $date->toAtomString();
}
// next expected match
- $nem = null;
- $nemDate = null;
- $nemDiff = trans('firefly.not_expected_period');
- $firstPayDate = $payDates[0] ?? null;
+ $nem = null;
+ $nemDate = null;
+ $nemDiff = trans('firefly.not_expected_period');
+ $firstPayDate = $payDates[0] ?? null;
if (null !== $firstPayDate) {
$nemDate = Carbon::createFromFormat('!Y-m-d', $firstPayDate, config('app.timezone'));
if (false === $nemDate) {
$nemDate = today(config('app.timezone'));
}
- $nem = $nemDate->toAtomString();
+ $nem = $nemDate->toAtomString();
// nullify again when it's outside the current view range.
if ($nemDate->lt($this->parameters->get('start')) || $nemDate->gt($this->parameters->get('end'))) {
@@ -125,7 +125,7 @@ class BillTransformer extends AbstractTransformer
$current = $payDatesFormatted[0] ?? null;
if (null !== $current && !$nemDate->isToday()) {
- $temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
+ $temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
if (false === $temp2) {
$temp2 = today(config('app.timezone'));
}
@@ -187,15 +187,15 @@ class BillTransformer extends AbstractTransformer
// 2023-07-18 this particular date is used to search for the last paid date.
// 2023-07-18 the cloned $searchDate is used to grab the correct transactions.
/** @var Carbon $start */
- $start = clone $this->parameters->get('start');
- $searchStart = clone $start;
+ $start = clone $this->parameters->get('start');
+ $searchStart = clone $start;
$start->subDay();
app('log')->debug(sprintf('Parameters are start: %s end: %s', $start->format('Y-m-d'), $this->parameters->get('end')->format('Y-m-d')));
app('log')->debug(sprintf('Search parameters are: start: %s', $searchStart->format('Y-m-d')));
// Get from database when bill was paid.
- $set = $this->repository->getPaidDatesInRange($bill, $searchStart, $this->parameters->get('end'));
+ $set = $this->repository->getPaidDatesInRange($bill, $searchStart, $this->parameters->get('end'));
app('log')->debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));
// Grab from array the most recent payment. If none exist, fall back to the start date and pretend *that* was the last paid date.
@@ -204,7 +204,7 @@ class BillTransformer extends AbstractTransformer
app('log')->debug(sprintf('Result of lastPaidDate is %s', $lastPaidDate->format('Y-m-d')));
// At this point the "next match" is exactly after the last time the bill was paid.
- $result = [];
+ $result = [];
foreach ($set as $entry) {
$result[] = [
'transaction_group_id' => (string) $entry->transaction_group_id,
diff --git a/app/Transformers/BudgetLimitTransformer.php b/app/Transformers/BudgetLimitTransformer.php
index cc9fcd5b6a..d2a3e19dee 100644
--- a/app/Transformers/BudgetLimitTransformer.php
+++ b/app/Transformers/BudgetLimitTransformer.php
@@ -53,7 +53,7 @@ class BudgetLimitTransformer extends AbstractTransformer
*/
public function transform(BudgetLimit $budgetLimit): array
{
- $repository = app(OperationsRepository::class);
+ $repository = app(OperationsRepository::class);
$repository->setUser($budgetLimit->budget->user);
$expenses = $repository->sumExpenses(
$budgetLimit->start_date,
@@ -77,7 +77,7 @@ class BudgetLimitTransformer extends AbstractTransformer
$currencySymbol = $currency->symbol;
$currencyDecimalPlaces = $currency->decimal_places;
}
- $amount = app('steam')->bcround($amount, $currencyDecimalPlaces);
+ $amount = app('steam')->bcround($amount, $currencyDecimalPlaces);
return [
'id' => (string)$budgetLimit->id,
diff --git a/app/Transformers/BudgetTransformer.php b/app/Transformers/BudgetTransformer.php
index 44ef5c1870..a786e7c327 100644
--- a/app/Transformers/BudgetTransformer.php
+++ b/app/Transformers/BudgetTransformer.php
@@ -54,10 +54,10 @@ class BudgetTransformer extends AbstractTransformer
public function transform(Budget $budget): array
{
$this->opsRepository->setUser($budget->user);
- $start = $this->parameters->get('start');
- $end = $this->parameters->get('end');
- $autoBudget = $this->repository->getAutoBudget($budget);
- $spent = [];
+ $start = $this->parameters->get('start');
+ $end = $this->parameters->get('end');
+ $autoBudget = $this->repository->getAutoBudget($budget);
+ $spent = [];
if (null !== $start && null !== $end) {
$spent = $this->beautify($this->opsRepository->sumExpenses($start, $end, null, new Collection([$budget])));
}
@@ -69,7 +69,7 @@ class BudgetTransformer extends AbstractTransformer
$abPeriod = null;
$notes = $this->repository->getNoteText($budget);
- $types = [
+ $types = [
AutoBudget::AUTO_BUDGET_RESET => 'reset',
AutoBudget::AUTO_BUDGET_ROLLOVER => 'rollover',
AutoBudget::AUTO_BUDGET_ADJUSTED => 'adjusted',
diff --git a/app/Transformers/CategoryTransformer.php b/app/Transformers/CategoryTransformer.php
index 9404739e18..21b4756f5d 100644
--- a/app/Transformers/CategoryTransformer.php
+++ b/app/Transformers/CategoryTransformer.php
@@ -61,7 +61,7 @@ class CategoryTransformer extends AbstractTransformer
$earned = $this->beautify($this->opsRepository->sumIncome($start, $end, null, new Collection([$category])));
$spent = $this->beautify($this->opsRepository->sumExpenses($start, $end, null, new Collection([$category])));
}
- $notes = $this->repository->getNoteText($category);
+ $notes = $this->repository->getNoteText($category);
return [
'id' => $category->id,
diff --git a/app/Transformers/PiggyBankEventTransformer.php b/app/Transformers/PiggyBankEventTransformer.php
index 44b07527c9..aac61a2d09 100644
--- a/app/Transformers/PiggyBankEventTransformer.php
+++ b/app/Transformers/PiggyBankEventTransformer.php
@@ -53,14 +53,14 @@ class PiggyBankEventTransformer extends AbstractTransformer
public function transform(PiggyBankEvent $event): array
{
// get account linked to piggy bank
- $account = $event->piggyBank->account;
+ $account = $event->piggyBank->account;
// set up repositories.
$this->repository->setUser($account->user);
$this->piggyRepos->setUser($account->user);
// get associated currency or fall back to the default:
- $currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
+ $currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
// get associated journal and transaction, if any:
$journalId = $event->transaction_journal_id;
diff --git a/app/Transformers/PiggyBankTransformer.php b/app/Transformers/PiggyBankTransformer.php
index 7576128a3d..fea26e16c5 100644
--- a/app/Transformers/PiggyBankTransformer.php
+++ b/app/Transformers/PiggyBankTransformer.php
@@ -53,25 +53,25 @@ class PiggyBankTransformer extends AbstractTransformer
*/
public function transform(PiggyBank $piggyBank): array
{
- $account = $piggyBank->account;
+ $account = $piggyBank->account;
// set up repositories
$this->accountRepos->setUser($account->user);
$this->piggyRepos->setUser($account->user);
// get currency from account, or use default.
- $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
+ $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup);
// note
- $notes = $this->piggyRepos->getNoteText($piggyBank);
- $notes = '' === $notes ? null : $notes;
+ $notes = $this->piggyRepos->getNoteText($piggyBank);
+ $notes = '' === $notes ? null : $notes;
$objectGroupId = null;
$objectGroupOrder = null;
$objectGroupTitle = null;
/** @var null|ObjectGroup $objectGroup */
- $objectGroup = $piggyBank->objectGroups->first();
+ $objectGroup = $piggyBank->objectGroups->first();
if (null !== $objectGroup) {
$objectGroupId = $objectGroup->id;
$objectGroupOrder = $objectGroup->order;
@@ -79,13 +79,13 @@ class PiggyBankTransformer extends AbstractTransformer
}
// get currently saved amount:
- $currentAmount = app('steam')->bcround($this->piggyRepos->getCurrentAmount($piggyBank), $currency->decimal_places);
+ $currentAmount = app('steam')->bcround($this->piggyRepos->getCurrentAmount($piggyBank), $currency->decimal_places);
// Amounts, depending on 0.0 state of target amount
- $percentage = null;
- $targetAmount = $piggyBank->targetamount;
- $leftToSave = null;
- $savePerMonth = null;
+ $percentage = null;
+ $targetAmount = $piggyBank->targetamount;
+ $leftToSave = null;
+ $savePerMonth = null;
if (0 !== bccomp($targetAmount, '0')) { // target amount is not 0.00
$leftToSave = bcsub($piggyBank->targetamount, $currentAmount);
$percentage = (int)bcmul(bcdiv($currentAmount, $targetAmount), '100');
@@ -93,8 +93,8 @@ class PiggyBankTransformer extends AbstractTransformer
$leftToSave = app('steam')->bcround($leftToSave, $currency->decimal_places);
$savePerMonth = app('steam')->bcround($this->piggyRepos->getSuggestedMonthlyAmount($piggyBank), $currency->decimal_places);
}
- $startDate = $piggyBank->startdate?->format('Y-m-d');
- $targetDate = $piggyBank->targetdate?->format('Y-m-d');
+ $startDate = $piggyBank->startdate?->format('Y-m-d');
+ $targetDate = $piggyBank->targetdate?->format('Y-m-d');
return [
'id' => (string)$piggyBank->id,
diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php
index 622dc8ab4a..efff57080c 100644
--- a/app/Transformers/RecurrenceTransformer.php
+++ b/app/Transformers/RecurrenceTransformer.php
@@ -128,14 +128,14 @@ class RecurrenceTransformer extends AbstractTransformer
];
// get the (future) occurrences for this specific type of repetition:
- $occurrences = $this->repository->getXOccurrencesSince($repetition, $fromDate, new Carbon(), 5);
+ $occurrences = $this->repository->getXOccurrencesSince($repetition, $fromDate, new Carbon(), 5);
/** @var Carbon $carbon */
foreach ($occurrences as $carbon) {
$repetitionArray['occurrences'][] = $carbon->toAtomString();
}
- $return[] = $repetitionArray;
+ $return[] = $repetitionArray;
}
return $return;
@@ -153,7 +153,7 @@ class RecurrenceTransformer extends AbstractTransformer
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions()->get() as $transaction) {
/** @var null|Account $sourceAccount */
- $sourceAccount = $transaction->sourceAccount;
+ $sourceAccount = $transaction->sourceAccount;
/** @var null|Account $destinationAccount */
$destinationAccount = $transaction->destinationAccount;
@@ -169,32 +169,32 @@ class RecurrenceTransformer extends AbstractTransformer
}
// source info:
- $sourceName = '';
- $sourceId = null;
- $sourceType = null;
- $sourceIban = null;
+ $sourceName = '';
+ $sourceId = null;
+ $sourceType = null;
+ $sourceIban = null;
if (null !== $sourceAccount) {
$sourceName = $sourceAccount->name;
$sourceId = $sourceAccount->id;
$sourceType = $sourceAccount->accountType->type;
$sourceIban = $sourceAccount->iban;
}
- $destinationName = '';
- $destinationId = null;
- $destinationType = null;
- $destinationIban = null;
+ $destinationName = '';
+ $destinationId = null;
+ $destinationType = null;
+ $destinationIban = null;
if (null !== $destinationAccount) {
$destinationName = $destinationAccount->name;
$destinationId = $destinationAccount->id;
$destinationType = $destinationAccount->accountType->type;
$destinationIban = $destinationAccount->iban;
}
- $amount = app('steam')->bcround($transaction->amount, $transaction->transactionCurrency->decimal_places);
- $foreignAmount = null;
+ $amount = app('steam')->bcround($transaction->amount, $transaction->transactionCurrency->decimal_places);
+ $foreignAmount = null;
if (null !== $transaction->foreign_currency_id && null !== $transaction->foreign_amount) {
$foreignAmount = app('steam')->bcround($transaction->foreign_amount, $foreignCurrencyDp);
}
- $transactionArray = [
+ $transactionArray = [
'id' => (string)$transaction->id,
'currency_id' => (string)$transaction->transaction_currency_id,
'currency_code' => $transaction->transactionCurrency->code,
@@ -216,7 +216,7 @@ class RecurrenceTransformer extends AbstractTransformer
'foreign_amount' => $foreignAmount,
'description' => $transaction->description,
];
- $transactionArray = $this->getTransactionMeta($transaction, $transactionArray);
+ $transactionArray = $this->getTransactionMeta($transaction, $transactionArray);
if (null !== $transaction->foreign_currency_id) {
$transactionArray['foreign_currency_code'] = $transaction->foreignCurrency->code;
$transactionArray['foreign_currency_symbol'] = $transaction->foreignCurrency->symbol;
@@ -224,7 +224,7 @@ class RecurrenceTransformer extends AbstractTransformer
}
// store transaction in recurrence array.
- $return[] = $transactionArray;
+ $return[] = $transactionArray;
}
return $return;
@@ -253,7 +253,7 @@ class RecurrenceTransformer extends AbstractTransformer
throw new FireflyException(sprintf('Recurrence transformer cant handle field "%s"', $transactionMeta->name));
case 'bill_id':
- $bill = $this->billRepos->find((int)$transactionMeta->value);
+ $bill = $this->billRepos->find((int)$transactionMeta->value);
if (null !== $bill) {
$array['bill_id'] = (string)$bill->id;
$array['bill_name'] = $bill->name;
@@ -267,7 +267,7 @@ class RecurrenceTransformer extends AbstractTransformer
break;
case 'piggy_bank_id':
- $piggy = $this->piggyRepos->find((int)$transactionMeta->value);
+ $piggy = $this->piggyRepos->find((int)$transactionMeta->value);
if (null !== $piggy) {
$array['piggy_bank_id'] = (string)$piggy->id;
$array['piggy_bank_name'] = $piggy->name;
@@ -276,7 +276,7 @@ class RecurrenceTransformer extends AbstractTransformer
break;
case 'category_id':
- $category = $this->factory->findOrCreate((int)$transactionMeta->value, null);
+ $category = $this->factory->findOrCreate((int)$transactionMeta->value, null);
if (null !== $category) {
$array['category_id'] = (string)$category->id;
$array['category_name'] = $category->name;
@@ -285,7 +285,7 @@ class RecurrenceTransformer extends AbstractTransformer
break;
case 'category_name':
- $category = $this->factory->findOrCreate(null, $transactionMeta->value);
+ $category = $this->factory->findOrCreate(null, $transactionMeta->value);
if (null !== $category) {
$array['category_id'] = (string)$category->id;
$array['category_name'] = $category->name;
@@ -294,7 +294,7 @@ class RecurrenceTransformer extends AbstractTransformer
break;
case 'budget_id':
- $budget = $this->budgetRepos->find((int)$transactionMeta->value);
+ $budget = $this->budgetRepos->find((int)$transactionMeta->value);
if (null !== $budget) {
$array['budget_id'] = (string)$budget->id;
$array['budget_name'] = $budget->name;
diff --git a/app/Transformers/TagTransformer.php b/app/Transformers/TagTransformer.php
index cfd1f2ccb6..6cc5e8b0a0 100644
--- a/app/Transformers/TagTransformer.php
+++ b/app/Transformers/TagTransformer.php
@@ -38,7 +38,7 @@ class TagTransformer extends AbstractTransformer
*/
public function transform(Tag $tag): array
{
- $date = $tag->date?->format('Y-m-d');
+ $date = $tag->date?->format('Y-m-d');
/** @var null|Location $location */
$location = $tag->locations()->first();
diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.php
index 598883dd54..dc3ef19c92 100644
--- a/app/Transformers/TransactionGroupTransformer.php
+++ b/app/Transformers/TransactionGroupTransformer.php
@@ -143,7 +143,7 @@ class TransactionGroupTransformer extends AbstractTransformer
*/
private function transformTransaction(array $transaction): array
{
- $row = new NullArrayObject($transaction);
+ $row = new NullArrayObject($transaction);
// amount:
$amount = app('steam')->positive((string) ($row['amount'] ?? '0'));
@@ -156,10 +156,10 @@ class TransactionGroupTransformer extends AbstractTransformer
$metaDateData = $this->groupRepos->getMetaDateFields((int) $row['transaction_journal_id'], $this->metaDateFields);
$type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionType::WITHDRAWAL);
- $longitude = null;
- $latitude = null;
- $zoomLevel = null;
- $location = $this->getLocationById((int) $row['transaction_journal_id']);
+ $longitude = null;
+ $latitude = null;
+ $zoomLevel = null;
+ $location = $this->getLocationById((int) $row['transaction_journal_id']);
if (null !== $location) {
$longitude = $location->longitude;
$latitude = $location->latitude;
@@ -167,83 +167,83 @@ class TransactionGroupTransformer extends AbstractTransformer
}
return [
- 'user' => (string) $row['user_id'],
- 'transaction_journal_id' => (string) $row['transaction_journal_id'],
- 'type' => strtolower($type),
- 'date' => $row['date']->toAtomString(),
- 'order' => $row['order'],
+ 'user' => (string) $row['user_id'],
+ 'transaction_journal_id' => (string) $row['transaction_journal_id'],
+ 'type' => strtolower($type),
+ 'date' => $row['date']->toAtomString(),
+ 'order' => $row['order'],
- 'currency_id' => (string) $row['currency_id'],
- 'currency_code' => $row['currency_code'],
- 'currency_name' => $row['currency_name'],
- 'currency_symbol' => $row['currency_symbol'],
- 'currency_decimal_places' => (int) $row['currency_decimal_places'],
+ 'currency_id' => (string) $row['currency_id'],
+ 'currency_code' => $row['currency_code'],
+ 'currency_name' => $row['currency_name'],
+ 'currency_symbol' => $row['currency_symbol'],
+ 'currency_decimal_places' => (int) $row['currency_decimal_places'],
'foreign_currency_id' => $this->stringFromArray($transaction, 'foreign_currency_id', null),
'foreign_currency_code' => $row['foreign_currency_code'],
'foreign_currency_symbol' => $row['foreign_currency_symbol'],
'foreign_currency_decimal_places' => $row['foreign_currency_decimal_places'],
- 'amount' => $amount,
- 'foreign_amount' => $foreignAmount,
+ 'amount' => $amount,
+ 'foreign_amount' => $foreignAmount,
- 'description' => $row['description'],
+ 'description' => $row['description'],
- 'source_id' => (string) $row['source_account_id'],
- 'source_name' => $row['source_account_name'],
- 'source_iban' => $row['source_account_iban'],
- 'source_type' => $row['source_account_type'],
+ 'source_id' => (string) $row['source_account_id'],
+ 'source_name' => $row['source_account_name'],
+ 'source_iban' => $row['source_account_iban'],
+ 'source_type' => $row['source_account_type'],
- 'destination_id' => (string) $row['destination_account_id'],
- 'destination_name' => $row['destination_account_name'],
- 'destination_iban' => $row['destination_account_iban'],
- 'destination_type' => $row['destination_account_type'],
+ 'destination_id' => (string) $row['destination_account_id'],
+ 'destination_name' => $row['destination_account_name'],
+ 'destination_iban' => $row['destination_account_iban'],
+ 'destination_type' => $row['destination_account_type'],
- 'budget_id' => $this->stringFromArray($transaction, 'budget_id', null),
- 'budget_name' => $row['budget_name'],
+ 'budget_id' => $this->stringFromArray($transaction, 'budget_id', null),
+ 'budget_name' => $row['budget_name'],
- 'category_id' => $this->stringFromArray($transaction, 'category_id', null),
- 'category_name' => $row['category_name'],
+ 'category_id' => $this->stringFromArray($transaction, 'category_id', null),
+ 'category_name' => $row['category_name'],
- 'bill_id' => $this->stringFromArray($transaction, 'bill_id', null),
- 'bill_name' => $row['bill_name'],
+ 'bill_id' => $this->stringFromArray($transaction, 'bill_id', null),
+ 'bill_name' => $row['bill_name'],
- 'reconciled' => $row['reconciled'],
- 'notes' => $this->groupRepos->getNoteText((int) $row['transaction_journal_id']),
- 'tags' => $this->groupRepos->getTags((int) $row['transaction_journal_id']),
+ 'reconciled' => $row['reconciled'],
+ 'notes' => $this->groupRepos->getNoteText((int) $row['transaction_journal_id']),
+ 'tags' => $this->groupRepos->getTags((int) $row['transaction_journal_id']),
- 'internal_reference' => $metaFieldData['internal_reference'],
- 'external_id' => $metaFieldData['external_id'],
- 'original_source' => $metaFieldData['original_source'],
- 'recurrence_id' => $this->stringFromArray($metaFieldData->getArrayCopy(), 'recurrence_id', null),
- 'recurrence_total' => $this->integerFromArray($metaFieldData->getArrayCopy(), 'recurrence_total'),
- 'recurrence_count' => $this->integerFromArray($metaFieldData->getArrayCopy(), 'recurrence_count'),
- 'bunq_payment_id' => $metaFieldData['bunq_payment_id'],
- 'external_url' => $metaFieldData['external_url'],
- 'import_hash_v2' => $metaFieldData['import_hash_v2'],
+ 'internal_reference' => $metaFieldData['internal_reference'],
+ 'external_id' => $metaFieldData['external_id'],
+ 'original_source' => $metaFieldData['original_source'],
+ 'recurrence_id' => $this->stringFromArray($metaFieldData->getArrayCopy(), 'recurrence_id', null),
+ 'recurrence_total' => $this->integerFromArray($metaFieldData->getArrayCopy(), 'recurrence_total'),
+ 'recurrence_count' => $this->integerFromArray($metaFieldData->getArrayCopy(), 'recurrence_count'),
+ 'bunq_payment_id' => $metaFieldData['bunq_payment_id'],
+ 'external_url' => $metaFieldData['external_url'],
+ 'import_hash_v2' => $metaFieldData['import_hash_v2'],
- 'sepa_cc' => $metaFieldData['sepa_cc'],
- 'sepa_ct_op' => $metaFieldData['sepa_ct_op'],
- 'sepa_ct_id' => $metaFieldData['sepa_ct_id'],
- 'sepa_db' => $metaFieldData['sepa_db'],
- 'sepa_country' => $metaFieldData['sepa_country'],
- 'sepa_ep' => $metaFieldData['sepa_ep'],
- 'sepa_ci' => $metaFieldData['sepa_ci'],
- 'sepa_batch_id' => $metaFieldData['sepa_batch_id'],
+ 'sepa_cc' => $metaFieldData['sepa_cc'],
+ 'sepa_ct_op' => $metaFieldData['sepa_ct_op'],
+ 'sepa_ct_id' => $metaFieldData['sepa_ct_id'],
+ 'sepa_db' => $metaFieldData['sepa_db'],
+ 'sepa_country' => $metaFieldData['sepa_country'],
+ 'sepa_ep' => $metaFieldData['sepa_ep'],
+ 'sepa_ci' => $metaFieldData['sepa_ci'],
+ 'sepa_batch_id' => $metaFieldData['sepa_batch_id'],
- 'interest_date' => $this->dateFromArray($metaDateData, 'interest_date'),
- 'book_date' => $this->dateFromArray($metaDateData, 'book_date'),
- 'process_date' => $this->dateFromArray($metaDateData, 'process_date'),
- 'due_date' => $this->dateFromArray($metaDateData, 'due_date'),
- 'payment_date' => $this->dateFromArray($metaDateData, 'payment_date'),
- 'invoice_date' => $this->dateFromArray($metaDateData, 'invoice_date'),
+ 'interest_date' => $this->dateFromArray($metaDateData, 'interest_date'),
+ 'book_date' => $this->dateFromArray($metaDateData, 'book_date'),
+ 'process_date' => $this->dateFromArray($metaDateData, 'process_date'),
+ 'due_date' => $this->dateFromArray($metaDateData, 'due_date'),
+ 'payment_date' => $this->dateFromArray($metaDateData, 'payment_date'),
+ 'invoice_date' => $this->dateFromArray($metaDateData, 'invoice_date'),
// location data
- 'longitude' => $longitude,
- 'latitude' => $latitude,
- 'zoom_level' => $zoomLevel,
+ 'longitude' => $longitude,
+ 'latitude' => $latitude,
+ 'zoom_level' => $zoomLevel,
- 'has_attachments' => $this->hasAttachments((int) $row['transaction_journal_id']),
+ 'has_attachments' => $this->hasAttachments((int) $row['transaction_journal_id']),
];
}
@@ -342,10 +342,10 @@ class TransactionGroupTransformer extends AbstractTransformer
$foreignAmount = app('steam')->bcround($foreignAmount, $foreignCurrency['decimal_places'] ?? 0);
}
- $longitude = null;
- $latitude = null;
- $zoomLevel = null;
- $location = $this->getLocation($journal);
+ $longitude = null;
+ $latitude = null;
+ $zoomLevel = null;
+ $location = $this->getLocation($journal);
if (null !== $location) {
$longitude = $location->longitude;
$latitude = $location->latitude;
@@ -353,77 +353,77 @@ class TransactionGroupTransformer extends AbstractTransformer
}
return [
- 'user' => $journal->user_id,
- 'transaction_journal_id' => $journal->id,
- 'type' => strtolower($type),
- 'date' => $journal->date->toAtomString(),
- 'order' => $journal->order,
+ 'user' => $journal->user_id,
+ 'transaction_journal_id' => $journal->id,
+ 'type' => strtolower($type),
+ 'date' => $journal->date->toAtomString(),
+ 'order' => $journal->order,
- 'currency_id' => $currency->id,
- 'currency_code' => $currency->code,
- 'currency_symbol' => $currency->symbol,
- 'currency_decimal_places' => $currency->decimal_places,
+ 'currency_id' => $currency->id,
+ 'currency_code' => $currency->code,
+ 'currency_symbol' => $currency->symbol,
+ 'currency_decimal_places' => $currency->decimal_places,
'foreign_currency_id' => $foreignCurrency['id'],
'foreign_currency_code' => $foreignCurrency['code'],
'foreign_currency_symbol' => $foreignCurrency['symbol'],
'foreign_currency_decimal_places' => $foreignCurrency['decimal_places'],
- 'amount' => app('steam')->bcround($amount, $currency->decimal_places),
- 'foreign_amount' => $foreignAmount,
+ 'amount' => app('steam')->bcround($amount, $currency->decimal_places),
+ 'foreign_amount' => $foreignAmount,
- 'description' => $journal->description,
+ 'description' => $journal->description,
- 'source_id' => $source->account_id,
- 'source_name' => $source->account->name,
- 'source_iban' => $source->account->iban,
- 'source_type' => $source->account->accountType->type,
+ 'source_id' => $source->account_id,
+ 'source_name' => $source->account->name,
+ 'source_iban' => $source->account->iban,
+ 'source_type' => $source->account->accountType->type,
- 'destination_id' => $destination->account_id,
- 'destination_name' => $destination->account->name,
- 'destination_iban' => $destination->account->iban,
- 'destination_type' => $destination->account->accountType->type,
+ 'destination_id' => $destination->account_id,
+ 'destination_name' => $destination->account->name,
+ 'destination_iban' => $destination->account->iban,
+ 'destination_type' => $destination->account->accountType->type,
- 'budget_id' => $budget['id'],
- 'budget_name' => $budget['name'],
+ 'budget_id' => $budget['id'],
+ 'budget_name' => $budget['name'],
- 'category_id' => $category['id'],
- 'category_name' => $category['name'],
+ 'category_id' => $category['id'],
+ 'category_name' => $category['name'],
- 'bill_id' => $bill['id'],
- 'bill_name' => $bill['name'],
+ 'bill_id' => $bill['id'],
+ 'bill_name' => $bill['name'],
- 'reconciled' => $source->reconciled,
- 'notes' => $this->groupRepos->getNoteText($journal->id),
- 'tags' => $this->groupRepos->getTags($journal->id),
+ 'reconciled' => $source->reconciled,
+ 'notes' => $this->groupRepos->getNoteText($journal->id),
+ 'tags' => $this->groupRepos->getTags($journal->id),
- 'internal_reference' => $metaFieldData['internal_reference'],
- 'external_id' => $metaFieldData['external_id'],
- 'original_source' => $metaFieldData['original_source'],
- 'recurrence_id' => $metaFieldData['recurrence_id'],
- 'bunq_payment_id' => $metaFieldData['bunq_payment_id'],
- 'import_hash_v2' => $metaFieldData['import_hash_v2'],
+ 'internal_reference' => $metaFieldData['internal_reference'],
+ 'external_id' => $metaFieldData['external_id'],
+ 'original_source' => $metaFieldData['original_source'],
+ 'recurrence_id' => $metaFieldData['recurrence_id'],
+ 'bunq_payment_id' => $metaFieldData['bunq_payment_id'],
+ 'import_hash_v2' => $metaFieldData['import_hash_v2'],
- 'sepa_cc' => $metaFieldData['sepa_cc'],
- 'sepa_ct_op' => $metaFieldData['sepa_ct_op'],
- 'sepa_ct_id' => $metaFieldData['sepa_ct_id'],
- 'sepa_db' => $metaFieldData['sepa_db'],
- 'sepa_country' => $metaFieldData['sepa_country'],
- 'sepa_ep' => $metaFieldData['sepa_ep'],
- 'sepa_ci' => $metaFieldData['sepa_ci'],
- 'sepa_batch_id' => $metaFieldData['sepa_batch_id'],
+ 'sepa_cc' => $metaFieldData['sepa_cc'],
+ 'sepa_ct_op' => $metaFieldData['sepa_ct_op'],
+ 'sepa_ct_id' => $metaFieldData['sepa_ct_id'],
+ 'sepa_db' => $metaFieldData['sepa_db'],
+ 'sepa_country' => $metaFieldData['sepa_country'],
+ 'sepa_ep' => $metaFieldData['sepa_ep'],
+ 'sepa_ci' => $metaFieldData['sepa_ci'],
+ 'sepa_batch_id' => $metaFieldData['sepa_batch_id'],
- 'interest_date' => $metaDates['interest_date'],
- 'book_date' => $metaDates['book_date'],
- 'process_date' => $metaDates['process_date'],
- 'due_date' => $metaDates['due_date'],
- 'payment_date' => $metaDates['payment_date'],
- 'invoice_date' => $metaDates['invoice_date'],
+ 'interest_date' => $metaDates['interest_date'],
+ 'book_date' => $metaDates['book_date'],
+ 'process_date' => $metaDates['process_date'],
+ 'due_date' => $metaDates['due_date'],
+ 'payment_date' => $metaDates['payment_date'],
+ 'invoice_date' => $metaDates['invoice_date'],
// location data
- 'longitude' => $longitude,
- 'latitude' => $latitude,
- 'zoom_level' => $zoomLevel,
+ 'longitude' => $longitude,
+ 'latitude' => $latitude,
+ 'zoom_level' => $zoomLevel,
];
}
@@ -499,7 +499,7 @@ class TransactionGroupTransformer extends AbstractTransformer
private function getForeignCurrency(?TransactionCurrency $currency): array
{
- $array = [
+ $array = [
'id' => null,
'code' => null,
'symbol' => null,
@@ -518,7 +518,7 @@ class TransactionGroupTransformer extends AbstractTransformer
private function getBudget(?Budget $budget): array
{
- $array = [
+ $array = [
'id' => null,
'name' => null,
];
@@ -533,7 +533,7 @@ class TransactionGroupTransformer extends AbstractTransformer
private function getCategory(?Category $category): array
{
- $array = [
+ $array = [
'id' => null,
'name' => null,
];
@@ -548,7 +548,7 @@ class TransactionGroupTransformer extends AbstractTransformer
private function getBill(?Bill $bill): array
{
- $array = [
+ $array = [
'id' => null,
'name' => null,
];
diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php
index 36c9cc31ee..67cf47ffb6 100644
--- a/app/Transformers/V2/AccountTransformer.php
+++ b/app/Transformers/V2/AccountTransformer.php
@@ -57,18 +57,18 @@ class AccountTransformer extends AbstractTransformer
$this->convertedBalances = app('steam')->balancesByAccountsConverted($objects, $this->getDate());
/** @var CurrencyRepositoryInterface $repository */
- $repository = app(CurrencyRepositoryInterface::class);
- $this->default = app('amount')->getDefaultCurrency();
+ $repository = app(CurrencyRepositoryInterface::class);
+ $this->default = app('amount')->getDefaultCurrency();
// get currencies:
- $accountIds = $objects->pluck('id')->toArray();
- $meta = AccountMeta::whereIn('account_id', $accountIds)
+ $accountIds = $objects->pluck('id')->toArray();
+ $meta = AccountMeta::whereIn('account_id', $accountIds)
->where('name', 'currency_id')
->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data'])
;
- $currencyIds = $meta->pluck('data')->toArray();
+ $currencyIds = $meta->pluck('data')->toArray();
- $currencies = $repository->getByIds($currencyIds);
+ $currencies = $repository->getByIds($currencyIds);
foreach ($currencies as $currency) {
$id = $currency->id;
$this->currencies[$id] = $currency;
@@ -79,7 +79,7 @@ class AccountTransformer extends AbstractTransformer
}
// get account types:
// select accounts.id, account_types.type from account_types left join accounts on accounts.account_type_id = account_types.id;
- $accountTypes = AccountType::leftJoin('accounts', 'accounts.account_type_id', '=', 'account_types.id')
+ $accountTypes = AccountType::leftJoin('accounts', 'accounts.account_type_id', '=', 'account_types.id')
->whereIn('accounts.id', $accountIds)
->get(['accounts.id', 'account_types.type'])
;
@@ -95,15 +95,15 @@ class AccountTransformer extends AbstractTransformer
*/
public function transform(Account $account): array
{
- $id = $account->id;
+ $id = $account->id;
// various meta
- $accountRole = $this->accountMeta[$id]['account_role'] ?? null;
- $accountType = $this->accountTypes[$id];
- $order = $account->order;
+ $accountRole = $this->accountMeta[$id]['account_role'] ?? null;
+ $accountType = $this->accountTypes[$id];
+ $order = $account->order;
// no currency? use default
- $currency = $this->default;
+ $currency = $this->default;
if (0 !== (int)$this->accountMeta[$id]['currency_id']) {
$currency = $this->currencies[(int)$this->accountMeta[$id]['currency_id']];
}
@@ -117,19 +117,19 @@ class AccountTransformer extends AbstractTransformer
}
return [
- 'id' => (string)$account->id,
- 'created_at' => $account->created_at->toAtomString(),
- 'updated_at' => $account->updated_at->toAtomString(),
- 'active' => $account->active,
- 'order' => $order,
- 'name' => $account->name,
- 'iban' => '' === $account->iban ? null : $account->iban,
- 'type' => strtolower($accountType),
- 'account_role' => $accountRole,
- 'currency_id' => (string)$currency->id,
- 'currency_code' => $currency->code,
- 'currency_symbol' => $currency->symbol,
- 'currency_decimal_places' => $currency->decimal_places,
+ 'id' => (string)$account->id,
+ 'created_at' => $account->created_at->toAtomString(),
+ 'updated_at' => $account->updated_at->toAtomString(),
+ 'active' => $account->active,
+ 'order' => $order,
+ 'name' => $account->name,
+ 'iban' => '' === $account->iban ? null : $account->iban,
+ 'type' => strtolower($accountType),
+ 'account_role' => $accountRole,
+ 'currency_id' => (string)$currency->id,
+ 'currency_code' => $currency->code,
+ 'currency_symbol' => $currency->symbol,
+ 'currency_decimal_places' => $currency->decimal_places,
'native_currency_id' => (string)$this->default->id,
'native_currency_code' => $this->default->code,
diff --git a/app/Transformers/V2/BillTransformer.php b/app/Transformers/V2/BillTransformer.php
index f90961c5aa..170dfb84bc 100644
--- a/app/Transformers/V2/BillTransformer.php
+++ b/app/Transformers/V2/BillTransformer.php
@@ -56,16 +56,16 @@ class BillTransformer extends AbstractTransformer
*/
public function collectMetaData(Collection $objects): void
{
- $currencies = [];
- $bills = [];
- $this->notes = [];
- $this->groups = [];
- $this->paidDates = [];
+ $currencies = [];
+ $bills = [];
+ $this->notes = [];
+ $this->groups = [];
+ $this->paidDates = [];
/** @var Bill $object */
foreach ($objects as $object) {
- $id = $object->transaction_currency_id;
- $bills[] = $object->id;
+ $id = $object->transaction_currency_id;
+ $bills[] = $object->id;
$currencies[$id] ??= TransactionCurrency::find($id);
}
$this->currencies = $currencies;
@@ -77,7 +77,7 @@ class BillTransformer extends AbstractTransformer
$this->notes[$id] = $note;
}
// grab object groups:
- $set = DB::table('object_groupables')
+ $set = DB::table('object_groupables')
->leftJoin('object_groups', 'object_groups.id', '=', 'object_groupables.object_group_id')
->where('object_groupables.object_groupable_type', Bill::class)
->get(['object_groupables.*', 'object_groups.title', 'object_groups.order'])
@@ -95,17 +95,17 @@ class BillTransformer extends AbstractTransformer
];
}
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
- $this->default = app('amount')->getDefaultCurrency();
- $this->converter = new ExchangeRateConverter();
+ $this->default = app('amount')->getDefaultCurrency();
+ $this->converter = new ExchangeRateConverter();
// grab all paid dates:
if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
- $journals = TransactionJournal::whereIn('bill_id', $bills)
+ $journals = TransactionJournal::whereIn('bill_id', $bills)
->where('date', '>=', $this->parameters->get('start'))
->where('date', '<=', $this->parameters->get('end'))
->get(['transaction_journals.id', 'transaction_journals.transaction_group_id', 'transaction_journals.date', 'transaction_journals.bill_id'])
;
- $journalIds = $journals->pluck('id')->toArray();
+ $journalIds = $journals->pluck('id')->toArray();
// grab transactions for amount:
$set = Transaction::whereIn('transaction_journal_id', $journalIds)
@@ -123,26 +123,26 @@ class BillTransformer extends AbstractTransformer
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
app('log')->debug(sprintf('Processing journal #%d', $journal->id));
- $transaction = $transactions[$journal->id] ?? [];
- $billId = (int) $journal->bill_id;
- $currencyId = (int) ($transaction['transaction_currency_id'] ?? 0);
+ $transaction = $transactions[$journal->id] ?? [];
+ $billId = (int) $journal->bill_id;
+ $currencyId = (int) ($transaction['transaction_currency_id'] ?? 0);
$currencies[$currencyId] ??= TransactionCurrency::find($currencyId);
// foreign currency
- $foreignCurrencyId = null;
- $foreignCurrencyCode = null;
- $foreignCurrencyName = null;
- $foreignCurrencySymbol = null;
- $foreignCurrencyDp = null;
+ $foreignCurrencyId = null;
+ $foreignCurrencyCode = null;
+ $foreignCurrencyName = null;
+ $foreignCurrencySymbol = null;
+ $foreignCurrencyDp = null;
app('log')->debug('Foreign currency is NULL');
if (null !== $transaction['foreign_currency_id']) {
app('log')->debug(sprintf('Foreign currency is #%d', $transaction['foreign_currency_id']));
- $foreignCurrencyId = (int) $transaction['foreign_currency_id'];
+ $foreignCurrencyId = (int) $transaction['foreign_currency_id'];
$currencies[$foreignCurrencyId] ??= TransactionCurrency::find($foreignCurrencyId);
- $foreignCurrencyCode = $currencies[$foreignCurrencyId]->code;
- $foreignCurrencyName = $currencies[$foreignCurrencyId]->name;
- $foreignCurrencySymbol = $currencies[$foreignCurrencyId]->symbol;
- $foreignCurrencyDp = $currencies[$foreignCurrencyId]->decimal_places;
+ $foreignCurrencyCode = $currencies[$foreignCurrencyId]->code;
+ $foreignCurrencyName = $currencies[$foreignCurrencyId]->name;
+ $foreignCurrencySymbol = $currencies[$foreignCurrencyId]->symbol;
+ $foreignCurrencyDp = $currencies[$foreignCurrencyId]->decimal_places;
}
$this->paidDates[$billId][] = [
@@ -182,18 +182,18 @@ class BillTransformer extends AbstractTransformer
*/
public function transform(Bill $bill): array
{
- $paidData = $this->paidDates[$bill->id] ?? [];
- $nextExpectedMatch = $this->nextExpectedMatch($bill, $this->paidDates[$bill->id] ?? []);
- $payDates = $this->payDates($bill);
- $currency = $this->currencies[$bill->transaction_currency_id];
- $group = $this->groups[$bill->id] ?? null;
+ $paidData = $this->paidDates[$bill->id] ?? [];
+ $nextExpectedMatch = $this->nextExpectedMatch($bill, $this->paidDates[$bill->id] ?? []);
+ $payDates = $this->payDates($bill);
+ $currency = $this->currencies[$bill->transaction_currency_id];
+ $group = $this->groups[$bill->id] ?? null;
// date for currency conversion
/** @var null|Carbon $startParam */
- $startParam = $this->parameters->get('start');
+ $startParam = $this->parameters->get('start');
/** @var null|Carbon $date */
- $date = null === $startParam ? today() : clone $startParam;
+ $date = null === $startParam ? today() : clone $startParam;
$nextExpectedMatchDiff = $this->getNextExpectedMatchDiff($nextExpectedMatch, $payDates);
$this->converter->summarize();
@@ -251,10 +251,10 @@ class BillTransformer extends AbstractTransformer
// 2023-07-18 the cloned $searchDate is used to grab the correct transactions.
/** @var null|Carbon $startParam */
- $startParam = $this->parameters->get('start');
+ $startParam = $this->parameters->get('start');
/** @var null|Carbon $start */
- $start = null === $startParam ? today() : clone $startParam;
+ $start = null === $startParam ? today() : clone $startParam;
$start->subDay();
$lastPaidDate = $this->lastPaidDate($dates, $start);
@@ -307,7 +307,7 @@ class BillTransformer extends AbstractTransformer
$currentStart = clone $this->parameters->get('start');
// 2023-06-23 subDay to fix 7655
$currentStart->subDay();
- $loop = 0;
+ $loop = 0;
while ($currentStart <= $this->parameters->get('end')) {
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
// If nextExpectedMatch is after end, we continue:
@@ -317,13 +317,13 @@ class BillTransformer extends AbstractTransformer
// add to set
$set->push(clone $nextExpectedMatch);
$nextExpectedMatch->addDay();
- $currentStart = clone $nextExpectedMatch;
+ $currentStart = clone $nextExpectedMatch;
++$loop;
if ($loop > 4) {
break;
}
}
- $simple = $set->map(
+ $simple = $set->map(
static function (Carbon $date) {
return $date->toAtomString();
}
@@ -361,7 +361,7 @@ class BillTransformer extends AbstractTransformer
if (null === $current) {
return trans('firefly.not_expected_period');
}
- $carbon = new Carbon($current);
+ $carbon = new Carbon($current);
return $carbon->diffForHumans(today(config('app.timezone')), CarbonInterface::DIFF_RELATIVE_TO_NOW);
}
diff --git a/app/Transformers/V2/BudgetLimitTransformer.php b/app/Transformers/V2/BudgetLimitTransformer.php
index ac37adba53..ff0d15bd59 100644
--- a/app/Transformers/V2/BudgetLimitTransformer.php
+++ b/app/Transformers/V2/BudgetLimitTransformer.php
@@ -77,7 +77,7 @@ class BudgetLimitTransformer extends AbstractTransformer
$currencySymbol = $currency->symbol;
$currencyDecimalPlaces = $currency->decimal_places;
}
- $amount = number_format((float)$amount, $currencyDecimalPlaces, '.', '');
+ $amount = number_format((float)$amount, $currencyDecimalPlaces, '.', '');
return [
'id' => (string)$budgetLimit->id,
diff --git a/app/Transformers/V2/PiggyBankTransformer.php b/app/Transformers/V2/PiggyBankTransformer.php
index 0918755c94..0773df8a06 100644
--- a/app/Transformers/V2/PiggyBankTransformer.php
+++ b/app/Transformers/V2/PiggyBankTransformer.php
@@ -89,12 +89,12 @@ class PiggyBankTransformer extends AbstractTransformer
foreach ($currencyPreferences as $preference) {
$currencyId = (int)$preference->data;
$accountId = $preference->account_id;
- $currencies[$currencyId] ??= TransactionJournal::find($currencyId);
+ $currencies[$currencyId] ??= TransactionJournal::find($currencyId);
$this->currencies[$accountId] = $currencies[$currencyId];
}
// grab object groups:
- $set = DB::table('object_groupables')
+ $set = DB::table('object_groupables')
->leftJoin('object_groups', 'object_groups.id', '=', 'object_groupables.object_group_id')
->where('object_groupables.object_groupable_type', PiggyBank::class)
->get(['object_groupables.*', 'object_groups.title', 'object_groups.order'])
@@ -113,7 +113,7 @@ class PiggyBankTransformer extends AbstractTransformer
}
// grab repetitions (for current amount):
- $repetitions = PiggyBankRepetition::whereIn('piggy_bank_id', $piggyBanks)->get();
+ $repetitions = PiggyBankRepetition::whereIn('piggy_bank_id', $piggyBanks)->get();
/** @var PiggyBankRepetition $repetition */
foreach ($repetitions as $repetition) {
@@ -124,7 +124,7 @@ class PiggyBankTransformer extends AbstractTransformer
// grab notes
// continue with notes
- $notes = Note::whereNoteableType(PiggyBank::class)->whereIn('noteable_id', array_keys($piggyBanks))->get();
+ $notes = Note::whereNoteableType(PiggyBank::class)->whereIn('noteable_id', array_keys($piggyBanks))->get();
/** @var Note $note */
foreach ($notes as $note) {
@@ -133,8 +133,8 @@ class PiggyBankTransformer extends AbstractTransformer
}
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
- $this->default = app('amount')->getDefaultCurrencyByUserGroup(auth()->user()->userGroup);
- $this->converter = new ExchangeRateConverter();
+ $this->default = app('amount')->getDefaultCurrencyByUserGroup(auth()->user()->userGroup);
+ $this->converter = new ExchangeRateConverter();
}
/**
diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php
index ab5516adba..e0c4fb6563 100644
--- a/app/Transformers/V2/TransactionGroupTransformer.php
+++ b/app/Transformers/V2/TransactionGroupTransformer.php
@@ -52,13 +52,13 @@ class TransactionGroupTransformer extends AbstractTransformer
public function collectMetaData(Collection $objects): void
{
// start with currencies:
- $currencies = [];
- $journals = [];
+ $currencies = [];
+ $journals = [];
/** @var array $object */
foreach ($objects as $object) {
foreach ($object['sums'] as $sum) {
- $id = (int) $sum['currency_id'];
+ $id = (int) $sum['currency_id'];
$currencies[$id] ??= TransactionCurrency::find($sum['currency_id']);
}
@@ -72,7 +72,7 @@ class TransactionGroupTransformer extends AbstractTransformer
$this->default = app('amount')->getDefaultCurrency();
// grab meta for all journals:
- $meta = TransactionJournalMeta::whereIn('transaction_journal_id', array_keys($journals))->get();
+ $meta = TransactionJournalMeta::whereIn('transaction_journal_id', array_keys($journals))->get();
/** @var TransactionJournalMeta $entry */
foreach ($meta as $entry) {
@@ -81,7 +81,7 @@ class TransactionGroupTransformer extends AbstractTransformer
}
// grab all notes for all journals:
- $notes = Note::whereNoteableType(TransactionJournal::class)->whereIn('noteable_id', array_keys($journals))->get();
+ $notes = Note::whereNoteableType(TransactionJournal::class)->whereIn('noteable_id', array_keys($journals))->get();
/** @var Note $note */
foreach ($notes as $note) {
@@ -90,7 +90,7 @@ class TransactionGroupTransformer extends AbstractTransformer
}
// grab all tags for all journals:
- $tags = DB::table('tag_transaction_journal')
+ $tags = DB::table('tag_transaction_journal')
->leftJoin('tags', 'tags.id', 'tag_transaction_journal.tag_id')
->whereIn('tag_transaction_journal.transaction_journal_id', array_keys($journals))
->get(['tag_transaction_journal.transaction_journal_id', 'tags.tag'])
@@ -104,7 +104,7 @@ class TransactionGroupTransformer extends AbstractTransformer
// create converter
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
- $this->converter = new ExchangeRateConverter();
+ $this->converter = new ExchangeRateConverter();
}
public function transform(array $group): array
@@ -147,10 +147,10 @@ class TransactionGroupTransformer extends AbstractTransformer
*/
private function transformTransaction(array $transaction): array
{
- $transaction = new NullArrayObject($transaction);
- $type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionType::WITHDRAWAL);
- $journalId = (int) $transaction['transaction_journal_id'];
- $meta = new NullArrayObject($this->meta[$journalId] ?? []);
+ $transaction = new NullArrayObject($transaction);
+ $type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionType::WITHDRAWAL);
+ $journalId = (int) $transaction['transaction_journal_id'];
+ $meta = new NullArrayObject($this->meta[$journalId] ?? []);
/**
* Convert and use amount:
diff --git a/app/User.php b/app/User.php
index e83688f07c..04a0c0df7d 100644
--- a/app/User.php
+++ b/app/User.php
@@ -422,9 +422,9 @@ class User extends Authenticatable
if (method_exists($this, $method)) {
return $this->{$method}($notification); // @phpstan-ignore-line
}
- $email = $this->email;
+ $email = $this->email;
// see if user has alternative email address:
- $pref = app('preferences')->getForUser($this, 'remote_guard_alt_email');
+ $pref = app('preferences')->getForUser($this, 'remote_guard_alt_email');
if (null !== $pref) {
$email = $pref->data;
}
@@ -462,11 +462,11 @@ class User extends Authenticatable
public function routeNotificationForSlack(Notification $notification): string
{
// this check does not validate if the user is owner, Should be done by notification itself.
- $res = app('fireflyconfig')->get('slack_webhook_url', '')->data;
+ $res = app('fireflyconfig')->get('slack_webhook_url', '')->data;
if (is_array($res)) {
$res = '';
}
- $res = (string)$res;
+ $res = (string)$res;
if ($notification instanceof TestNotification) {
return $res;
}
@@ -594,14 +594,14 @@ class User extends Authenticatable
app('log')->debug(sprintf('in hasAnyRoleInGroup(%s)', implode(', ', $roles)));
/** @var Collection $dbRoles */
- $dbRoles = UserRole::whereIn('title', $roles)->get();
+ $dbRoles = UserRole::whereIn('title', $roles)->get();
if (0 === $dbRoles->count()) {
app('log')->error(sprintf('Could not find role(s): %s. Probably migration mishap.', implode(', ', $roles)));
return false;
}
- $dbRolesIds = $dbRoles->pluck('id')->toArray();
- $dbRolesTitles = $dbRoles->pluck('title')->toArray();
+ $dbRolesIds = $dbRoles->pluck('id')->toArray();
+ $dbRolesTitles = $dbRoles->pluck('title')->toArray();
/** @var Collection $groupMemberships */
$groupMemberships = $this->groupMemberships()
diff --git a/app/Validation/Account/DepositValidation.php b/app/Validation/Account/DepositValidation.php
index 1b4166d2ae..aaae93470b 100644
--- a/app/Validation/Account/DepositValidation.php
+++ b/app/Validation/Account/DepositValidation.php
@@ -41,13 +41,13 @@ trait DepositValidation
app('log')->debug('Now in validateDepositDestination', $array);
// source can be any of the following types.
- $validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
+ $validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL we return false,
// because the destination of a deposit can't be created.
$this->destError = (string) trans('validation.deposit_dest_need_data');
app('log')->error('Both values are NULL, cant create deposit destination.');
- $result = false;
+ $result = false;
}
// if the account can be created anyway we don't need to search.
if (null === $result && true === $this->canCreateTypes($validTypes)) {
@@ -94,10 +94,10 @@ trait DepositValidation
// null = we found nothing at all or didn't even search
// false = invalid results
- $result = null;
+ $result = null;
// source can be any of the following types.
- $validTypes = array_keys($this->combinations[$this->transactionType]);
+ $validTypes = array_keys($this->combinations[$this->transactionType]);
if (null === $accountId
&& null === $accountName
&& null === $accountIban
@@ -168,7 +168,7 @@ trait DepositValidation
// if the account can be created anyway we don't need to search.
if (null === $result && true === $this->canCreateTypes($validTypes)) {
- $result = true;
+ $result = true;
// set the source to be a (dummy) revenue account.
$account = new Account();
diff --git a/app/Validation/Account/LiabilityValidation.php b/app/Validation/Account/LiabilityValidation.php
index 09bf1622b2..f3fc714c9d 100644
--- a/app/Validation/Account/LiabilityValidation.php
+++ b/app/Validation/Account/LiabilityValidation.php
@@ -76,7 +76,7 @@ trait LiabilityValidation
app('log')->debug('Now in validateLCSource', $array);
// if the array has an ID and ID is not null, try to find it and check type.
// this account must be a liability
- $accountId = array_key_exists('id', $array) ? $array['id'] : null;
+ $accountId = array_key_exists('id', $array) ? $array['id'] : null;
if (null !== $accountId) {
app('log')->debug('Source ID is not null, assume were looking for a liability.');
// find liability credit:
@@ -95,7 +95,7 @@ trait LiabilityValidation
// if array has name and is not null, return true.
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
- $result = true;
+ $result = true;
if ('' === $accountName || null === $accountName) {
app('log')->error('Array must have a name, is not the case, return false.');
$result = false;
diff --git a/app/Validation/Account/OBValidation.php b/app/Validation/Account/OBValidation.php
index 434db7595a..de2dc2c11d 100644
--- a/app/Validation/Account/OBValidation.php
+++ b/app/Validation/Account/OBValidation.php
@@ -40,13 +40,13 @@ trait OBValidation
app('log')->debug('Now in validateOBDestination', $array);
// source can be any of the following types.
- $validTypes = $this->combinations[$this->transactionType][$this->source?->accountType->type] ?? [];
+ $validTypes = $this->combinations[$this->transactionType][$this->source?->accountType->type] ?? [];
if (null === $accountId && null === $accountName && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL we return false,
// because the destination of a deposit can't be created.
$this->destError = (string)trans('validation.ob_dest_need_data');
app('log')->error('Both values are NULL, cant create OB destination.');
- $result = false;
+ $result = false;
}
// if the account can be created anyway we don't need to search.
if (null === $result && true === $this->canCreateTypes($validTypes)) {
@@ -84,9 +84,9 @@ trait OBValidation
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
app('log')->debug('Now in validateOBSource', $array);
- $result = null;
+ $result = null;
// source can be any of the following types.
- $validTypes = array_keys($this->combinations[$this->transactionType]);
+ $validTypes = array_keys($this->combinations[$this->transactionType]);
if (null === $accountId && null === $accountName && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL return false,
@@ -104,7 +104,7 @@ trait OBValidation
// the source resulted in an account, but it's not of a valid type.
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
- $message = sprintf('User submitted only an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type);
+ $message = sprintf('User submitted only an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type);
app('log')->debug($message);
$this->sourceError = $message;
$result = false;
@@ -120,10 +120,10 @@ trait OBValidation
// if the account can be created anyway we don't need to search.
if (null === $result && true === $this->canCreateTypes($validTypes)) {
app('log')->debug('Result is still null.');
- $result = true;
+ $result = true;
// set the source to be a (dummy) initial balance account.
- $account = new Account();
+ $account = new Account();
/** @var AccountType $accountType */
$accountType = AccountType::whereType(AccountType::INITIAL_BALANCE)->first();
diff --git a/app/Validation/Account/ReconciliationValidation.php b/app/Validation/Account/ReconciliationValidation.php
index ee8465b0a6..be3695eef3 100644
--- a/app/Validation/Account/ReconciliationValidation.php
+++ b/app/Validation/Account/ReconciliationValidation.php
@@ -50,8 +50,8 @@ trait ReconciliationValidation
app('log')->debug('Now in validateReconciliationDestination', $array);
// source can be any of the following types.
- $validTypes = array_keys($this->combinations[$this->transactionType]);
- $search = $this->findExistingAccount($validTypes, $array);
+ $validTypes = array_keys($this->combinations[$this->transactionType]);
+ $search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
$this->sourceError = (string)trans('validation.reconciliation_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
@@ -85,8 +85,8 @@ trait ReconciliationValidation
app('log')->debug('Now in validateReconciliationSource', $array);
// source can be any of the following types.
- $validTypes = array_keys($this->combinations[$this->transactionType]);
- $search = $this->findExistingAccount($validTypes, $array);
+ $validTypes = array_keys($this->combinations[$this->transactionType]);
+ $search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
$this->sourceError = (string)trans('validation.reconciliation_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
diff --git a/app/Validation/Account/TransferValidation.php b/app/Validation/Account/TransferValidation.php
index fa4582b09a..dbf5808fcb 100644
--- a/app/Validation/Account/TransferValidation.php
+++ b/app/Validation/Account/TransferValidation.php
@@ -37,7 +37,7 @@ trait TransferValidation
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
app('log')->debug('Now in validateTransferDestination', $array);
// source can be any of the following types.
- $validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
+ $validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL we return false,
// because the destination of a transfer can't be created.
@@ -48,7 +48,7 @@ trait TransferValidation
}
// or try to find the account:
- $search = $this->findExistingAccount($validTypes, $array);
+ $search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
$this->destError = (string)trans('validation.transfer_dest_bad_data', ['id' => $accountId, 'name' => $accountName]);
@@ -79,7 +79,7 @@ trait TransferValidation
$accountNumber = array_key_exists('number', $array) ? $array['number'] : null;
app('log')->debug('Now in validateTransferSource', $array);
// source can be any of the following types.
- $validTypes = array_keys($this->combinations[$this->transactionType]);
+ $validTypes = array_keys($this->combinations[$this->transactionType]);
if (null === $accountId && null === $accountName
&& null === $accountIban && null === $accountNumber
&& false === $this->canCreateTypes($validTypes)) {
@@ -92,7 +92,7 @@ trait TransferValidation
}
// otherwise try to find the account:
- $search = $this->findExistingAccount($validTypes, $array);
+ $search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
$this->sourceError = (string)trans('validation.transfer_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
app('log')->warning('Not a valid source, cant find it.', $validTypes);
diff --git a/app/Validation/Account/WithdrawalValidation.php b/app/Validation/Account/WithdrawalValidation.php
index 1ff0cb4ec7..9f4102b12d 100644
--- a/app/Validation/Account/WithdrawalValidation.php
+++ b/app/Validation/Account/WithdrawalValidation.php
@@ -38,7 +38,7 @@ trait WithdrawalValidation
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
app('log')->debug('Now in validateGenericSource', $array);
// source can be any of the following types.
- $validTypes = [AccountType::ASSET, AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
+ $validTypes = [AccountType::ASSET, AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL we return TRUE
// because we assume the user doesn't want to submit / change anything.
@@ -49,7 +49,7 @@ trait WithdrawalValidation
}
// otherwise try to find the account:
- $search = $this->findExistingAccount($validTypes, $array);
+ $search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
$this->sourceError = (string)trans('validation.withdrawal_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
@@ -74,7 +74,7 @@ trait WithdrawalValidation
$accountNumber = array_key_exists('number', $array) ? $array['number'] : null;
app('log')->debug('Now in validateWithdrawalDestination()', $array);
// source can be any of the following types.
- $validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
+ $validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
app('log')->debug('Source type can be: ', $validTypes);
if (null === $accountId && null === $accountName && null === $accountIban && null === $accountNumber && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL return false,
@@ -88,7 +88,7 @@ trait WithdrawalValidation
if (null !== $accountId && 0 !== $accountId) {
$found = $this->getRepository()->find($accountId);
if (null !== $found) {
- $type = $found->accountType->type;
+ $type = $found->accountType->type;
if (in_array($type, $validTypes, true)) {
$this->setDestination($found);
@@ -126,7 +126,7 @@ trait WithdrawalValidation
app('log')->debug('Now in validateWithdrawalSource', $array);
// source can be any of the following types.
- $validTypes = array_keys($this->combinations[$this->transactionType]);
+ $validTypes = array_keys($this->combinations[$this->transactionType]);
if (null === $accountId && null === $accountName && null === $accountNumber && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
// if both values are NULL we return false,
// because the source of a withdrawal can't be created.
@@ -137,7 +137,7 @@ trait WithdrawalValidation
}
// otherwise try to find the account:
- $search = $this->findExistingAccount($validTypes, $array);
+ $search = $this->findExistingAccount($validTypes, $array);
if (null === $search) {
$this->sourceError = (string)trans('validation.withdrawal_source_bad_data', ['id' => $accountId, 'name' => $accountName]);
app('log')->warning('Not a valid source. Cant find it.', $validTypes);
diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php
index d2f4f61767..62a4ee6258 100644
--- a/app/Validation/AccountValidator.php
+++ b/app/Validation/AccountValidator.php
@@ -135,37 +135,37 @@ class AccountValidator
$this->destError = sprintf('AccountValidator::validateDestination cannot handle "%s", so it will always return false.', $this->transactionType);
app('log')->error(sprintf('AccountValidator::validateDestination cannot handle "%s", so it will always return false.', $this->transactionType));
- $result = false;
+ $result = false;
break;
case TransactionType::WITHDRAWAL:
- $result = $this->validateWithdrawalDestination($array);
+ $result = $this->validateWithdrawalDestination($array);
break;
case TransactionType::DEPOSIT:
- $result = $this->validateDepositDestination($array);
+ $result = $this->validateDepositDestination($array);
break;
case TransactionType::TRANSFER:
- $result = $this->validateTransferDestination($array);
+ $result = $this->validateTransferDestination($array);
break;
case TransactionType::OPENING_BALANCE:
- $result = $this->validateOBDestination($array);
+ $result = $this->validateOBDestination($array);
break;
case TransactionType::LIABILITY_CREDIT:
- $result = $this->validateLCDestination($array);
+ $result = $this->validateLCDestination($array);
break;
case TransactionType::RECONCILIATION:
- $result = $this->validateReconciliationDestination($array);
+ $result = $this->validateReconciliationDestination($array);
break;
}
diff --git a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php
index 53db5422a9..6494d4d05a 100644
--- a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php
+++ b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php
@@ -40,9 +40,9 @@ trait ValidatesBulkTransactionQuery
) {
// find both accounts, must be same type.
// already validated: belongs to this user.
- $repository = app(AccountRepositoryInterface::class);
- $source = $repository->find((int)$json['where']['account_id']);
- $dest = $repository->find((int)$json['update']['account_id']);
+ $repository = app(AccountRepositoryInterface::class);
+ $source = $repository->find((int)$json['where']['account_id']);
+ $dest = $repository->find((int)$json['update']['account_id']);
if (null === $source) {
$validator->errors()->add('query', sprintf((string)trans('validation.invalid_query_data'), 'where', 'account_id'));
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 4362849730..da10d6798e 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -62,7 +62,7 @@ class FireflyValidator extends Validator
if (!is_string($value) || 6 !== strlen($value)) {
return false;
}
- $user = auth()->user();
+ $user = auth()->user();
if (null === $user) {
app('log')->error('No user during validate2faCode');
@@ -183,10 +183,10 @@ class FireflyValidator extends Validator
$replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35'];
// take
- $first = substr($value, 0, 4);
- $last = substr($value, 4);
- $iban = $last.$first;
- $iban = trim(str_replace($search, $replace, $iban));
+ $first = substr($value, 0, 4);
+ $last = substr($value, 4);
+ $iban = $last.$first;
+ $iban = trim(str_replace($search, $replace, $iban));
if ('' === $iban) {
return false;
}
@@ -257,8 +257,8 @@ class FireflyValidator extends Validator
{
// first, get the index from this string:
$value ??= '';
- $parts = explode('.', $attribute);
- $index = (int) ($parts[1] ?? '0');
+ $parts = explode('.', $attribute);
+ $index = (int) ($parts[1] ?? '0');
// get the name of the trigger from the data array:
$actionType = $this->data['actions'][$index]['type'] ?? 'invalid';
@@ -322,8 +322,8 @@ class FireflyValidator extends Validator
public function validateRuleTriggerValue(string $attribute, string $value = null): bool
{
// first, get the index from this string:
- $parts = explode('.', $attribute);
- $index = (int) ($parts[1] ?? '0');
+ $parts = explode('.', $attribute);
+ $index = (int) ($parts[1] ?? '0');
// get the name of the trigger from the data array:
$triggerType = $this->data['triggers'][$index]['type'] ?? 'invalid';
@@ -334,13 +334,13 @@ class FireflyValidator extends Validator
}
// these trigger types need a numerical check:
- $numerical = ['amount_less', 'amount_more', 'amount_exactly'];
+ $numerical = ['amount_less', 'amount_more', 'amount_exactly'];
if (in_array($triggerType, $numerical, true)) {
return is_numeric($value);
}
// these trigger types need a simple strlen check:
- $length = [
+ $length = [
'source_account_starts',
'source_account_ends',
'source_account_is',
@@ -479,7 +479,7 @@ class FireflyValidator extends Validator
$accountId = (int) ($parameters[0] ?? 0.0);
}
- $query = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
+ $query = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
->whereNull('accounts.deleted_at')
->where('accounts.user_id', auth()->user()->id)
->where('account_meta.name', 'account_number')
@@ -490,8 +490,8 @@ class FireflyValidator extends Validator
// exclude current account from check.
$query->where('account_meta.account_id', '!=', $accountId);
}
- $set = $query->get(['account_meta.*']);
- $count = $set->count();
+ $set = $query->get(['account_meta.*']);
+ $count = $set->count();
if (0 === $count) {
return true;
}
@@ -499,7 +499,7 @@ class FireflyValidator extends Validator
// pretty much impossible but still.
return false;
}
- $type = $this->data['objectType'] ?? 'unknown';
+ $type = $this->data['objectType'] ?? 'unknown';
if ('expense' !== $type && 'revenue' !== $type) {
app('log')->warning(sprintf('Account number "%s" is not unique and account type "%s" cannot share its account number.', $value, $type));
@@ -569,7 +569,7 @@ class FireflyValidator extends Validator
// get existing webhook value:
if (0 !== $existingId) {
/** @var null|Webhook $webhook */
- $webhook = auth()->user()->webhooks()->find($existingId);
+ $webhook = auth()->user()->webhooks()->find($existingId);
if (null === $webhook) {
return false;
}
@@ -614,18 +614,18 @@ class FireflyValidator extends Validator
public function validateUniqueObjectForUser($attribute, $value, $parameters): bool
{
[$table, $field] = $parameters;
- $exclude = (int) ($parameters[2] ?? 0.0);
+ $exclude = (int) ($parameters[2] ?? 0.0);
/*
* If other data (in $this->getData()) contains
* ID field, set that field to be the $exclude.
*/
- $data = $this->getData();
+ $data = $this->getData();
if (!array_key_exists(2, $parameters) && array_key_exists('id', $data) && (int) $data['id'] > 0) {
$exclude = (int) $data['id'];
}
// get entries from table
- $result = \DB::table($table)->where('user_id', auth()->user()->id)->whereNull('deleted_at')
+ $result = \DB::table($table)->where('user_id', auth()->user()->id)->whereNull('deleted_at')
->where('id', '!=', $exclude)
->where($field, $value)
->first([$field])
@@ -695,11 +695,11 @@ class FireflyValidator extends Validator
$deliveries = Webhook::getDeliveriesForValidation();
// integers
- $trigger = $triggers[$this->data['trigger']] ?? 0;
- $response = $responses[$this->data['response']] ?? 0;
- $delivery = $deliveries[$this->data['delivery']] ?? 0;
- $url = $this->data['url'];
- $userId = auth()->user()->id;
+ $trigger = $triggers[$this->data['trigger']] ?? 0;
+ $response = $responses[$this->data['response']] ?? 0;
+ $delivery = $deliveries[$this->data['delivery']] ?? 0;
+ $url = $this->data['url'];
+ $userId = auth()->user()->id;
return 0 === Webhook::whereUserId($userId)
->where('trigger', $trigger)
@@ -719,9 +719,9 @@ class FireflyValidator extends Validator
}
/** @var User $user */
- $user = User::find($this->data['user_id']);
- $type = AccountType::find($this->data['account_type_id'])->first();
- $value = $this->data['name'];
+ $user = User::find($this->data['user_id']);
+ $type = AccountType::find($this->data['account_type_id'])->first();
+ $value = $this->data['name'];
/** @var null|Account $result */
$result = $user->accounts()->where('account_type_id', $type->id)->where('name', $value)->first();
@@ -732,7 +732,7 @@ class FireflyValidator extends Validator
private function validateByAccountTypeString(string $value, array $parameters, string $type): bool
{
/** @var null|array $search */
- $search = \Config::get('firefly.accountTypeByIdentifier.'.$type);
+ $search = \Config::get('firefly.accountTypeByIdentifier.'.$type);
if (null === $search) {
return false;
@@ -743,7 +743,7 @@ class FireflyValidator extends Validator
$accountTypeIds = $accountTypes->pluck('id')->toArray();
/** @var null|Account $result */
- $result = auth()->user()->accounts()->whereIn('account_type_id', $accountTypeIds)->where('id', '!=', $ignore)
+ $result = auth()->user()->accounts()->whereIn('account_type_id', $accountTypeIds)->where('id', '!=', $ignore)
->where('name', $value)
->first()
;
@@ -777,10 +777,10 @@ class FireflyValidator extends Validator
/** @var Account $existingAccount */
$existingAccount = Account::find($accountId);
- $type = $existingAccount->accountType;
- $ignore = $existingAccount->id;
+ $type = $existingAccount->accountType;
+ $ignore = $existingAccount->id;
- $entry = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)
+ $entry = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)
->where('name', $value)
->first()
;
@@ -796,10 +796,10 @@ class FireflyValidator extends Validator
/** @var Account $existingAccount */
$existingAccount = Account::find($this->data['id']);
- $type = $existingAccount->accountType;
- $ignore = $existingAccount->id;
+ $type = $existingAccount->accountType;
+ $ignore = $existingAccount->id;
- $entry = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)
+ $entry = auth()->user()->accounts()->where('account_type_id', $type->id)->where('id', '!=', $ignore)
->where('name', $value)
->first()
;
diff --git a/app/Validation/GroupValidation.php b/app/Validation/GroupValidation.php
index 289064a791..c79fbc6539 100644
--- a/app/Validation/GroupValidation.php
+++ b/app/Validation/GroupValidation.php
@@ -91,7 +91,7 @@ trait GroupValidation
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
- $count = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id')
+ $count = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id')
->leftJoin('transaction_groups', 'transaction_groups.id', 'transaction_journals.transaction_group_id')
->where('transaction_journals.transaction_group_id', $transactionGroup->id)
->where('transactions.reconciled', 1)->where('transactions.amount', '<', 0)->count('transactions.id')
@@ -156,7 +156,7 @@ trait GroupValidation
$data = $validator->getData();
$transactions = $this->getTransactionsArray($validator);
- $groupTitle = $data['group_title'] ?? '';
+ $groupTitle = $data['group_title'] ?? '';
if ('' === $groupTitle && count($transactions) > 1) {
$validator->errors()->add('group_title', (string)trans('validation.group_title_mandatory'));
}
diff --git a/app/Validation/RecurrenceValidation.php b/app/Validation/RecurrenceValidation.php
index c353dc55de..b4c3bdc286 100644
--- a/app/Validation/RecurrenceValidation.php
+++ b/app/Validation/RecurrenceValidation.php
@@ -42,9 +42,9 @@ trait RecurrenceValidation
*/
public function valUpdateAccountInfo(Validator $validator): void
{
- $data = $validator->getData();
+ $data = $validator->getData();
- $transactionType = $data['type'] ?? 'invalid';
+ $transactionType = $data['type'] ?? 'invalid';
// grab model from parameter and try to set the transaction type from it
if ('invalid' === $transactionType) {
@@ -69,14 +69,14 @@ trait RecurrenceValidation
}
}
- $transactions = $data['transactions'] ?? [];
+ $transactions = $data['transactions'] ?? [];
/** @var AccountValidator $accountValidator */
$accountValidator = app(AccountValidator::class);
app('log')->debug(sprintf('Going to loop %d transaction(s)', count($transactions)));
foreach ($transactions as $index => $transaction) {
- $transactionType = $transaction['type'] ?? $transactionType;
+ $transactionType = $transaction['type'] ?? $transactionType;
$accountValidator->setTransactionType($transactionType);
if (
@@ -88,9 +88,9 @@ trait RecurrenceValidation
continue;
}
// validate source account.
- $sourceId = array_key_exists('source_id', $transaction) ? (int) $transaction['source_id'] : null;
- $sourceName = $transaction['source_name'] ?? null;
- $validSource = $accountValidator->validateSource(['id' => $sourceId, 'name' => $sourceName]);
+ $sourceId = array_key_exists('source_id', $transaction) ? (int) $transaction['source_id'] : null;
+ $sourceName = $transaction['source_name'] ?? null;
+ $validSource = $accountValidator->validateSource(['id' => $sourceId, 'name' => $sourceName]);
// do something with result:
if (false === $validSource) {
@@ -264,8 +264,8 @@ trait RecurrenceValidation
return;
}
- $nthDay = (int) ($parameters[0] ?? 0.0);
- $dayOfWeek = (int) ($parameters[1] ?? 0.0);
+ $nthDay = (int) ($parameters[0] ?? 0.0);
+ $dayOfWeek = (int) ($parameters[1] ?? 0.0);
if ($nthDay < 1 || $nthDay > 5) {
$validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string) trans('validation.valid_recurrence_rep_moment'));
@@ -314,15 +314,15 @@ trait RecurrenceValidation
return;
}
- $originalTrCount = $recurrence->recurrenceTransactions()->count();
+ $originalTrCount = $recurrence->recurrenceTransactions()->count();
if (1 === $submittedTrCount && 1 === $originalTrCount) {
- $first = $transactions[0]; // can safely assume index 0.
+ $first = $transactions[0]; // can safely assume index 0.
if (!array_key_exists('id', $first)) {
app('log')->debug('Single count and no ID, done.');
return; // home safe!
}
- $id = $first['id'];
+ $id = $first['id'];
if ('' === (string) $id) {
app('log')->debug('Single count and empty ID, done.');
@@ -340,7 +340,7 @@ trait RecurrenceValidation
}
app('log')->debug('Multi ID validation.');
- $idsMandatory = false;
+ $idsMandatory = false;
if ($submittedTrCount < $originalTrCount) {
app('log')->debug(sprintf('User submits %d transaction, recurrence has %d transactions. All entries must have ID.', $submittedTrCount, $originalTrCount));
$idsMandatory = true;
@@ -357,7 +357,7 @@ trait RecurrenceValidation
* 2. If the user submits more transactions than already present, count the number of existing transactions. At least those must be matched. After that, submit as many as you like.
* 3. If the user submits the same number of transactions as already present, all but one must have an ID.
*/
- $unmatchedIds = 0;
+ $unmatchedIds = 0;
foreach ($transactions as $index => $transaction) {
app('log')->debug(sprintf('Now at %d/%d', $index + 1, $submittedTrCount));
@@ -387,7 +387,7 @@ trait RecurrenceValidation
}
}
// if too many don't match, but you haven't submitted more than already present:
- $maxUnmatched = max(1, $submittedTrCount - $originalTrCount);
+ $maxUnmatched = max(1, $submittedTrCount - $originalTrCount);
app('log')->debug(sprintf('Submitted: %d. Original: %d. User can submit %d unmatched transactions.', $submittedTrCount, $originalTrCount, $maxUnmatched));
if ($unmatchedIds > $maxUnmatched) {
app('log')->warning(sprintf('Too many unmatched transactions (%d).', $unmatchedIds));
diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php
index 724f9dadd3..4d13137945 100644
--- a/app/Validation/TransactionValidation.php
+++ b/app/Validation/TransactionValidation.php
@@ -162,17 +162,17 @@ trait TransactionValidation
app('log')->debug('Now in validateTransactionTypes()');
$transactions = $this->getTransactionsArray($validator);
- $types = [];
+ $types = [];
foreach ($transactions as $transaction) {
$types[] = $transaction['type'] ?? 'invalid';
}
- $unique = array_unique($types);
+ $unique = array_unique($types);
if (count($unique) > 1) {
$validator->errors()->add('transactions.0.type', (string) trans('validation.transaction_types_equal'));
return;
}
- $first = $unique[0] ?? 'invalid';
+ $first = $unique[0] ?? 'invalid';
if ('invalid' === $first) {
$validator->errors()->add('transactions.0.type', (string) trans('validation.invalid_transaction_type'));
}
@@ -189,9 +189,9 @@ trait TransactionValidation
foreach ($transactions as $transaction) {
$originalType = $this->getOriginalType((int) ($transaction['transaction_journal_id'] ?? 0));
// if type is not set, fall back to the type of the journal, if one is given.
- $types[] = $transaction['type'] ?? $originalType;
+ $types[] = $transaction['type'] ?? $originalType;
}
- $unique = array_unique($types);
+ $unique = array_unique($types);
if (count($unique) > 1) {
app('log')->warning('Add error for mismatch transaction types.');
$validator->errors()->add('transactions.0.type', (string) trans('validation.transaction_types_equal'));
@@ -225,7 +225,7 @@ trait TransactionValidation
app('log')->debug(sprintf('Now in validateSingleAccount(%d)', $index));
/** @var AccountValidator $accountValidator */
- $accountValidator = app(AccountValidator::class);
+ $accountValidator = app(AccountValidator::class);
if (array_key_exists('user', $transaction) && null !== $transaction['user']) {
$accountValidator->setUser($transaction['user']);
@@ -234,21 +234,21 @@ trait TransactionValidation
$accountValidator->setUserGroup($transaction['user_group']);
}
- $transactionType = $transaction['type'] ?? $transactionType;
+ $transactionType = $transaction['type'] ?? $transactionType;
$accountValidator->setTransactionType($transactionType);
// validate source account.
- $sourceId = array_key_exists('source_id', $transaction) ? (int) $transaction['source_id'] : null;
- $sourceName = array_key_exists('source_name', $transaction) ? (string) $transaction['source_name'] : null;
- $sourceIban = array_key_exists('source_iban', $transaction) ? (string) $transaction['source_iban'] : null;
- $sourceNumber = array_key_exists('source_number', $transaction) ? (string) $transaction['source_number'] : null;
- $source = [
+ $sourceId = array_key_exists('source_id', $transaction) ? (int) $transaction['source_id'] : null;
+ $sourceName = array_key_exists('source_name', $transaction) ? (string) $transaction['source_name'] : null;
+ $sourceIban = array_key_exists('source_iban', $transaction) ? (string) $transaction['source_iban'] : null;
+ $sourceNumber = array_key_exists('source_number', $transaction) ? (string) $transaction['source_number'] : null;
+ $source = [
'id' => $sourceId,
'name' => $sourceName,
'iban' => $sourceIban,
'number' => $sourceNumber,
];
- $validSource = $accountValidator->validateSource($source);
+ $validSource = $accountValidator->validateSource($source);
// do something with result:
if (false === $validSource) {
@@ -423,8 +423,8 @@ trait TransactionValidation
return;
}
- $source = $accountValidator->source;
- $destination = $accountValidator->destination;
+ $source = $accountValidator->source;
+ $destination = $accountValidator->destination;
app('log')->debug(sprintf('Source: #%d "%s (%s)"', $source->id, $source->name, $source->accountType->type));
app('log')->debug(sprintf('Destination: #%d "%s" (%s)', $destination->id, $destination->name, $source->accountType->type));
@@ -594,15 +594,15 @@ trait TransactionValidation
if (count($transactions) < 2) {
return;
}
- $type = $transactions[0]['type'] ?? 'withdrawal';
- $sources = [];
- $dests = [];
+ $type = $transactions[0]['type'] ?? 'withdrawal';
+ $sources = [];
+ $dests = [];
foreach ($transactions as $transaction) {
$sources[] = sprintf('%d-%s', $transaction['source_id'] ?? 0, $transaction['source_name'] ?? '');
$dests[] = sprintf('%d-%s', $transaction['destination_id'] ?? 0, $transaction['destination_name'] ?? '');
}
- $sources = array_unique($sources);
- $dests = array_unique($dests);
+ $sources = array_unique($sources);
+ $dests = array_unique($dests);
switch ($type) {
default:
@@ -646,15 +646,15 @@ trait TransactionValidation
return;
}
- $type = $this->getTransactionType($transactionGroup, $transactions);
+ $type = $this->getTransactionType($transactionGroup, $transactions);
// compare source IDs, destination IDs, source names and destination names.
// I think I can get away with one combination being equal, as long as the rest
// of the code picks up on this as well.
// either way all fields must be blank or all equal
// but if IDs are equal don't bother with the names.
- $comparison = $this->collectComparisonData($transactions);
- $result = $this->compareAccountData($type, $comparison);
+ $comparison = $this->collectComparisonData($transactions);
+ $result = $this->compareAccountData($type, $comparison);
if (false === $result) {
if ('withdrawal' === $type) {
$validator->errors()->add('transactions.0.source_id', (string) trans('validation.all_accounts_equal'));
@@ -683,7 +683,7 @@ trait TransactionValidation
/** @var array $transaction */
foreach ($transactions as $transaction) {
// source or destination may be omitted. If this is the case, use the original source / destination name + ID.
- $originalData = $this->getOriginalData((int) ($transaction['transaction_journal_id'] ?? 0));
+ $originalData = $this->getOriginalData((int) ($transaction['transaction_journal_id'] ?? 0));
// get field.
$comparison[$field][] = $transaction[$field] ?? $originalData[$field];
@@ -695,7 +695,7 @@ trait TransactionValidation
private function getOriginalData(int $journalId): array
{
- $return = [
+ $return = [
'source_id' => 0,
'source_name' => '',
'destination_id' => 0,
@@ -706,7 +706,7 @@ trait TransactionValidation
}
/** @var null|Transaction $source */
- $source = Transaction::where('transaction_journal_id', $journalId)->where('amount', '<', 0)->with(['account'])->first();
+ $source = Transaction::where('transaction_journal_id', $journalId)->where('amount', '<', 0)->with(['account'])->first();
if (null !== $source) {
$return['source_id'] = $source->account_id;
$return['source_name'] = $source->account->name;