Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Replace classes
James Colefa018e80c0ec
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex 140667989c..9bac6588ba 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Helpers\Report;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Helpers\Collector\GroupCollectorInterface;use FireflyIII\Helpers\Fiscal\FiscalHelperInterface;@@ -81,7 +82,7 @@ class ReportHelper implements ReportHelperInterface/** @var Carbon $expectedStart */foreach ($expectedDates as $expectedStart) {- $expectedEnd = app('navigation')->endOfX($expectedStart, $bill->repeat_freq, null);+ $expectedEnd = Navigation::endOfX($expectedStart, $bill->repeat_freq, null);// is paid in this period maybe?/** @var GroupCollectorInterface $collector */diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.phpindex a6cbc328cb..248e5efe38 100644--- a/app/Http/Controllers/Account/ReconcileController.php+++ b/app/Http/Controllers/Account/ReconcileController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Account;+use FireflyIII\Support\Facades\Navigation;use Illuminate\Support\Facades\Log;use Carbon\Carbon;use FireflyIII\Enums\AccountTypeEnum;@@ -91,20 +92,20 @@ class ReconcileController extends Controller$currency = $this->accountRepos->getAccountCurrency($account) ?? $this->primaryCurrency;// no start or end:- $range = app('navigation')->getViewRange(false);+ $range = Navigation::getViewRange(false);// get start and endif (!$start instanceof Carbon && !$end instanceof Carbon) {/** @var Carbon $start */- $start = clone session('start', app('navigation')->startOfPeriod(new Carbon(), $range));+ $start = clone session('start', Navigation::startOfPeriod(new Carbon(), $range));/** @var Carbon $end */- $end = clone session('end', app('navigation')->endOfPeriod(new Carbon(), $range));+ $end = clone session('end', Navigation::endOfPeriod(new Carbon(), $range));}if (null === $end) {/** @var Carbon $end */- $end = app('navigation')->endOfPeriod($start, $range);+ $end = Navigation::endOfPeriod($start, $range);}if ($end->lt($start)) {diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.phpindex 9a1b345b18..46950450e0 100644--- a/app/Http/Controllers/Bill/IndexController.php+++ b/app/Http/Controllers/Bill/IndexController.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Bill;+use FireflyIII\Support\Facades\Navigation;use Illuminate\Support\Facades\Log;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Models\Bill;@@ -151,7 +152,7 @@ class IndexController extends Controllerprivate function getSums(array $bills): array{$sums = [];- $range = app('navigation')->getViewRange(true);+ $range = Navigation::getViewRange(true);/** @var array $group */foreach ($bills as $groupOrder => $group) {diff --git a/app/Http/Controllers/Bill/ShowController.php b/app/Http/Controllers/Bill/ShowController.phpindex 33d9fa56b7..fa5ef7d699 100644--- a/app/Http/Controllers/Bill/ShowController.php+++ b/app/Http/Controllers/Bill/ShowController.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Bill;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Helpers\Collector\GroupCollectorInterface;use FireflyIII\Http\Controllers\Controller;@@ -139,8 +140,8 @@ class ShowController extends Controller$manager->parseIncludes(['attachments', 'notes']);// add another period to end, could fix 8163- $range = app('navigation')->getViewRange(true);- $end = app('navigation')->addPeriod($end, $range);+ $range = Navigation::getViewRange(true);+ $end = Navigation::addPeriod($end, $range);// Make a resource out of the data and$parameters = new ParameterBag();diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.phpindex 9f675b93a9..776a4e2239 100644--- a/app/Http/Controllers/Budget/IndexController.php+++ b/app/Http/Controllers/Budget/IndexController.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Budget;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Http\Controllers\Controller;@@ -94,11 +95,11 @@ class IndexController extends ControllerLog::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);+ $range = 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);+ $end ??= Navigation::endOfPeriod($start, $range);}// overrule start and end if necessary:@@ -112,7 +113,7 @@ class IndexController extends Controller$spent = '0';// new period stuff:- $periodTitle = app('navigation')->periodShow($start, $range);+ $periodTitle = Navigation::periodShow($start, $range);$prevLoop = $this->getPreviousPeriods($start, $range);$nextLoop = $this->getNextPeriods($start, $range);diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.phpindex 8cf2c2be9e..70aac51d3a 100644--- a/app/Http/Controllers/Chart/AccountController.php+++ b/app/Http/Controllers/Chart/AccountController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Enums\AccountTypeEnum;use FireflyIII\Enums\TransactionTypeEnum;@@ -514,7 +515,7 @@ class AccountController extends Controller// 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 = clone $start;- $current = app('navigation')->endOfX($current, $step, null);+ $current = Navigation::endOfX($current, $step, null);$format = (string)trans('config.month_and_day_js', [], $locale);$accountCurrency = $this->accountRepository->getAccountCurrency($account);Log::debug('Get and filter balance for entire range start');@@ -574,9 +575,9 @@ class AccountController extends Controller$label = $current->isoFormat($format);$return[$key]['entries'][$label] = $amount;}- $current = app('navigation')->addPeriod($current, $step);+ $current = Navigation::addPeriod($current, $step);// here too, to fix #8041, the data is corrected to the end of the period.- $current = app('navigation')->endOfX($current, $step, null);+ $current = Navigation::endOfX($current, $step, null);}Log::debug('End of chart loop.');// second loop (yes) to create nice array with info! Yay!diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.phpindex 6e195311b3..8dbd4db7d4 100644--- a/app/Http/Controllers/Chart/CategoryController.php+++ b/app/Http/Controllers/Chart/CategoryController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Http\Controllers\Controller;@@ -81,8 +82,8 @@ 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);+ $range = Navigation::getViewRange(false);+ $start = Navigation::startOfPeriod($start, $range);$end = $this->getDate();/** @var WholePeriodChartGenerator $chartGenerator */@@ -178,8 +179,8 @@ class CategoryController extends Controller$income = $opsRepository->listIncome($start, $end, $accounts, $collection);}$currencies = array_unique(array_merge(array_keys($income), array_keys($expenses)));- $periods = app('navigation')->listOfPeriods($start, $end);- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);+ $periods = Navigation::listOfPeriods($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);$chartData = [];// make empty data array:// double foreach (bad) to make empty array:@@ -260,8 +261,8 @@ class CategoryController extends Controller*/public function specificPeriod(Category $category, Carbon $date): JsonResponse{- $range = app('navigation')->getViewRange(false);- $start = app('navigation')->startOfPeriod($date, $range);+ $range = Navigation::getViewRange(false);+ $start = Navigation::startOfPeriod($date, $range);$end = session()->get('end');if ($end < $start) {[$end, $start] = [$start, $end];diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.phpindex 107509cece..9cce66c5d4 100644--- a/app/Http/Controllers/Chart/CategoryReportController.php+++ b/app/Http/Controllers/Chart/CategoryReportController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Http\Controllers\Controller;@@ -210,7 +211,7 @@ class CategoryReportController extends Controller$chartData = [];$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection()->push($category));$earned = $this->opsRepository->listIncome($start, $end, $accounts, new Collection()->push($category));- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);// loop expenses.foreach ($spent as $currency) {// add things to chart Data for each currency:@@ -276,11 +277,11 @@ class CategoryReportController extends Controllerprivate function makeEntries(Carbon $start, Carbon $end): array{$return = [];- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);- $preferredRange = app('navigation')->preferredRangeFormat($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);+ $preferredRange = Navigation::preferredRangeFormat($start, $end);$currentStart = clone $start;while ($currentStart <= $end) {- $currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);+ $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange);$key = $currentStart->isoFormat($format);$return[$key] = '0';$currentStart = clone $currentEnd;diff --git a/app/Http/Controllers/Chart/DoubleReportController.php b/app/Http/Controllers/Chart/DoubleReportController.phpindex 12b75f9e23..aa096abae2 100644--- a/app/Http/Controllers/Chart/DoubleReportController.php+++ b/app/Http/Controllers/Chart/DoubleReportController.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Http\Controllers\Controller;@@ -154,7 +155,7 @@ class DoubleReportController extends Controller$accounts = $accounts->merge($opposing);$spent = $this->opsRepository->listExpenses($start, $end, $accounts);$earned = $this->opsRepository->listIncome($start, $end, $accounts);- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);// loop expenses.foreach ($spent as $currency) {@@ -238,11 +239,11 @@ class DoubleReportController extends Controllerprivate function makeEntries(Carbon $start, Carbon $end): array{$return = [];- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);- $preferredRange = app('navigation')->preferredRangeFormat($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);+ $preferredRange = Navigation::preferredRangeFormat($start, $end);$currentStart = clone $start;while ($currentStart <= $end) {- $currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);+ $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange);$key = $currentStart->isoFormat($format);$return[$key] = '0';$currentStart = clone $currentEnd;diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.phpindex d3806d846e..cfce4a2315 100644--- a/app/Http/Controllers/Chart/ExpenseReportController.php+++ b/app/Http/Controllers/Chart/ExpenseReportController.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Http\Controllers\Controller;@@ -83,8 +84,8 @@ class ExpenseReportController extends Controllerreturn response()->json($cache->get());}- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);- $function = app('navigation')->preferredEndOfPeriod($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);+ $function = Navigation::preferredEndOfPeriod($start, $end);$chartData = [];$currentStart = clone $start;$combined = $this->combineAccounts($expense);diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.phpindex c0db48f026..ed8a549951 100644--- a/app/Http/Controllers/Chart/PiggyBankController.php+++ b/app/Http/Controllers/Chart/PiggyBankController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Http\Controllers\Controller;@@ -92,7 +93,7 @@ class PiggyBankController extends Controller$currentSum = $filtered->sum('amount');$label = $oldest->isoFormat((string) trans('config.month_and_day_js', [], $locale));$chartData[$label] = $currentSum;- $oldest = app('navigation')->addPeriod($oldest, $step);+ $oldest = Navigation::addPeriod($oldest, $step);}$finalFiltered = $set->filter(static fn (PiggyBankEvent $event) => $event->date->lte($today)diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.phpindex 5ccd3a0d10..f11c6a3df0 100644--- a/app/Http/Controllers/Chart/ReportController.php+++ b/app/Http/Controllers/Chart/ReportController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Enums\TransactionTypeEnum;use FireflyIII\Generator\Chart\Basic\GeneratorInterface;@@ -154,9 +155,9 @@ class ReportController extends ControllerLog::debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());Log::debug(sprintf('Period: %s to %s', $start->toW3cString(), $end->toW3cString()));- $format = app('navigation')->preferredCarbonFormat($start, $end);- $titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);- $preferredRange = app('navigation')->preferredRangeFormat($start, $end);+ $format = Navigation::preferredCarbonFormat($start, $end);+ $titleFormat = Navigation::preferredCarbonLocalizedFormat($start, $end);+ $preferredRange = Navigation::preferredRangeFormat($start, $end);$ids = $accounts->pluck('id')->toArray();$data = [];$chartData = [];@@ -242,7 +243,7 @@ class ReportController extends Controller// #8374. Sloppy fix for yearly charts. Not really interested in a better fix with v2 layout and all.if ('1Y' === $preferredRange) {- $currentEnd = app('navigation')->endOfPeriod($currentEnd, $preferredRange);+ $currentEnd = Navigation::endOfPeriod($currentEnd, $preferredRange);}Log::debug('Start of sub-loop');while ($currentStart <= $currentEnd) {@@ -260,7 +261,7 @@ class ReportController extends Controller$expense['entries'][$title] = '0';}- $currentStart = app('navigation')->addPeriod($currentStart, $preferredRange);+ $currentStart = Navigation::addPeriod($currentStart, $preferredRange);}Log::debug('End of sub-loop');diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.phpindex 6705377806..8bee1ec38d 100644--- a/app/Http/Controllers/Chart/TagReportController.php+++ b/app/Http/Controllers/Chart/TagReportController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Generator\Chart\Basic\GeneratorInterface;use FireflyIII\Http\Controllers\Controller;@@ -214,7 +215,7 @@ class TagReportController extends Controller$chartData = [];$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection()->push($tag));$earned = $this->opsRepository->listIncome($start, $end, $accounts, new Collection()->push($tag));- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);// loop expenses.foreach ($spent as $currency) {@@ -281,11 +282,11 @@ class TagReportController extends Controllerprivate function makeEntries(Carbon $start, Carbon $end): array{$return = [];- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);- $preferredRange = app('navigation')->preferredRangeFormat($start, $end);+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);+ $preferredRange = Navigation::preferredRangeFormat($start, $end);$currentStart = clone $start;while ($currentStart <= $end) {- $currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);+ $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange);$key = $currentStart->isoFormat($format);$return[$key] = '0';$currentStart = clone $currentEnd;diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.phpindex 229f853f3c..3d3badcd3f 100644--- a/app/Http/Controllers/PreferencesController.php+++ b/app/Http/Controllers/PreferencesController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Enums\AccountTypeEnum;use FireflyIII\Events\Preferences\UserGroupChangedPrimaryCurrency;@@ -101,7 +102,7 @@ class PreferencesController extends Controller/** @var array<int, int> $accountIds */$accountIds = $accounts->pluck('id')->toArray();- $viewRange = app('navigation')->getViewRange(false);+ $viewRange = Navigation::getViewRange(false);$frontpageAccountsPref = Preferences::get('frontpageAccounts', $accountIds);$frontpageAccounts = $frontpageAccountsPref->data;if (!is_array($frontpageAccounts)) {diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.phpindex ae4adb23de..1d3a9058a3 100644--- a/app/Http/Controllers/Report/CategoryController.php+++ b/app/Http/Controllers/Report/CategoryController.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Controllers\Report;+use FireflyIII\Support\Facades\Navigation;use Illuminate\Support\Facades\Log;use Carbon\Carbon;use FireflyIII\Exceptions\FireflyException;@@ -485,7 +486,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 = Navigation::preferredCarbonFormat($start, $end);if ('Y' === $format) {$start->startOfYear();@@ -494,7 +495,7 @@ class CategoryController extends Controller$start->startOfMonth();}- $periods = app('navigation')->listOfPeriods($start, $end);+ $periods = Navigation::listOfPeriods($start, $end);$data = [];$with = $this->opsRepository->listExpenses($start, $end, $accounts);$without = $this->noCatRepository->listExpenses($start, $end, $accounts);@@ -559,7 +560,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 = Navigation::preferredCarbonFormat($start, $end);if ('Y' === $format) {$start->startOfYear();@@ -568,7 +569,7 @@ class CategoryController extends Controller$start->startOfMonth();}- $periods = app('navigation')->listOfPeriods($start, $end);+ $periods = Navigation::listOfPeriods($start, $end);$data = [];$with = $this->opsRepository->listIncome($start, $end, $accounts);$without = $this->noCatRepository->listIncome($start, $end, $accounts);diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.phpindex b9a3ff0292..3d604b4afe 100644--- a/app/Http/Middleware/Range.php+++ b/app/Http/Middleware/Range.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Http\Middleware;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use Closure;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;@@ -75,8 +76,8 @@ class Range}$today = today(config('app.timezone'));- $start = app('navigation')->updateStartDate((string) $viewRange, $today);- $end = app('navigation')->updateEndDate((string) $viewRange, $start);+ $start = Navigation::updateStartDate((string) $viewRange, $today);+ $end = Navigation::updateEndDate((string) $viewRange, $start);app('session')->put('start', $start);app('session')->put('end', $end);diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.phpindex e9779d0bc0..e645306a99 100644--- a/app/Jobs/CreateAutoBudgetLimits.php+++ b/app/Jobs/CreateAutoBudgetLimits.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Jobs;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Enums\AutoBudgetType;use FireflyIII\Exceptions\FireflyException;@@ -122,8 +123,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 = Navigation::startOfPeriod($this->date, $autoBudget->period);+ $end = Navigation::endOfPeriod($start, $autoBudget->period);// find budget limit:$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $start, $end);@@ -237,12 +238,12 @@ class CreateAutoBudgetLimits implements ShouldQueue{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 = Navigation::startOfPeriod($this->date, $autoBudget->period);+ $end = Navigation::endOfPeriod($start, $autoBudget->period);// which means previous period:- $previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);- $previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);+ $previousStart = Navigation::subtractPeriod($start, $autoBudget->period);+ $previousEnd = Navigation::endOfPeriod($previousStart, $autoBudget->period);Log::debug(sprintf(@@ -297,12 +298,12 @@ class CreateAutoBudgetLimits implements ShouldQueue{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 = Navigation::startOfPeriod($this->date, $autoBudget->period);+ $end = Navigation::endOfPeriod($start, $autoBudget->period);// which means previous period:- $previousStart = app('navigation')->subtractPeriod($start, $autoBudget->period);- $previousEnd = app('navigation')->endOfPeriod($previousStart, $autoBudget->period);+ $previousStart = Navigation::subtractPeriod($start, $autoBudget->period);+ $previousEnd = Navigation::endOfPeriod($previousStart, $autoBudget->period);Log::debug(sprintf(diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.phpindex f33d339cc6..0f8fe684b8 100644--- a/app/Repositories/Bill/BillRepository.php+++ b/app/Repositories/Bill/BillRepository.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Repositories\Bill;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Factory\BillFactory;@@ -463,11 +464,11 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterfacewhile ($start < $date) {Log::debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d H:i:s'), $date->format('Y-m-d H:i:s')));- $start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);+ $start = Navigation::addPeriod($start, $bill->repeat_freq, $bill->skip);Log::debug('Start is now '.$start->format('Y-m-d H:i:s'));}- $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);+ $end = Navigation::addPeriod($start, $bill->repeat_freq, $bill->skip);$end->endOfDay();// see if the bill was paid in this period.@@ -477,7 +478,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface// this period had in fact a bill. The new start is the current end, and we create a new end.Log::debug(sprintf('Journal count is %d, so start becomes %s', $journalCount, $end->format('Y-m-d')));$start = clone $end;- $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);+ $end = Navigation::addPeriod($start, $bill->repeat_freq, $bill->skip);}Log::debug('nextExpectedMatch: Final start is '.$start->format('Y-m-d'));Log::debug('nextExpectedMatch: Matching end is '.$end->format('Y-m-d'));@@ -681,7 +682,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface$start = clone $bill->date;while ($start < $date) {- $start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip);+ $start = Navigation::addPeriod($start, $bill->repeat_freq, $bill->skip);}$cache->store($start);diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 3714176818..36d7cd9f00 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -23,6 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Repositories\Budget;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Enums\AutoBudgetType;use FireflyIII\Enums\TransactionTypeEnum;@@ -790,8 +791,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface// create initial budget limit.$today = today(config('app.timezone'));- $start = app('navigation')->startOfPeriod($today, $autoBudget->period);- $end = app('navigation')->endOfPeriod($start, $autoBudget->period);+ $start = Navigation::startOfPeriod($today, $autoBudget->period);+ $end = Navigation::endOfPeriod($start, $autoBudget->period);$limitRepos = app(BudgetLimitRepositoryInterface::class);$limitRepos->setUser($this->user);diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.phpindex 3b5709b18b..6d53f9c243 100644--- a/app/Repositories/Budget/NoBudgetRepository.php+++ b/app/Repositories/Budget/NoBudgetRepository.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Repositories\Budget;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Enums\TransactionTypeEnum;use FireflyIII\Helpers\Collector\GroupCollectorInterface;@@ -45,7 +46,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf#[Deprecated]public function getNoBudgetPeriodReport(Collection $accounts, Carbon $start, Carbon $end): array{- $carbonFormat = app('navigation')->preferredCarbonFormat($start, $end);+ $carbonFormat = Navigation::preferredCarbonFormat($start, $end);/** @var GroupCollectorInterface $collector */$collector = app(GroupCollectorInterface::class);diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.phpindex 157e9ca4af..15d3ea38f9 100644--- a/app/Repositories/Budget/OperationsRepository.php+++ b/app/Repositories/Budget/OperationsRepository.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Repositories\Budget;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use Deprecated;use FireflyIII\Enums\TransactionTypeEnum;@@ -82,7 +83,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn#[Deprecated]public function getBudgetPeriodReport(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): array{- $carbonFormat = app('navigation')->preferredCarbonFormat($start, $end);+ $carbonFormat = Navigation::preferredCarbonFormat($start, $end);$data = [];// get all transactions:diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex c249f834a4..481418b225 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -76,7 +76,6 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac*/public function firstNull(): ?TransactionJournal{- /** @var null|TransactionJournal $entry */return $this->user->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);}@@ -113,7 +112,6 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfacpublic function getLast(): ?TransactionJournal{- /** @var null|TransactionJournal $entry */return $this->user->transactionJournals()->orderBy('date', 'DESC')->first(['transaction_journals.*']);}diff --git a/app/Support/Chart/Category/WholePeriodChartGenerator.php b/app/Support/Chart/Category/WholePeriodChartGenerator.phpindex 27d6026c2f..e0ea91ac9a 100644--- a/app/Support/Chart/Category/WholePeriodChartGenerator.php+++ b/app/Support/Chart/Category/WholePeriodChartGenerator.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Support\Chart\Category;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Enums\AccountTypeEnum;use FireflyIII\Models\Category;@@ -59,10 +60,10 @@ class WholePeriodChartGeneratorwhile ($current <= $end) {$key = $current->format('Y-m-d');- $currentEnd = app('navigation')->endOfPeriod($current, $step);+ $currentEnd = Navigation::endOfPeriod($current, $step);$spent[$key] = $opsRepository->sumExpenses($current, $currentEnd, $accounts, $collection);$earned[$key] = $opsRepository->sumIncome($current, $currentEnd, $accounts, $collection);- $current = app('navigation')->addPeriod($current, $step);+ $current = Navigation::addPeriod($current, $step);}$currencies = $this->extractCurrencies($spent) + $this->extractCurrencies($earned);@@ -91,7 +92,7 @@ class WholePeriodChartGeneratorwhile ($current <= $end) {$key = $current->format('Y-m-d');- $label = app('navigation')->periodShow($current, $step);+ $label = Navigation::periodShow($current, $step);/** @var array $currency */foreach ($currencies as $currency) {@@ -104,7 +105,7 @@ class WholePeriodChartGenerator$chartData[$spentInfoKey]['entries'][$label] = app('steam')->bcround($spentAmount, $currency['currency_decimal_places']);$chartData[$earnedInfoKey]['entries'][$label] = app('steam')->bcround($earnedAmount, $currency['currency_decimal_places']);}- $current = app('navigation')->addPeriod($current, $step);+ $current = Navigation::addPeriod($current, $step);}return $chartData;diff --git a/app/Support/Http/Api/AccountFilter.php b/app/Support/Http/Api/AccountFilter.phpindex 1cce125919..dcc74dcd21 100644--- a/app/Support/Http/Api/AccountFilter.php+++ b/app/Support/Http/Api/AccountFilter.php@@ -107,7 +107,7 @@ trait AccountFilter}if (0 === count($return)) {- $return = $this->types['normal'];+ return $this->types['normal'];}return $return;diff --git a/app/Support/Http/Controllers/DateCalculation.php b/app/Support/Http/Controllers/DateCalculation.phpindex 69c30c77d3..f8d2204e21 100644--- a/app/Support/Http/Controllers/DateCalculation.php+++ b/app/Support/Http/Controllers/DateCalculation.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Support\Http\Controllers;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;/**@@ -93,18 +94,18 @@ trait DateCalculation$loop = [];/** @var Carbon $current */- $current = app('navigation')->startOfPeriod($date, $range);- $current = app('navigation')->endOfPeriod($current, $range);+ $current = Navigation::startOfPeriod($date, $range);+ $current = Navigation::endOfPeriod($current, $range);$current->addDay();$count = 0;while ($count < 12) {- $current = app('navigation')->endOfPeriod($current, $range);- $currentStart = app('navigation')->startOfPeriod($current, $range);+ $current = Navigation::endOfPeriod($current, $range);+ $currentStart = Navigation::startOfPeriod($current, $range);$loop[] = ['label' => $current->format('Y-m-d'),- 'title' => app('navigation')->periodShow($current, $range),+ 'title' => Navigation::periodShow($current, $range),'start' => clone $currentStart,'end' => clone $current,];@@ -125,15 +126,15 @@ trait DateCalculation$loop = [];/** @var Carbon $current */- $current = app('navigation')->startOfPeriod($date, $range);+ $current = Navigation::startOfPeriod($date, $range);$count = 0;while ($count < 12) {$current->subDay();- $current = app('navigation')->startOfPeriod($current, $range);- $currentEnd = app('navigation')->endOfPeriod($current, $range);+ $current = Navigation::startOfPeriod($current, $range);+ $currentEnd = Navigation::endOfPeriod($current, $range);$loop[] = ['label' => $current->format('Y-m-d'),- 'title' => app('navigation')->periodShow($current, $range),+ 'title' => Navigation::periodShow($current, $range),'start' => clone $current,'end' => clone $currentEnd,];diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.phpindex d1f28200e0..2ea8527419 100644--- a/app/Support/Http/Controllers/GetConfigurationData.php+++ b/app/Support/Http/Controllers/GetConfigurationData.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Support\Http\Controllers;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Support\Facades\FireflyConfig;@@ -82,7 +83,7 @@ trait GetConfigurationData*/protected function getDateRangeConfig(): array // get configuration + get preferences.{- $viewRange = app('navigation')->getViewRange(false);+ $viewRange = Navigation::getViewRange(false);Log::debug(sprintf('dateRange: the view range is "%s"', $viewRange));@@ -105,32 +106,32 @@ trait GetConfigurationData// when current range is a custom range, add the current period as the next range.if ($isCustom) {- $index = app('navigation')->periodShow($start, $viewRange);- $customPeriodStart = app('navigation')->startOfPeriod($start, $viewRange);- $customPeriodEnd = app('navigation')->endOfPeriod($customPeriodStart, $viewRange);+ $index = Navigation::periodShow($start, $viewRange);+ $customPeriodStart = Navigation::startOfPeriod($start, $viewRange);+ $customPeriodEnd = Navigation::endOfPeriod($customPeriodStart, $viewRange);$ranges[$index] = [$customPeriodStart, $customPeriodEnd];}// then add previous range and next range, but skip this for the lastX and YTD stuff.if (!in_array($viewRange, config('firefly.dynamic_date_ranges', []), true)) {- $previousDate = app('navigation')->subtractPeriod($start, $viewRange);- $index = app('navigation')->periodShow($previousDate, $viewRange);- $previousStart = app('navigation')->startOfPeriod($previousDate, $viewRange);- $previousEnd = app('navigation')->endOfPeriod($previousStart, $viewRange);+ $previousDate = Navigation::subtractPeriod($start, $viewRange);+ $index = Navigation::periodShow($previousDate, $viewRange);+ $previousStart = Navigation::startOfPeriod($previousDate, $viewRange);+ $previousEnd = Navigation::endOfPeriod($previousStart, $viewRange);$ranges[$index] = [$previousStart, $previousEnd];- $nextDate = app('navigation')->addPeriod($start, $viewRange);- $index = app('navigation')->periodShow($nextDate, $viewRange);- $nextStart = app('navigation')->startOfPeriod($nextDate, $viewRange);- $nextEnd = app('navigation')->endOfPeriod($nextStart, $viewRange);+ $nextDate = Navigation::addPeriod($start, $viewRange);+ $index = Navigation::periodShow($nextDate, $viewRange);+ $nextStart = Navigation::startOfPeriod($nextDate, $viewRange);+ $nextEnd = Navigation::endOfPeriod($nextStart, $viewRange);$ranges[$index] = [$nextStart, $nextEnd];}// today:/** @var Carbon $todayStart */- $todayStart = app('navigation')->startOfPeriod($today, $viewRange);+ $todayStart = Navigation::startOfPeriod($today, $viewRange);/** @var Carbon $todayEnd */- $todayEnd = app('navigation')->endOfPeriod($todayStart, $viewRange);+ $todayEnd = Navigation::endOfPeriod($todayStart, $viewRange);if ($todayStart->ne($start) || $todayEnd->ne($end)) {$ranges[ucfirst((string)trans('firefly.today'))] = [$todayStart, $todayEnd];diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.phpindex 6257cf8426..7010a1de18 100644--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php@@ -69,7 +69,6 @@ class RecurringEnrichment implements EnrichmentInterfaceprivate string $language = 'en_US';private array $notes = [];private readonly TransactionCurrency $primaryCurrency;- private array $recurrenceIds = [];private array $recurrenceByTransaction = [];private array $repetitions = [];private array $sourceAccountIds = [];diff --git a/app/Support/Models/BillDateCalculator.php b/app/Support/Models/BillDateCalculator.phpindex 6b7cbd2243..d29244e726 100644--- a/app/Support/Models/BillDateCalculator.php+++ b/app/Support/Models/BillDateCalculator.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Support\Models;+use FireflyIII\Support\Facades\Navigation;use Carbon\Carbon;use Illuminate\Support\Collection;use Illuminate\Support\Facades\Log;@@ -49,7 +50,7 @@ class BillDateCalculatorLog::debug(sprintf('Dates must be between %s and %s.', $earliest->format('Y-m-d'), $latest->format('Y-m-d')));Log::debug(sprintf('Bill started on %s, period is "%s", skip is %d, last paid = "%s".', $billStart->format('Y-m-d'), $period, $skip, $lastPaid?->format('Y-m-d')));- $daysUntilEOM = app('navigation')->daysUntilEndOfMonth($billStart);+ $daysUntilEOM = Navigation::daysUntilEndOfMonth($billStart);Log::debug(sprintf('For bill start, days until end of month is %d', $daysUntilEOM));$set = new Collection();@@ -94,7 +95,7 @@ class BillDateCalculator// the next expected month because that month has only 28 days (i.e. february).// this applies to leap years as well.if ($daysUntilEOM < 4) {- $nextUntilEOM = app('navigation')->daysUntilEndOfMonth($nextExpectedMatch);+ $nextUntilEOM = Navigation::daysUntilEndOfMonth($nextExpectedMatch);$diffEOM = $daysUntilEOM - $nextUntilEOM;if ($diffEOM > 0) {Log::debug(sprintf('Bill start is %d days from the end of the month. nextExceptedMatch is %d days from the end of the month.', $daysUntilEOM, $nextUntilEOM));@@ -140,7 +141,7 @@ class BillDateCalculatorreturn $billStartDate;}- $steps = app('navigation')->diffInPeriods($period, $skip, $earliest, $billStartDate);+ $steps = Navigation::diffInPeriods($period, $skip, $earliest, $billStartDate);if ($steps === $this->diffInMonths) {Log::debug(sprintf('Steps is %d, which is the same as diffInMonths (%d), so we add another 1.', $steps, $this->diffInMonths));++$steps;@@ -150,7 +151,7 @@ class BillDateCalculatorif ($steps > 0) {--$steps;Log::debug(sprintf('Steps is %d, because addPeriod already adds 1.', $steps));- $result = app('navigation')->addPeriod($billStartDate, $period, $steps);+ $result = Navigation::addPeriod($billStartDate, $period, $steps);}Log::debug(sprintf('Number of steps is %d, added to %s, result is %s', $steps, $billStartDate->format('Y-m-d'), $result->format('Y-m-d')));diff --git a/app/Support/Navigation.php b/app/Support/Navigation.phpindex b80548d990..eeaa7714e2 100644--- a/app/Support/Navigation.php+++ b/app/Support/Navigation.php@@ -121,8 +121,8 @@ class Navigationif ($workEnd->gt($start)) {while ($workEnd->gt($start) && $loopCount < 20) {// make range:- $workStart = app('navigation')->startOfPeriod($workStart, '1Y');- $workEnd = app('navigation')->endOfPeriod($workStart, '1Y');+ $workStart = \FireflyIII\Support\Facades\Navigation::startOfPeriod($workStart, '1Y');+ $workEnd = \FireflyIII\Support\Facades\Navigation::endOfPeriod($workStart, '1Y');// make sure we don't go overboardif ($workEnd->gt($start)) {