diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php
index 5fe258067c..ad812baa5a 100644
--- a/app/Handlers/Events/AdminEventHandler.php
+++ b/app/Handlers/Events/AdminEventHandler.php
@@ -140,10 +140,10 @@ class AdminEventHandler
break;
- case 'ntfy':
- $class = OwnerTestNotificationNtfy::class;
-
- break;
+// case 'ntfy':
+// $class = OwnerTestNotificationNtfy::class;
+//
+// break;
case 'pushover':
$class = OwnerTestNotificationPushover::class;
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index ebe0cca9f6..f7a0404672 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -411,10 +411,10 @@ class UserEventHandler
break;
- case 'ntfy':
- $class = UserTestNotificationNtfy::class;
-
- break;
+// case 'ntfy':
+// $class = UserTestNotificationNtfy::class;
+//
+// break;
case 'pushover':
$class = UserTestNotificationPushover::class;
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 49433fb8eb..4c47208824 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -38,6 +38,7 @@ use FireflyIII\Repositories\Budget\NoBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Chart\Budget\FrontpageChartGenerator;
+use FireflyIII\Support\Facades\Navigation;
use FireflyIII\Support\Http\Controllers\AugumentData;
use FireflyIII\Support\Http\Controllers\DateCalculation;
use Illuminate\Http\JsonResponse;
@@ -102,14 +103,14 @@ class BudgetController extends Controller
$collection = new Collection([$budget]);
$chartData = [];
$loopStart = clone $start;
- $loopStart = app('navigation')->startOfPeriod($loopStart, $step);
+ $loopStart = Navigation::startOfPeriod($loopStart, $step);
$currencies = [];
$defaultEntries = [];
while ($end >= $loopStart) {
/** @var Carbon $loopEnd */
- $loopEnd = app('navigation')->endOfPeriod($loopStart, $step);
+ $loopEnd = Navigation::endOfPeriod($loopStart, $step);
$spent = $this->opsRepository->sumExpenses($loopStart, $loopEnd, null, $collection); // this method already converts to primary currency.
- $label = trim((string) app('navigation')->periodShow($loopStart, $step));
+ $label = trim(Navigation::periodShow($loopStart, $step));
foreach ($spent as $row) {
$currencyId = $row['currency_id'];
@@ -496,8 +497,8 @@ class BudgetController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
- $titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
- $preferredRange = app('navigation')->preferredRangeFormat($start, $end);
+ $titleFormat = Navigation::preferredCarbonLocalizedFormat($start, $end);
+ $preferredRange = Navigation::preferredRangeFormat($start, $end);
$chartData = [
[
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency->name]),
@@ -517,9 +518,9 @@ class BudgetController extends Controller
$currentStart = clone $start;
while ($currentStart <= $end) {
- $currentStart = app('navigation')->startOfPeriod($currentStart, $preferredRange);
+ $currentStart = Navigation::startOfPeriod($currentStart, $preferredRange);
$title = $currentStart->isoFormat($titleFormat);
- $currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);
+ $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange);
// default limit is no limit:
$chartData[0]['entries'][$title] = 0;
@@ -565,17 +566,17 @@ class BudgetController extends Controller
}
// the expenses:
- $titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
+ $titleFormat = Navigation::preferredCarbonLocalizedFormat($start, $end);
$chartData = [];
$currentStart = clone $start;
- $preferredRange = app('navigation')->preferredRangeFormat($start, $end);
+ $preferredRange = Navigation::preferredRangeFormat($start, $end);
while ($currentStart <= $end) {
- $currentEnd = app('navigation')->endOfPeriod($currentStart, $preferredRange);
+ $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange);
$title = $currentStart->isoFormat($titleFormat);
$sum = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency);
$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');
$chartData[$title] = app('steam')->bcround($amount, $currency->decimal_places);
- $currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);
+ $currentStart = Navigation::addPeriod($currentStart, $preferredRange, 0);
}
$data = $this->generator->singleSet((string) trans('firefly.spent'), $chartData);
diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.php
index aee1d2a958..b940c18ca1 100644
--- a/app/Http/Controllers/Chart/BudgetReportController.php
+++ b/app/Http/Controllers/Chart/BudgetReportController.php
@@ -29,6 +29,8 @@ use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
+use FireflyIII\Support\Facades\Navigation;
+use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Controllers\AugumentData;
use FireflyIII\Support\Http\Controllers\TransactionCalculation;
use Illuminate\Http\JsonResponse;
@@ -84,8 +86,8 @@ class BudgetReportController extends Controller
'currency_code' => $currency['currency_code'],
];
foreach ($budget['transaction_journals'] as $journal) {
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -114,8 +116,8 @@ class BudgetReportController extends Controller
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -144,8 +146,8 @@ class BudgetReportController extends Controller
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -162,7 +164,7 @@ class BudgetReportController extends Controller
{
$chartData = [];
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection([$budget]));
- $format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
+ $format = Navigation::preferredCarbonLocalizedFormat($start, $end);
// loop expenses.
foreach ($spent as $currency) {
@@ -184,9 +186,9 @@ class BudgetReportController extends Controller
foreach ($currency['budgets'] as $currentBudget) {
foreach ($currentBudget['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] ??= '0';
- $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], (string) $amount);
+ $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
}
@@ -199,11 +201,11 @@ class BudgetReportController extends Controller
private 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;
@@ -232,8 +234,8 @@ class BudgetReportController extends Controller
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index 8c86235325..a4e9ba5624 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -34,6 +34,7 @@ use FireflyIII\Repositories\Category\OperationsRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Chart\Category\FrontpageChartGenerator;
use FireflyIII\Support\Chart\Category\WholePeriodChartGenerator;
+use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Controllers\AugumentData;
use FireflyIII\Support\Http\Controllers\ChartGeneration;
use FireflyIII\Support\Http\Controllers\DateCalculation;
@@ -211,19 +212,19 @@ class CategoryController extends Controller
// loop income and expenses for this category.:
$outSet = $expenses[$currencyId]['categories'][$categoryId] ?? ['transaction_journals' => []];
foreach ($outSet['transaction_journals'] as $journal) {
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$date = $journal['date']->isoFormat($format);
$chartData[$outKey]['entries'][$date] ??= '0';
- $chartData[$outKey]['entries'][$date] = bcadd((string) $amount, $chartData[$outKey]['entries'][$date]);
+ $chartData[$outKey]['entries'][$date] = bcadd($amount, $chartData[$outKey]['entries'][$date]);
}
$inSet = $income[$currencyId]['categories'][$categoryId] ?? ['transaction_journals' => []];
foreach ($inSet['transaction_journals'] as $journal) {
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$date = $journal['date']->isoFormat($format);
$chartData[$inKey]['entries'][$date] ??= '0';
- $chartData[$inKey]['entries'][$date] = bcadd((string) $amount, $chartData[$inKey]['entries'][$date]);
+ $chartData[$inKey]['entries'][$date] = bcadd($amount, $chartData[$inKey]['entries'][$date]);
}
}
diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php
index 14fc29bb7a..a45df44718 100644
--- a/app/Http/Controllers/Chart/CategoryReportController.php
+++ b/app/Http/Controllers/Chart/CategoryReportController.php
@@ -28,6 +28,7 @@ use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\OperationsRepositoryInterface;
+use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Controllers\AugumentData;
use FireflyIII\Support\Http\Controllers\TransactionCalculation;
use Illuminate\Http\JsonResponse;
@@ -82,8 +83,8 @@ class CategoryReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -109,8 +110,8 @@ class CategoryReportController extends Controller
'currency_code' => $currency['currency_code'],
];
foreach ($category['transaction_journals'] as $journal) {
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -137,8 +138,8 @@ class CategoryReportController extends Controller
'currency_code' => $currency['currency_code'],
];
foreach ($category['transaction_journals'] as $journal) {
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -165,8 +166,8 @@ class CategoryReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -193,8 +194,8 @@ class CategoryReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -230,9 +231,9 @@ class CategoryReportController extends Controller
foreach ($currency['categories'] as $currentCategory) {
foreach ($currentCategory['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] ??= '0';
- $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], (string) $amount);
+ $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
}
@@ -257,9 +258,9 @@ class CategoryReportController extends Controller
foreach ($currency['categories'] as $currentCategory) {
foreach ($currentCategory['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] ??= '0';
- $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], (string) $amount);
+ $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
}
@@ -306,8 +307,8 @@ class CategoryReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -334,8 +335,8 @@ class CategoryReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
diff --git a/app/Http/Controllers/Chart/DoubleReportController.php b/app/Http/Controllers/Chart/DoubleReportController.php
index 1e88ceaa5d..4394ad1463 100644
--- a/app/Http/Controllers/Chart/DoubleReportController.php
+++ b/app/Http/Controllers/Chart/DoubleReportController.php
@@ -30,6 +30,7 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\OperationsRepositoryInterface;
+use FireflyIII\Support\Facades\Steam;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
@@ -81,8 +82,8 @@ class DoubleReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
@@ -108,8 +109,8 @@ class DoubleReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
@@ -135,8 +136,8 @@ class DoubleReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
@@ -176,9 +177,9 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] ??= '0';
- $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], (string) $amount);
+ $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
// loop income.
@@ -202,9 +203,9 @@ class DoubleReportController extends Controller
foreach ($currency['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$chartData[$earnedKey]['entries'][$key] ??= '0';
- $chartData[$earnedKey]['entries'][$key] = bcadd($chartData[$earnedKey]['entries'][$key], (string) $amount);
+ $chartData[$earnedKey]['entries'][$key] = bcadd($chartData[$earnedKey]['entries'][$key], $amount);
}
}
@@ -274,8 +275,8 @@ class DoubleReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
// loop each tag:
@@ -293,8 +294,8 @@ class DoubleReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -327,8 +328,8 @@ class DoubleReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
// loop each tag:
@@ -346,8 +347,8 @@ class DoubleReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php
index 6dbb91ac9a..9809c24140 100644
--- a/app/Http/Controllers/Chart/ReportController.php
+++ b/app/Http/Controllers/Chart/ReportController.php
@@ -32,6 +32,7 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\CacheProperties;
+use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Controllers\BasicDataSupport;
use FireflyIII\Support\Http\Controllers\ChartGeneration;
use Illuminate\Http\JsonResponse;
@@ -73,7 +74,7 @@ class ReportController extends Controller
if ($cache->has()) {
return response()->json($cache->get());
}
- $locale = app('steam')->getLocale();
+ $locale = Steam::getLocale();
$current = clone $start;
$chartData = [];
@@ -193,7 +194,7 @@ class ReportController extends Controller
];
// in our outgoing?
$key = 'spent';
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
// deposit = incoming
// transfer or reconcile or opening balance, and these accounts are the destination.
@@ -207,7 +208,7 @@ class ReportController extends Controller
&& in_array($journal['destination_account_id'], $ids, true))) {
$key = 'earned';
}
- $data[$currencyId][$period][$key] = bcadd((string) $data[$currencyId][$period][$key], (string) $amount);
+ $data[$currencyId][$period][$key] = bcadd((string) $data[$currencyId][$period][$key], $amount);
}
// loop this data, make chart bars for each currency:
@@ -250,8 +251,8 @@ class ReportController extends Controller
$title = $currentStart->isoFormat($titleFormat);
// #8663 make sure the period exists in the data previously collected.
if (array_key_exists($key, $currency)) {
- $income['entries'][$title] = app('steam')->bcround($currency[$key]['earned'] ?? '0', $currency['currency_decimal_places']);
- $expense['entries'][$title] = app('steam')->bcround($currency[$key]['spent'] ?? '0', $currency['currency_decimal_places']);
+ $income['entries'][$title] = Steam::bcround($currency[$key]['earned'] ?? '0', $currency['currency_decimal_places']);
+ $expense['entries'][$title] = Steam::bcround($currency[$key]['spent'] ?? '0', $currency['currency_decimal_places']);
}
// #9477 if the period is not in the data, add it with zero values.
if (!array_key_exists($key, $currency)) {
diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.php
index dbc9451834..a81013785c 100644
--- a/app/Http/Controllers/Chart/TagReportController.php
+++ b/app/Http/Controllers/Chart/TagReportController.php
@@ -28,6 +28,7 @@ use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\OperationsRepositoryInterface;
+use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Controllers\AugumentData;
use FireflyIII\Support\Http\Controllers\TransactionCalculation;
use Illuminate\Http\JsonResponse;
@@ -82,8 +83,8 @@ class TagReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -110,8 +111,8 @@ class TagReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -138,8 +139,8 @@ class TagReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -166,8 +167,8 @@ class TagReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -194,8 +195,8 @@ class TagReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -235,9 +236,9 @@ class TagReportController extends Controller
foreach ($currency['tags'] as $currentTag) {
foreach ($currentTag['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] ??= '0';
- $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], (string) $amount);
+ $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
}
@@ -262,9 +263,9 @@ class TagReportController extends Controller
foreach ($currency['tags'] as $currentTag) {
foreach ($currentTag['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
$chartData[$spentKey]['entries'][$key] ??= '0';
- $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], (string) $amount);
+ $chartData[$spentKey]['entries'][$key] = bcadd($chartData[$spentKey]['entries'][$key], $amount);
}
}
}
@@ -311,8 +312,8 @@ class TagReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -339,8 +340,8 @@ class TagReportController extends Controller
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -366,8 +367,8 @@ class TagReportController extends Controller
'currency_code' => $currency['currency_code'],
];
foreach ($tag['transaction_journals'] as $journal) {
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
@@ -392,8 +393,8 @@ class TagReportController extends Controller
'currency_code' => $currency['currency_code'],
];
foreach ($tag['transaction_journals'] as $journal) {
- $amount = app('steam')->positive($journal['amount']);
- $result[$title]['amount'] = bcadd($result[$title]['amount'], (string) $amount);
+ $amount = Steam::positive($journal['amount']);
+ $result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
}
}
}
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index cdfa0c38f9..3dd4f98dcc 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -95,8 +95,8 @@ abstract class Controller extends BaseController
View::share('logoutUrl', $logoutUrl);
// upload size
- $maxFileSize = Steam::phpBytes((string) ini_get('upload_max_filesize'));
- $maxPostSize = Steam::phpBytes((string) ini_get('post_max_size'));
+ $maxFileSize = Steam::phpBytes( ini_get('upload_max_filesize'));
+ $maxPostSize = Steam::phpBytes( ini_get('post_max_size'));
$uploadSize = min($maxFileSize, $maxPostSize);
View::share('uploadSize', $uploadSize);
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index 3970980c15..09d81065b1 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -151,13 +151,13 @@ class DebugController extends Controller
}
if ('' !== $logContent) {
// last few lines
- $logContent = 'Truncated from this point <----|'.substr((string) $logContent, -16384);
+ $logContent = 'Truncated from this point <----|'.substr($logContent, -16384);
}
return view('debug', compact('table', 'now', 'logContent'));
}
- public function apiTest()
+ public function apiTest(): View
{
return view('test.api-test');
}
@@ -175,8 +175,8 @@ class DebugController extends Controller
private function getSystemInformation(): array
{
- $maxFileSize = Steam::phpBytes((string) ini_get('upload_max_filesize'));
- $maxPostSize = Steam::phpBytes((string) ini_get('post_max_size'));
+ $maxFileSize = Steam::phpBytes( ini_get('upload_max_filesize'));
+ $maxPostSize = Steam::phpBytes( ini_get('post_max_size'));
$drivers = DB::availableDrivers();
$currentDriver = DB::getDriverName();
@@ -208,7 +208,7 @@ class DebugController extends Controller
try {
if (file_exists('/var/www/counter-main.txt')) {
- $return['build'] = trim((string) file_get_contents('/var/www/counter-main.txt'));
+ $return['build'] = trim( file_get_contents('/var/www/counter-main.txt'));
app('log')->debug(sprintf('build is now "%s"', $return['build']));
}
} catch (Exception $e) {
@@ -218,7 +218,7 @@ class DebugController extends Controller
try {
if (file_exists('/var/www/build-date-main.txt')) {
- $return['build_date'] = trim((string) file_get_contents('/var/www/build-date-main.txt'));
+ $return['build_date'] = trim( file_get_contents('/var/www/build-date-main.txt'));
}
} catch (Exception $e) {
app('log')->debug('Could not check build date, but thats ok.');
diff --git a/app/Http/Controllers/PiggyBank/ShowController.php b/app/Http/Controllers/PiggyBank/ShowController.php
index 3783708c2e..faf72e7422 100644
--- a/app/Http/Controllers/PiggyBank/ShowController.php
+++ b/app/Http/Controllers/PiggyBank/ShowController.php
@@ -82,6 +82,7 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new PiggyBankEnrichment();
$enrichment->setUser($admin);
+ /** @var PiggyBank $piggyBank */
$piggyBank = $enrichment->enrichSingle($piggyBank);
/** @var PiggyBankTransformer $transformer */
diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php
index 71a09fd706..d6f0435eed 100644
--- a/app/Http/Controllers/PreferencesController.php
+++ b/app/Http/Controllers/PreferencesController.php
@@ -155,7 +155,7 @@ class PreferencesController extends Controller
// list of locales also has "equal" which makes it equal to whatever the language is.
try {
- $locales = json_decode((string) file_get_contents(resource_path(sprintf('locales/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR);
+ $locales = json_decode(file_get_contents(resource_path(sprintf('locales/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
app('log')->error($e->getMessage());
$locales = [];
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index e784c4fb7a..13052d733a 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -207,7 +207,7 @@ class ProfileController extends Controller
$existing = $repository->findByEmail($newEmail);
if ($existing instanceof User) {
// force user logout.
- Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
+ Auth::guard()->logout();
$request->session()->invalidate();
session()->flash('success', (string) trans('firefly.email_changed'));
@@ -221,7 +221,7 @@ class ProfileController extends Controller
event(new UserChangedEmail($user, $newEmail, $oldEmail));
// force user logout.
- Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
+ Auth::guard()->logout();
$request->session()->invalidate();
session()->flash('success', (string) trans('firefly.email_changed'));
diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php
index c7a776465b..a53c2e97c4 100644
--- a/app/Http/Controllers/Recurring/CreateController.php
+++ b/app/Http/Controllers/Recurring/CreateController.php
@@ -49,7 +49,7 @@ class CreateController extends Controller
private AttachmentHelperInterface $attachments;
private BillRepositoryInterface $billRepository;
private BudgetRepositoryInterface $budgetRepos;
- private RecurringRepositoryInterface $recurring;
+ private RecurringRepositoryInterface $repository;
/**
* CreateController constructor.
@@ -65,8 +65,8 @@ class CreateController extends Controller
app('view')->share('title', (string) trans('firefly.recurrences'));
app('view')->share('subTitle', (string) trans('firefly.create_new_recurrence'));
- $this->recurring = app(RecurringRepositoryInterface::class);
- $this->budgetRepos = app(BudgetRepositoryInterface::class);
+ $this->repository = app(RecurringRepositoryInterface::class);
+ $this->budgetRepos = app(BudgetRepositoryInterface::class);
$this->attachments = app(AttachmentHelperInterface::class);
$this->billRepository = app(BillRepositoryInterface::class);
@@ -221,7 +221,7 @@ class CreateController extends Controller
$data = $request->getAll();
try {
- $recurrence = $this->recurring->store($data);
+ $recurrence = $this->repository->store($data);
} catch (FireflyException $e) {
session()->flash('error', $e->getMessage());
diff --git a/app/Http/Controllers/Recurring/DeleteController.php b/app/Http/Controllers/Recurring/DeleteController.php
index 4cdc4c971f..5ddb8fff08 100644
--- a/app/Http/Controllers/Recurring/DeleteController.php
+++ b/app/Http/Controllers/Recurring/DeleteController.php
@@ -38,8 +38,7 @@ use Illuminate\View\View;
*/
class DeleteController extends Controller
{
- /** @var RecurringRepositoryInterface Recurring repository */
- private $recurring;
+ private RecurringRepositoryInterface $repository;
/**
* DeleteController constructor.
@@ -54,7 +53,7 @@ class DeleteController extends Controller
app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', (string) trans('firefly.recurrences'));
- $this->recurring = app(RecurringRepositoryInterface::class);
+ $this->repository = app(RecurringRepositoryInterface::class);
return $next($request);
}
@@ -72,7 +71,7 @@ class DeleteController extends Controller
// put previous url in session
$this->rememberPreviousUrl('recurrences.delete.url');
- $journalsCreated = $this->recurring->getTransactions($recurrence)->count();
+ $journalsCreated = $this->repository->getTransactions($recurrence)->count();
return view('recurring.delete', compact('recurrence', 'subTitle', 'journalsCreated'));
}
diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php
index b854ae99b8..5d1d51e35e 100644
--- a/app/Http/Controllers/Recurring/EditController.php
+++ b/app/Http/Controllers/Recurring/EditController.php
@@ -54,7 +54,7 @@ class EditController extends Controller
private AttachmentHelperInterface $attachments;
private BillRepositoryInterface $billRepository;
private BudgetRepositoryInterface $budgetRepos;
- private RecurringRepositoryInterface $recurring;
+ private RecurringRepositoryInterface $repository;
/**
* EditController constructor.
@@ -70,8 +70,8 @@ class EditController extends Controller
app('view')->share('title', (string) trans('firefly.recurrences'));
app('view')->share('subTitle', (string) trans('firefly.recurrences'));
- $this->recurring = app(RecurringRepositoryInterface::class);
- $this->budgetRepos = app(BudgetRepositoryInterface::class);
+ $this->repository = app(RecurringRepositoryInterface::class);
+ $this->budgetRepos = app(BudgetRepositoryInterface::class);
$this->attachments = app(AttachmentHelperInterface::class);
$this->billRepository = app(BillRepositoryInterface::class);
@@ -100,6 +100,7 @@ class EditController extends Controller
$admin = auth()->user();
$enrichment = new RecurringEnrichment();
$enrichment->setUser($admin);
+ /** @var Recurrence $recurrence */
$recurrence = $enrichment->enrichSingle($recurrence);
/** @var RecurrenceTransformer $transformer */
@@ -180,7 +181,7 @@ class EditController extends Controller
public function update(RecurrenceFormRequest $request, Recurrence $recurrence)
{
$data = $request->getAll();
- $this->recurring->update($recurrence, $data);
+ $this->repository->update($recurrence, $data);
$request->session()->flash('success', (string) trans('firefly.updated_recurrence', ['title' => $recurrence->title]));
Log::channel('audit')->info(sprintf('Updated recurrence #%d.', $recurrence->id), $data);
diff --git a/app/Http/Controllers/Recurring/IndexController.php b/app/Http/Controllers/Recurring/IndexController.php
index 773c36f916..d6c7e41d7f 100644
--- a/app/Http/Controllers/Recurring/IndexController.php
+++ b/app/Http/Controllers/Recurring/IndexController.php
@@ -45,7 +45,7 @@ class IndexController extends Controller
{
use GetConfigurationData;
- private RecurringRepositoryInterface $recurringRepos;
+ private RecurringRepositoryInterface $repository;
/**
* IndexController constructor.
@@ -60,7 +60,7 @@ class IndexController extends Controller
app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', (string) trans('firefly.recurrences'));
- $this->recurringRepos = app(RecurringRepositoryInterface::class);
+ $this->repository = app(RecurringRepositoryInterface::class);
return $next($request);
}
@@ -79,7 +79,7 @@ class IndexController extends Controller
{
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
- $collection = $this->recurringRepos->get();
+ $collection = $this->repository->get();
$today = today(config('app.timezone'));
$year = today(config('app.timezone'));
diff --git a/app/Http/Controllers/Recurring/ShowController.php b/app/Http/Controllers/Recurring/ShowController.php
index d44456fd11..b90cdfd2c5 100644
--- a/app/Http/Controllers/Recurring/ShowController.php
+++ b/app/Http/Controllers/Recurring/ShowController.php
@@ -47,8 +47,7 @@ class ShowController extends Controller
{
use GetConfigurationData;
- /** @var RecurringRepositoryInterface Recurring repository */
- private $recurring;
+ private RecurringRepositoryInterface $repository;
/**
* IndexController constructor.
@@ -64,7 +63,7 @@ class ShowController extends Controller
app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', (string) trans('firefly.recurrences'));
- $this->recurring = app(RecurringRepositoryInterface::class);
+ $this->repository = app(RecurringRepositoryInterface::class);
return $next($request);
}
@@ -87,6 +86,7 @@ class ShowController extends Controller
$admin = auth()->user();
$enrichment = new RecurringEnrichment();
$enrichment->setUser($admin);
+ /** @var Recurrence $recurrence */
$recurrence = $enrichment->enrichSingle($recurrence);
/** @var RecurrenceTransformer $transformer */
@@ -95,10 +95,10 @@ class ShowController extends Controller
$array = $transformer->transform($recurrence);
- $groups = $this->recurring->getTransactions($recurrence);
+ $groups = $this->repository->getTransactions($recurrence);
$today = today(config('app.timezone'));
$array['repeat_until'] = null !== $array['repeat_until'] ? new Carbon($array['repeat_until']) : null;
- $array['journal_count'] = $this->recurring->getJournalCount($recurrence);
+ $array['journal_count'] = $this->repository->getJournalCount($recurrence);
// transform dates back to Carbon objects and expand information
foreach ($array['repetitions'] as $index => $repetition) {
@@ -106,8 +106,8 @@ class ShowController extends Controller
$date = new Carbon($occurrence)->startOfDay();
$set = [
'date' => $date,
- 'fired' => $this->recurring->createdPreviously($recurrence, $date)
- || $this->recurring->getJournalCount($recurrence, $date) > 0,
+ 'fired' => $this->repository->createdPreviously($recurrence, $date)
+ || $this->repository->getJournalCount($recurrence, $date) > 0,
];
$array['repetitions'][$index]['occurrences'][$item] = $set;
}
diff --git a/app/Http/Controllers/Recurring/TriggerController.php b/app/Http/Controllers/Recurring/TriggerController.php
index 9ebfe64fac..1c33d3bb1d 100644
--- a/app/Http/Controllers/Recurring/TriggerController.php
+++ b/app/Http/Controllers/Recurring/TriggerController.php
@@ -28,6 +28,7 @@ use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\TriggerRecurrenceRequest;
use FireflyIII\Jobs\CreateRecurringTransactions;
use FireflyIII\Models\Recurrence;
+use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Support\Facades\Preferences;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Collection;
@@ -37,6 +38,28 @@ use Illuminate\Support\Collection;
*/
class TriggerController extends Controller
{
+ private RecurringRepositoryInterface $repository;
+
+ /**
+ * IndexController constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ app('view')->share('showCategory', true);
+
+ // translations:
+ $this->middleware(
+ function ($request, $next) {
+ app('view')->share('mainTitleIcon', 'fa-paint-brush');
+ app('view')->share('title', (string) trans('firefly.recurrences'));
+
+ $this->repository = app(RecurringRepositoryInterface::class);
+
+ return $next($request);
+ }
+ );
+ }
public function trigger(Recurrence $recurrence, TriggerRecurrenceRequest $request): RedirectResponse
{
$all = $request->getAll();
diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php
index 470048e852..add7602541 100644
--- a/app/Http/Controllers/Transaction/ConvertController.php
+++ b/app/Http/Controllers/Transaction/ConvertController.php
@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Transaction;
+use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use Exception;
use FireflyIII\Enums\AccountTypeEnum;
@@ -337,8 +338,9 @@ class ConvertController extends Controller
'type' => $transactionType->type,
];
+ /** @var Transaction|null $sourceTransaction */
$sourceTransaction = $journal->transactions()->where('amount', '<', 0)->first();
- $amount = $sourceTransaction?->amount ?? '0';
+ $amount = $sourceTransaction->amount ?? '0';
// also set the currency to the currency of the source account, in case you're converting a deposit into a transfer.
if (TransactionTypeEnum::TRANSFER->value === $transactionType->type && TransactionTypeEnum::DEPOSIT->value === $journal->transactionType->type) {
diff --git a/app/Http/Controllers/Transaction/ShowController.php b/app/Http/Controllers/Transaction/ShowController.php
index 81cfba7208..0081eece21 100644
--- a/app/Http/Controllers/Transaction/ShowController.php
+++ b/app/Http/Controllers/Transaction/ShowController.php
@@ -92,7 +92,7 @@ class ShowController extends Controller
$collector = app(GroupCollectorInterface::class);
$collector->setUser($admin)->setTransactionGroup($transactionGroup)->withAPIInformation();
- /** @var TransactionGroup $selectedGroup */
+ /** @var TransactionGroup|null $selectedGroup */
$selectedGroup = $collector->getGroups()->first();
if (null === $selectedGroup) {
throw new NotFoundHttpException();
@@ -119,6 +119,7 @@ class ShowController extends Controller
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
+ /** @var array $selectedGroup */
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
/** @var TransactionGroupTransformer $transformer */
diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php
index 3390515840..a9e7a705cd 100644
--- a/app/Http/Middleware/Range.php
+++ b/app/Http/Middleware/Range.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Middleware;
use Closure;
+use FireflyIII\Support\Facades\Steam;
use Illuminate\Support\Facades\App;
use Carbon\Carbon;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
@@ -101,12 +102,12 @@ class Range
private function configureView(): void
{
// get locale preference:
- $language = app('steam')->getLanguage();
- $locale = app('steam')->getLocale();
+ $language = Steam::getLanguage();
+ $locale = Steam::getLocale();
App::setLocale($language);
- Carbon::setLocale(substr((string) $locale, 0, 2));
+ Carbon::setLocale(substr($locale, 0, 2));
- $localeArray = app('steam')->getLocaleArray($locale);
+ $localeArray = Steam::getLocaleArray($locale);
setlocale(LC_TIME, $localeArray);
$moneyResult = setlocale(LC_MONETARY, $localeArray);
diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php
index 8d99bc4765..ced11547e0 100644
--- a/app/Http/Requests/AccountFormRequest.php
+++ b/app/Http/Requests/AccountFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Models\Account;
use FireflyIII\Models\Location;
diff --git a/app/Http/Requests/AttachmentFormRequest.php b/app/Http/Requests/AttachmentFormRequest.php
index 2da2240168..f2b4beb568 100644
--- a/app/Http/Requests/AttachmentFormRequest.php
+++ b/app/Http/Requests/AttachmentFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/BillStoreRequest.php b/app/Http/Requests/BillStoreRequest.php
index 0f530a2191..46436a7c9d 100644
--- a/app/Http/Requests/BillStoreRequest.php
+++ b/app/Http/Requests/BillStoreRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
diff --git a/app/Http/Requests/BillUpdateRequest.php b/app/Http/Requests/BillUpdateRequest.php
index f4376c00b4..2f70b26df3 100644
--- a/app/Http/Requests/BillUpdateRequest.php
+++ b/app/Http/Requests/BillUpdateRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\Bill;
use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin;
diff --git a/app/Http/Requests/BudgetFormStoreRequest.php b/app/Http/Requests/BudgetFormStoreRequest.php
index cb6c99f037..ac4edf6e69 100644
--- a/app/Http/Requests/BudgetFormStoreRequest.php
+++ b/app/Http/Requests/BudgetFormStoreRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
diff --git a/app/Http/Requests/BudgetFormUpdateRequest.php b/app/Http/Requests/BudgetFormUpdateRequest.php
index 459665e50f..539e613fff 100644
--- a/app/Http/Requests/BudgetFormUpdateRequest.php
+++ b/app/Http/Requests/BudgetFormUpdateRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\Budget;
use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin;
diff --git a/app/Http/Requests/BudgetIncomeRequest.php b/app/Http/Requests/BudgetIncomeRequest.php
index d0a2b96b17..49ed18de14 100644
--- a/app/Http/Requests/BudgetIncomeRequest.php
+++ b/app/Http/Requests/BudgetIncomeRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/BulkEditJournalRequest.php b/app/Http/Requests/BulkEditJournalRequest.php
index bcbbf533ca..169d1bc6ce 100644
--- a/app/Http/Requests/BulkEditJournalRequest.php
+++ b/app/Http/Requests/BulkEditJournalRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/CategoryFormRequest.php b/app/Http/Requests/CategoryFormRequest.php
index 53e25c7be3..a4e5112669 100644
--- a/app/Http/Requests/CategoryFormRequest.php
+++ b/app/Http/Requests/CategoryFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\Category;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
diff --git a/app/Http/Requests/ConfigurationRequest.php b/app/Http/Requests/ConfigurationRequest.php
index 212b706b5f..712d2be5a4 100644
--- a/app/Http/Requests/ConfigurationRequest.php
+++ b/app/Http/Requests/ConfigurationRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php
index 9a4f49672c..60ce09cbba 100644
--- a/app/Http/Requests/CurrencyFormRequest.php
+++ b/app/Http/Requests/CurrencyFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
diff --git a/app/Http/Requests/DeleteAccountFormRequest.php b/app/Http/Requests/DeleteAccountFormRequest.php
index c06cba8b51..eb36622b3a 100644
--- a/app/Http/Requests/DeleteAccountFormRequest.php
+++ b/app/Http/Requests/DeleteAccountFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/EmailFormRequest.php b/app/Http/Requests/EmailFormRequest.php
index 26f2c66750..1f499245eb 100644
--- a/app/Http/Requests/EmailFormRequest.php
+++ b/app/Http/Requests/EmailFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/ExistingTokenFormRequest.php b/app/Http/Requests/ExistingTokenFormRequest.php
index 37f7eb7867..f3222a8d57 100644
--- a/app/Http/Requests/ExistingTokenFormRequest.php
+++ b/app/Http/Requests/ExistingTokenFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/InviteUserFormRequest.php b/app/Http/Requests/InviteUserFormRequest.php
index 5c71175d81..70ebad1f19 100644
--- a/app/Http/Requests/InviteUserFormRequest.php
+++ b/app/Http/Requests/InviteUserFormRequest.php
@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php
index f924a24ee6..487b47f91c 100644
--- a/app/Http/Requests/JournalLinkRequest.php
+++ b/app/Http/Requests/JournalLinkRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\LinkType;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
diff --git a/app/Http/Requests/LinkTypeFormRequest.php b/app/Http/Requests/LinkTypeFormRequest.php
index 202b3fe3b8..bc0a56c933 100644
--- a/app/Http/Requests/LinkTypeFormRequest.php
+++ b/app/Http/Requests/LinkTypeFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/MassDeleteJournalRequest.php b/app/Http/Requests/MassDeleteJournalRequest.php
index 5700ac4224..fc1c5e93f8 100644
--- a/app/Http/Requests/MassDeleteJournalRequest.php
+++ b/app/Http/Requests/MassDeleteJournalRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/MassEditJournalRequest.php b/app/Http/Requests/MassEditJournalRequest.php
index d236c3abc0..ccf00f8988 100644
--- a/app/Http/Requests/MassEditJournalRequest.php
+++ b/app/Http/Requests/MassEditJournalRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/NewUserFormRequest.php b/app/Http/Requests/NewUserFormRequest.php
index 1d0da88187..967d7fe461 100644
--- a/app/Http/Requests/NewUserFormRequest.php
+++ b/app/Http/Requests/NewUserFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Rules\IsValidAmount;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
diff --git a/app/Http/Requests/ObjectGroupFormRequest.php b/app/Http/Requests/ObjectGroupFormRequest.php
index 5febc46231..ccc0cf24f5 100644
--- a/app/Http/Requests/ObjectGroupFormRequest.php
+++ b/app/Http/Requests/ObjectGroupFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\ObjectGroup;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
diff --git a/app/Http/Requests/PiggyBankStoreRequest.php b/app/Http/Requests/PiggyBankStoreRequest.php
index d7a9058100..1eeb6aad62 100644
--- a/app/Http/Requests/PiggyBankStoreRequest.php
+++ b/app/Http/Requests/PiggyBankStoreRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Rules\IsValidPositiveAmount;
@@ -32,6 +32,7 @@ use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
+use Illuminate\Validation\Validator;
/**
* Class PiggyBankStoreRequest.
diff --git a/app/Http/Requests/PiggyBankUpdateRequest.php b/app/Http/Requests/PiggyBankUpdateRequest.php
index 37c895cde4..c7e1da285a 100644
--- a/app/Http/Requests/PiggyBankUpdateRequest.php
+++ b/app/Http/Requests/PiggyBankUpdateRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
diff --git a/app/Http/Requests/ProfileFormRequest.php b/app/Http/Requests/ProfileFormRequest.php
index 65034257b9..1a7956d647 100644
--- a/app/Http/Requests/ProfileFormRequest.php
+++ b/app/Http/Requests/ProfileFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/ReconciliationStoreRequest.php b/app/Http/Requests/ReconciliationStoreRequest.php
index d9827230ed..e8c8b1a9be 100644
--- a/app/Http/Requests/ReconciliationStoreRequest.php
+++ b/app/Http/Requests/ReconciliationStoreRequest.php
@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Rules\IsValidAmount;
use FireflyIII\Rules\ValidJournals;
use FireflyIII\Support\Request\ChecksLogin;
diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php
index 8536cdf206..c26f8cc0b8 100644
--- a/app/Http/Requests/RecurrenceFormRequest.php
+++ b/app/Http/Requests/RecurrenceFormRequest.php
@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\CategoryFactory;
diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php
index f3b96f4a3e..7a4fcd3cf9 100644
--- a/app/Http/Requests/ReportFormRequest.php
+++ b/app/Http/Requests/ReportFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\FireflyException;
@@ -146,7 +146,7 @@ class ReportFormRequest extends FormRequest
// 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, $string);
- if (false !== $result && 0 !== $result) {
+ if (0 !== $result) {
try {
$date = new Carbon($parts[1]);
} catch (Exception $e) { // intentional generic exception
@@ -184,7 +184,7 @@ class ReportFormRequest extends FormRequest
// 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, $string);
- if (false !== $result && 0 !== $result) {
+ if (0 !== $result) {
try {
$date = new Carbon($parts[0]);
} catch (Exception $e) { // intentional generic exception
diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php
index 03b1beb270..f47f4b7c3f 100644
--- a/app/Http/Requests/RuleFormRequest.php
+++ b/app/Http/Requests/RuleFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\Rule;
use FireflyIII\Rules\IsValidActionExpression;
use FireflyIII\Support\Request\ChecksLogin;
diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.php
index f73cff0b74..6ebc1a6233 100644
--- a/app/Http/Requests/RuleGroupFormRequest.php
+++ b/app/Http/Requests/RuleGroupFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ChecksLogin;
diff --git a/app/Http/Requests/SelectTransactionsRequest.php b/app/Http/Requests/SelectTransactionsRequest.php
index d5564d7bc4..6b27652abc 100644
--- a/app/Http/Requests/SelectTransactionsRequest.php
+++ b/app/Http/Requests/SelectTransactionsRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php
index 069ffd5ef3..28a733b78c 100644
--- a/app/Http/Requests/TagFormRequest.php
+++ b/app/Http/Requests/TagFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Models\Location;
use FireflyIII\Models\Tag;
use FireflyIII\Support\Request\AppendsLocationData;
diff --git a/app/Http/Requests/TestRuleFormRequest.php b/app/Http/Requests/TestRuleFormRequest.php
index fa4e289e4e..880c45625e 100644
--- a/app/Http/Requests/TestRuleFormRequest.php
+++ b/app/Http/Requests/TestRuleFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\GetRuleConfiguration;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/TokenFormRequest.php b/app/Http/Requests/TokenFormRequest.php
index 19c0f3bc06..a54a1e786b 100644
--- a/app/Http/Requests/TokenFormRequest.php
+++ b/app/Http/Requests/TokenFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Http/Requests/TriggerRecurrenceRequest.php b/app/Http/Requests/TriggerRecurrenceRequest.php
index 36d16331d6..4b929adaa7 100644
--- a/app/Http/Requests/TriggerRecurrenceRequest.php
+++ b/app/Http/Requests/TriggerRecurrenceRequest.php
@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php
index cc89dff35b..b53be02934 100644
--- a/app/Http/Requests/UserFormRequest.php
+++ b/app/Http/Requests/UserFormRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
diff --git a/app/Http/Requests/UserRegistrationRequest.php b/app/Http/Requests/UserRegistrationRequest.php
index 8bd3504ea3..64df7a021b 100644
--- a/app/Http/Requests/UserRegistrationRequest.php
+++ b/app/Http/Requests/UserRegistrationRequest.php
@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Requests;
-use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Validation\Validator;
use FireflyIII\Support\Request\ChecksLogin;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php
index d1e34a4164..ec9e684a5a 100644
--- a/app/Jobs/MailError.php
+++ b/app/Jobs/MailError.php
@@ -129,7 +129,7 @@ class MailError extends Job implements ShouldQueue
}
if (file_exists($file)) {
Log::debug(sprintf('Read file in "%s"', $file));
- $limits = json_decode((string) file_get_contents($file), true);
+ $limits = json_decode( file_get_contents($file), true);
}
// limit reached?
foreach ($types as $type => $info) {
diff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.php
index 155454790e..836344ff7e 100644
--- a/app/Jobs/WarnAboutBills.php
+++ b/app/Jobs/WarnAboutBills.php
@@ -171,6 +171,7 @@ class WarnAboutBills implements ShouldQueue
$enrichment->setUser($bill->user);
$enrichment->setStart($start);
$enrichment->setEnd($end);
+ /** @var Bill $single */
$single = $enrichment->enrichSingle($bill);
return [
diff --git a/app/Mail/InvitationMail.php b/app/Mail/InvitationMail.php
index d1dd789cbe..ffb94b1bde 100644
--- a/app/Mail/InvitationMail.php
+++ b/app/Mail/InvitationMail.php
@@ -45,7 +45,11 @@ class InvitationMail extends Mailable
*/
public function __construct(public string $invitee, public string $admin, public string $url)
{
- $this->host = (string) parse_url($this->url, PHP_URL_HOST);
+ $host = parse_url($this->url, PHP_URL_HOST);
+ if(is_array($host)) {
+ $host ='';
+ }
+ $this->host = (string) $host;
}
/**
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 1eeb2007dc..7ed2b13f2e 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -40,8 +40,6 @@ class Configuration extends Model
/**
* TODO can be replaced with native laravel code.
- *
- * @return mixed
*/
protected function data(): Attribute
{
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index 144bc79e82..80b7e42ca0 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -41,15 +41,12 @@ class TransactionJournalMeta extends Model
protected $table = 'journal_meta';
- /**
- * @return mixed
- */
protected function data(): Attribute
{
return Attribute::make(get: fn ($value) => json_decode((string) $value, false), set: function ($value) {
$data = json_encode($value);
- return ['data' => $data, 'hash' => hash('sha256', (string) $data)];
+ return ['data' => $data, 'hash' => hash('sha256', $data)];
});
}
diff --git a/app/Notifications/Admin/UnknownUserLoginAttempt.php b/app/Notifications/Admin/UnknownUserLoginAttempt.php
index b72b0b9324..373492aa17 100644
--- a/app/Notifications/Admin/UnknownUserLoginAttempt.php
+++ b/app/Notifications/Admin/UnknownUserLoginAttempt.php
@@ -68,20 +68,21 @@ class UnknownUserLoginAttempt extends Notification
;
}
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function toNtfy(OwnerNotifiable $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
- $message = new Message();
- $ip = Request::ip();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.unknown_user_subject'));
- $message->body((string) trans('email.unknown_user_message', ['address' => $this->address, 'ip' => $ip]));
-
- return $message;
- }
+// /**
+// * @SuppressWarnings("PHPMD.UnusedFormalParameter")
+// */
+//
+// public function toNtfy(OwnerNotifiable $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
+// $message = new Message();
+// $ip = Request::ip();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.unknown_user_subject'));
+// $message->body((string) trans('email.unknown_user_message', ['address' => $this->address, 'ip' => $ip]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Admin/UserInvitation.php b/app/Notifications/Admin/UserInvitation.php
index 613bfa1f93..fe1644644c 100644
--- a/app/Notifications/Admin/UserInvitation.php
+++ b/app/Notifications/Admin/UserInvitation.php
@@ -73,20 +73,20 @@ class UserInvitation extends Notification
;
}
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function toNtfy(OwnerNotifiable $notifiable): Message
- {
- Log::debug('Now in toNtfy() for UserInvitation');
- $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.invitation_created_subject'));
- $message->body((string) trans('email.invitation_created_body', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email]));
-
- return $message;
- }
+// /**
+// * @SuppressWarnings("PHPMD.UnusedFormalParameter")
+// */
+// public function toNtfy(OwnerNotifiable $notifiable): Message
+// {
+// Log::debug('Now in toNtfy() for UserInvitation');
+// $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.invitation_created_subject'));
+// $message->body((string) trans('email.invitation_created_body', ['email' => $this->invitee->user->email, 'invitee' => $this->invitee->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Admin/UserRegistration.php b/app/Notifications/Admin/UserRegistration.php
index 4d6fcf9b29..5a50296cb5 100644
--- a/app/Notifications/Admin/UserRegistration.php
+++ b/app/Notifications/Admin/UserRegistration.php
@@ -72,20 +72,20 @@ class UserRegistration extends Notification
;
}
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function toNtfy(OwnerNotifiable $notifiable): Message
- {
- Log::debug('Now in toNtfy() for (Admin) UserRegistration');
- $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.registered_subject_admin'));
- $message->body((string) trans('email.admin_new_user_registered', ['email' => $this->user->email, 'invitee' => $this->user->email]));
-
- return $message;
- }
+// /**
+// * @SuppressWarnings("PHPMD.UnusedFormalParameter")
+// */
+// public function toNtfy(OwnerNotifiable $notifiable): Message
+// {
+// Log::debug('Now in toNtfy() for (Admin) UserRegistration');
+// $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.registered_subject_admin'));
+// $message->body((string) trans('email.admin_new_user_registered', ['email' => $this->user->email, 'invitee' => $this->user->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Admin/VersionCheckResult.php b/app/Notifications/Admin/VersionCheckResult.php
index deb2f5b4cb..fd38d2b5d3 100644
--- a/app/Notifications/Admin/VersionCheckResult.php
+++ b/app/Notifications/Admin/VersionCheckResult.php
@@ -64,20 +64,20 @@ class VersionCheckResult extends Notification
;
}
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function toNtfy(OwnerNotifiable $notifiable): Message
- {
- Log::debug('Now in toNtfy() for VersionCheckResult');
- $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.new_version_email_subject'));
- $message->body($this->message);
-
- return $message;
- }
+// /**
+// * @SuppressWarnings("PHPMD.UnusedFormalParameter")
+// */
+// public function toNtfy(OwnerNotifiable $notifiable): Message
+// {
+// Log::debug('Now in toNtfy() for VersionCheckResult');
+// $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.new_version_email_subject'));
+// $message->body($this->message);
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/ReturnsAvailableChannels.php b/app/Notifications/ReturnsAvailableChannels.php
index e3b2737b30..a62a8ffe6d 100644
--- a/app/Notifications/ReturnsAvailableChannels.php
+++ b/app/Notifications/ReturnsAvailableChannels.php
@@ -28,7 +28,7 @@ use FireflyIII\Support\Notifications\UrlValidator;
use FireflyIII\User;
use Illuminate\Support\Facades\Log;
use NotificationChannels\Pushover\PushoverChannel;
-use Wijourdil\NtfyNotificationChannel\Channels\NtfyChannel;
+//use Wijourdil\NtfyNotificationChannel\Channels\NtfyChannel;
class ReturnsAvailableChannels
{
@@ -58,16 +58,16 @@ class ReturnsAvailableChannels
}
}
- if (true === config('notifications.channels.ntfy.enabled', false)) {
- // validate presence of of Ntfy settings.
- if ('' !== (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) {
- Log::debug('Enabled ntfy.');
- $channels[] = NtfyChannel::class;
- }
- if ('' === (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) {
- Log::warning('No topic name for Ntfy, channel is disabled.');
- }
- }
+// if (true === config('notifications.channels.ntfy.enabled', false)) {
+// // validate presence of of Ntfy settings.
+// if ('' !== (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) {
+// Log::debug('Enabled ntfy.');
+// $channels[] = NtfyChannel::class;
+// }
+// if ('' === (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) {
+// Log::warning('No topic name for Ntfy, channel is disabled.');
+// }
+// }
// pushover
if (true === config('notifications.channels.pushover.enabled', false)) {
@@ -99,17 +99,17 @@ class ReturnsAvailableChannels
}
}
- // validate presence of of Ntfy settings.
- if (true === config('notifications.channels.nfy.enabled', false)) {
- $ntfyTopic = (string) app('preferences')->getEncryptedForUser($user, 'ntfy_topic', '')->data;
- if ('' !== $ntfyTopic) {
- Log::debug(sprintf('Enabled ntfy, "%s"', $ntfyTopic));
- $channels[] = NtfyChannel::class;
- }
- if ('' === (string) app('preferences')->getEncryptedForUser($user, 'ntfy_topic', '')->data) {
- Log::warning('No topic name for Ntfy, channel is disabled.');
- }
- }
+// // validate presence of of Ntfy settings.
+// if (true === config('notifications.channels.nfy.enabled', false)) {
+// $ntfyTopic = (string) app('preferences')->getEncryptedForUser($user, 'ntfy_topic', '')->data;
+// if ('' !== $ntfyTopic) {
+// Log::debug(sprintf('Enabled ntfy, "%s"', $ntfyTopic));
+// $channels[] = NtfyChannel::class;
+// }
+// if ('' === (string) app('preferences')->getEncryptedForUser($user, 'ntfy_topic', '')->data) {
+// Log::warning('No topic name for Ntfy, channel is disabled.');
+// }
+// }
// pushover
if (true === config('notifications.channels.slack.enabled', false)) {
diff --git a/app/Notifications/Security/DisabledMFANotification.php b/app/Notifications/Security/DisabledMFANotification.php
index 511b5cecab..0433e24928 100644
--- a/app/Notifications/Security/DisabledMFANotification.php
+++ b/app/Notifications/Security/DisabledMFANotification.php
@@ -65,16 +65,16 @@ class DisabledMFANotification extends Notification
return new MailMessage()->markdown('emails.security.disabled-mfa', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.disabled_mfa_subject'));
- $message->body((string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.disabled_mfa_subject'));
+// $message->body((string) trans('email.disabled_mfa_slack', ['email' => $this->user->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Security/EnabledMFANotification.php b/app/Notifications/Security/EnabledMFANotification.php
index e3863aee9e..575b5eba64 100644
--- a/app/Notifications/Security/EnabledMFANotification.php
+++ b/app/Notifications/Security/EnabledMFANotification.php
@@ -65,16 +65,16 @@ class EnabledMFANotification extends Notification
return new MailMessage()->markdown('emails.security.enabled-mfa', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.enabled_mfa_subject'));
- $message->body((string) trans('email.enabled_mfa_slack', ['email' => $this->user->email]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.enabled_mfa_subject'));
+// $message->body((string) trans('email.enabled_mfa_slack', ['email' => $this->user->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Security/MFABackupFewLeftNotification.php b/app/Notifications/Security/MFABackupFewLeftNotification.php
index 4302d10c46..c10d1f7726 100644
--- a/app/Notifications/Security/MFABackupFewLeftNotification.php
+++ b/app/Notifications/Security/MFABackupFewLeftNotification.php
@@ -65,16 +65,16 @@ class MFABackupFewLeftNotification extends Notification
return new MailMessage()->markdown('emails.security.few-backup-codes', ['user' => $this->user, 'count' => $this->count, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.mfa_few_backups_left_subject'));
- $message->body((string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.mfa_few_backups_left_subject'));
+// $message->body((string) trans('email.mfa_few_backups_left_slack', ['email' => $this->user->email, 'count' => $this->count]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Security/MFABackupNoLeftNotification.php b/app/Notifications/Security/MFABackupNoLeftNotification.php
index 246119e901..1964ae2064 100644
--- a/app/Notifications/Security/MFABackupNoLeftNotification.php
+++ b/app/Notifications/Security/MFABackupNoLeftNotification.php
@@ -65,16 +65,16 @@ class MFABackupNoLeftNotification extends Notification
return new MailMessage()->markdown('emails.security.no-backup-codes', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.mfa_no_backups_left_subject'));
- $message->body((string) trans('email.mfa_no_backups_left_slack', ['email' => $this->user->email]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.mfa_no_backups_left_subject'));
+// $message->body((string) trans('email.mfa_no_backups_left_slack', ['email' => $this->user->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Security/MFAManyFailedAttemptsNotification.php b/app/Notifications/Security/MFAManyFailedAttemptsNotification.php
index 400cee87e7..c96108dffd 100644
--- a/app/Notifications/Security/MFAManyFailedAttemptsNotification.php
+++ b/app/Notifications/Security/MFAManyFailedAttemptsNotification.php
@@ -62,16 +62,16 @@ class MFAManyFailedAttemptsNotification extends Notification
return new MailMessage()->markdown('emails.security.many-failed-attempts', ['user' => $this->user, 'count' => $this->count, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.mfa_many_failed_subject'));
- $message->body((string) trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.mfa_many_failed_subject'));
+// $message->body((string) trans('email.mfa_many_failed_slack', ['email' => $this->user->email, 'count' => $this->count]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Security/MFAUsedBackupCodeNotification.php b/app/Notifications/Security/MFAUsedBackupCodeNotification.php
index 01a3aac01c..4595e6f9a7 100644
--- a/app/Notifications/Security/MFAUsedBackupCodeNotification.php
+++ b/app/Notifications/Security/MFAUsedBackupCodeNotification.php
@@ -65,16 +65,16 @@ class MFAUsedBackupCodeNotification extends Notification
return new MailMessage()->markdown('emails.security.used-backup-code', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.used_backup_code_subject'));
- $message->body((string) trans('email.used_backup_code_slack', ['email' => $this->user->email]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.used_backup_code_subject'));
+// $message->body((string) trans('email.used_backup_code_slack', ['email' => $this->user->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Security/NewBackupCodesNotification.php b/app/Notifications/Security/NewBackupCodesNotification.php
index ede672e96b..942d41bdc8 100644
--- a/app/Notifications/Security/NewBackupCodesNotification.php
+++ b/app/Notifications/Security/NewBackupCodesNotification.php
@@ -65,16 +65,16 @@ class NewBackupCodesNotification extends Notification
return new MailMessage()->markdown('emails.security.new-backup-codes', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.new_backup_codes_subject'));
- $message->body((string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.new_backup_codes_subject'));
+// $message->body((string) trans('email.new_backup_codes_slack', ['email' => $this->user->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Security/UserFailedLoginAttempt.php b/app/Notifications/Security/UserFailedLoginAttempt.php
index 08159020be..6cbc1b4d25 100644
--- a/app/Notifications/Security/UserFailedLoginAttempt.php
+++ b/app/Notifications/Security/UserFailedLoginAttempt.php
@@ -63,17 +63,17 @@ class UserFailedLoginAttempt extends Notification
return new MailMessage()->markdown('emails.security.failed-login', ['user' => $this->user, 'ip' => $ip, 'host' => $host, 'userAgent' => $userAgent, 'time' => $time])->subject($subject);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $ip = Request::ip();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.failed_login_subject'));
- $message->body((string) trans('email.failed_login_message', ['ip' => $ip, 'email' => $this->user->email]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $ip = Request::ip();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.failed_login_subject'));
+// $message->body((string) trans('email.failed_login_message', ['ip' => $ip, 'email' => $this->user->email]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/Test/OwnerTestNotificationNtfy.php b/app/Notifications/Test/OwnerTestNotificationNtfy.php
index 9f72e8544b..f5c67d3ec1 100644
--- a/app/Notifications/Test/OwnerTestNotificationNtfy.php
+++ b/app/Notifications/Test/OwnerTestNotificationNtfy.php
@@ -49,26 +49,20 @@ class OwnerTestNotificationNtfy extends Notification
];
}
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function toNtfy(OwnerNotifiable $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.admin_test_subject'));
- $message->body((string) trans('email.admin_test_message', ['channel' => 'ntfy']));
- $message->tags(['white_check_mark']);
+// public function toNtfy(OwnerNotifiable $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.admin_test_subject'));
+// $message->body((string) trans('email.admin_test_message', ['channel' => 'ntfy']));
+// $message->tags(['white_check_mark']);
+//
+// return $message;
+// }
- return $message;
- }
-
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function via(OwnerNotifiable $notifiable): array
- {
- return [NtfyChannel::class];
- }
+// public function via(OwnerNotifiable $notifiable): array
+// {
+// return [NtfyChannel::class];
+// }
}
diff --git a/app/Notifications/Test/UserTestNotificationNtfy.php b/app/Notifications/Test/UserTestNotificationNtfy.php
index babcb459f8..85d9f44a57 100644
--- a/app/Notifications/Test/UserTestNotificationNtfy.php
+++ b/app/Notifications/Test/UserTestNotificationNtfy.php
@@ -49,26 +49,20 @@ class UserTestNotificationNtfy extends Notification
];
}
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function toNtfy(User $user): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $user);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.admin_test_subject'));
- $message->body((string) trans('email.admin_test_message', ['channel' => 'ntfy']));
- $message->tags(['white_check_mark']);
+// public function toNtfy(User $user): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $user);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.admin_test_subject'));
+// $message->body((string) trans('email.admin_test_message', ['channel' => 'ntfy']));
+// $message->tags(['white_check_mark']);
+//
+// return $message;
+// }
- return $message;
- }
-
- /**
- * @SuppressWarnings("PHPMD.UnusedFormalParameter")
- */
- public function via(User $user): array
- {
- return [NtfyChannel::class];
- }
+// public function via(User $user): array
+// {
+// return [NtfyChannel::class];
+// }
}
diff --git a/app/Notifications/User/BillReminder.php b/app/Notifications/User/BillReminder.php
index aebdf1333b..a332b0d911 100644
--- a/app/Notifications/User/BillReminder.php
+++ b/app/Notifications/User/BillReminder.php
@@ -73,16 +73,16 @@ class BillReminder extends Notification
return (string) trans(sprintf('email.bill_warning_subject_%s', $this->field), ['diff' => $this->diff, 'name' => $this->bill->name]);
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title($this->getSubject());
- $message->body((string) trans('email.bill_warning_please_action'));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title($this->getSubject());
+// $message->body((string) trans('email.bill_warning_please_action'));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/User/NewAccessToken.php b/app/Notifications/User/NewAccessToken.php
index 29d2c51b36..f04902b920 100644
--- a/app/Notifications/User/NewAccessToken.php
+++ b/app/Notifications/User/NewAccessToken.php
@@ -68,16 +68,16 @@ class NewAccessToken extends Notification
;
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.access_token_created_subject'));
- $message->body((string) trans('email.access_token_created_body'));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.access_token_created_subject'));
+// $message->body((string) trans('email.access_token_created_body'));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/User/RuleActionFailed.php b/app/Notifications/User/RuleActionFailed.php
index 9a518edb2e..5d7c0b88ea 100644
--- a/app/Notifications/User/RuleActionFailed.php
+++ b/app/Notifications/User/RuleActionFailed.php
@@ -65,15 +65,15 @@ class RuleActionFailed extends Notification
];
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->body($this->message);
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->body($this->message);
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/User/SubscriptionsOverdueReminder.php b/app/Notifications/User/SubscriptionsOverdueReminder.php
index b3647ad128..1031afe852 100644
--- a/app/Notifications/User/SubscriptionsOverdueReminder.php
+++ b/app/Notifications/User/SubscriptionsOverdueReminder.php
@@ -87,16 +87,16 @@ class SubscriptionsOverdueReminder extends Notification
return (string)trans('email.subscriptions_overdue_subject_single');
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title($this->getSubject());
- $message->body((string)trans('email.bill_warning_please_action'));
-
- return $message;
- }
+ // public function toNtfy(User $notifiable): Message
+ // {
+ // $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+ // $message = new Message();
+ // $message->topic($settings['ntfy_topic']);
+ // $message->title($this->getSubject());
+ // $message->body((string)trans('email.bill_warning_please_action'));
+ //
+ // return $message;
+ // }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/User/UserLogin.php b/app/Notifications/User/UserLogin.php
index 5fc368d7e0..ad18f9533a 100644
--- a/app/Notifications/User/UserLogin.php
+++ b/app/Notifications/User/UserLogin.php
@@ -65,18 +65,18 @@ class UserLogin extends Notification
;
}
- public function toNtfy(User $notifiable): Message
- {
- $ip = Request::ip();
- $host = Steam::getHostName($ip);
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->title((string) trans('email.login_from_new_ip'));
- $message->body((string) trans('email.slack_login_from_new_ip', ['ip' => $ip, 'host' => $host]));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $ip = Request::ip();
+// $host = Steam::getHostName($ip);
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->title((string) trans('email.login_from_new_ip'));
+// $message->body((string) trans('email.slack_login_from_new_ip', ['ip' => $ip, 'host' => $host]));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Notifications/User/UserNewPassword.php b/app/Notifications/User/UserNewPassword.php
index 16ffb0b31a..0276b7638f 100644
--- a/app/Notifications/User/UserNewPassword.php
+++ b/app/Notifications/User/UserNewPassword.php
@@ -70,15 +70,15 @@ class UserNewPassword extends Notification
;
}
- public function toNtfy(User $notifiable): Message
- {
- $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
- $message = new Message();
- $message->topic($settings['ntfy_topic']);
- $message->body((string) trans('email.reset_pw_message'));
-
- return $message;
- }
+// public function toNtfy(User $notifiable): Message
+// {
+// $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable);
+// $message = new Message();
+// $message->topic($settings['ntfy_topic']);
+// $message->body((string) trans('email.reset_pw_message'));
+//
+// return $message;
+// }
/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php
index 56c7c96fc0..71aebb11a3 100644
--- a/app/Repositories/Account/OperationsRepository.php
+++ b/app/Repositories/Account/OperationsRepository.php
@@ -83,7 +83,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
];
$array[$currencyId]['transaction_journals'][$journalId] = [
- 'amount' => app('steam')->{$direction}((string) $journal['amount']), // @phpstan-ignore-line
+ 'amount' => Steam::{$direction}((string) $journal['amount']), // @phpstan-ignore-line
'date' => $journal['date'],
'transaction_journal_id' => $journalId,
'budget_name' => $journal['budget_name'],
@@ -331,7 +331,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
$currencyId = $journal['currency_id'];
$sourceKey = sprintf('%d-%d', $currencyId, $sourceId);
$destKey = sprintf('%d-%d', $currencyId, $destinationId);
- $amount = app('steam')->positive($journal['amount']);
+ $amount = Steam::positive($journal['amount']);
// source first
$return[$sourceKey] ??= [
@@ -366,7 +366,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
$return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], (string) $return[$sourceKey]['in']);
// destination account? money comes in:
- $return[$destKey]['in'] = bcadd((string) $return[$destKey]['in'], (string) $amount);
+ $return[$destKey]['in'] = bcadd((string) $return[$destKey]['in'], $amount);
$return[$destKey]['difference'] = bcadd((string) $return[$destKey]['out'], $return[$destKey]['in']);
// foreign currency
@@ -374,7 +374,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
$currencyId = $journal['foreign_currency_id'];
$sourceKey = sprintf('%d-%d', $currencyId, $sourceId);
$destKey = sprintf('%d-%d', $currencyId, $destinationId);
- $amount = app('steam')->positive($journal['foreign_amount']);
+ $amount = Steam::positive($journal['foreign_amount']);
// same as above:
// source first
@@ -409,7 +409,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
$return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], (string) $return[$sourceKey]['in']);
// destination account? money comes in:
- $return[$destKey]['in'] = bcadd((string) $return[$destKey]['in'], (string) $amount);
+ $return[$destKey]['in'] = bcadd((string) $return[$destKey]['in'], $amount);
$return[$destKey]['difference'] = bcadd((string) $return[$destKey]['out'], $return[$destKey]['in']);
}
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index dfc7370e22..3aa57328de 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -310,10 +310,10 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
return $budget;
}
- if (0 === $autoBudgetType && !$autoBudget instanceof AutoBudget) {
+ if (0 === $autoBudgetType) {
return $budget;
}
- if (null === $autoBudgetType && !$autoBudget instanceof AutoBudget) {
+ if (null === $autoBudgetType) {
return $budget;
}
$this->updateAutoBudget($budget, $data);
diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php
index ce52a5f503..16a9adf1e9 100644
--- a/app/Repositories/Currency/CurrencyRepository.php
+++ b/app/Repositories/Currency/CurrencyRepository.php
@@ -267,10 +267,9 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
return $result;
}
- if (null === $result) {
- Log::debug(sprintf('Searching for currency with code "%s"...', $currencyCode));
- $result = $this->findByCode((string) $currencyCode);
- }
+ Log::debug(sprintf('Searching for currency with code "%s"...', $currencyCode));
+ $result = $this->findByCode((string) $currencyCode);
+
if ($result instanceof TransactionCurrency && false === $result->enabled) {
Log::debug(sprintf('Also enabled currency %s', $result->code));
$this->enable($result);
diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php
index b908dcc82f..ea923bfffc 100644
--- a/app/Repositories/Journal/JournalCLIRepository.php
+++ b/app/Repositories/Journal/JournalCLIRepository.php
@@ -182,7 +182,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn
$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')]);
$journalIds = [];
/** @var stdClass $row */
diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
index 658ca6e1c8..3d623f760a 100644
--- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
+++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php
@@ -67,7 +67,7 @@ trait ModifiesPiggyBanks
{
$currentAmount = $this->getCurrentAmount($piggyBank, $account);
$pivot = $piggyBank->accounts()->where('accounts.id', $account->id)->first()->pivot;
- $pivot->current_amount = bcsub((string)$currentAmount, $amount);
+ $pivot->current_amount = bcsub($currentAmount, $amount);
$pivot->native_current_amount = null;
// also update native_current_amount.
@@ -90,7 +90,7 @@ trait ModifiesPiggyBanks
{
$currentAmount = $this->getCurrentAmount($piggyBank, $account);
$pivot = $piggyBank->accounts()->where('accounts.id', $account->id)->first()->pivot;
- $pivot->current_amount = bcadd((string)$currentAmount, $amount);
+ $pivot->current_amount = bcadd($currentAmount, $amount);
$pivot->native_current_amount = null;
// also update native_current_amount.
@@ -122,13 +122,13 @@ trait ModifiesPiggyBanks
if (0 !== bccomp($piggyBank->target_amount, '0')) {
- $leftToSave = bcsub($piggyBank->target_amount, (string)$savedSoFar);
- $maxAmount = 1 === bccomp((string)$leftOnAccount, $leftToSave) ? $leftToSave : $leftOnAccount;
+ $leftToSave = bcsub($piggyBank->target_amount, $savedSoFar);
+ $maxAmount = 1 === bccomp($leftOnAccount, $leftToSave) ? $leftToSave : $leftOnAccount;
Log::debug(sprintf('Left to save: %s', $leftToSave));
Log::debug(sprintf('Maximum amount: %s', $maxAmount));
}
- $compare = bccomp($amount, (string)$maxAmount);
+ $compare = bccomp($amount, $maxAmount);
$result = $compare <= 0;
Log::debug(sprintf('Compare <= 0? %d, so canAddAmount is %s', $compare, var_export($result, true)));
@@ -140,7 +140,7 @@ trait ModifiesPiggyBanks
{
$savedSoFar = $this->getCurrentAmount($piggyBank, $account);
- return bccomp($amount, (string)$savedSoFar) <= 0;
+ return bccomp($amount, $savedSoFar) <= 0;
}
/**
@@ -234,9 +234,9 @@ trait ModifiesPiggyBanks
// if the piggy bank is now smaller than the sum of the money saved,
// remove money from all accounts until the piggy bank is the right amount.
$currentAmount = $this->getCurrentAmount($piggyBank);
- if (1 === bccomp((string)$currentAmount, (string)$piggyBank->target_amount) && 0 !== bccomp((string)$piggyBank->target_amount, '0')) {
+ if (1 === bccomp($currentAmount, (string)$piggyBank->target_amount) && 0 !== bccomp((string)$piggyBank->target_amount, '0')) {
Log::debug(sprintf('Current amount is %s, target amount is %s', $currentAmount, $piggyBank->target_amount));
- $difference = bcsub((string)$piggyBank->target_amount, (string)$currentAmount);
+ $difference = bcsub((string)$piggyBank->target_amount, $currentAmount);
// an amount will be removed, create "negative" event:
// Log::debug(sprintf('ChangedAmount: is triggered with difference "%s"', $difference));
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index 711767e051..eefd26afb1 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -67,12 +67,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
public function findPiggyBank(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank
{
- app('log')->debug('Searching for piggy information.');
+ Log::debug('Searching for piggy information.');
if (null !== $piggyBankId) {
$searchResult = $this->find($piggyBankId);
if ($searchResult instanceof PiggyBank) {
- app('log')->debug(sprintf('Found piggy based on #%d, will return it.', $piggyBankId));
+ Log::debug(sprintf('Found piggy based on #%d, will return it.', $piggyBankId));
return $searchResult;
}
@@ -80,12 +80,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
if (null !== $piggyBankName) {
$searchResult = $this->findByName($piggyBankName);
if ($searchResult instanceof PiggyBank) {
- app('log')->debug(sprintf('Found piggy based on "%s", will return it.', $piggyBankName));
+ Log::debug(sprintf('Found piggy based on "%s", will return it.', $piggyBankName));
return $searchResult;
}
}
- app('log')->debug('Found no piggy bank.');
+ Log::debug('Found no piggy bank.');
return null;
}
@@ -158,7 +158,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
*/
public function getExactAmount(PiggyBank $piggyBank, TransactionJournal $journal): string
{
- app('log')->debug(sprintf('Now in getExactAmount(%d, %d)', $piggyBank->id, $journal->id));
+ Log::debug(sprintf('Now in getExactAmount(%d, %d)', $piggyBank->id, $journal->id));
$operator = null;
$currency = null;
@@ -173,7 +173,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
$primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
- app('log')->debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code));
+ Log::debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code));
/** @var Transaction $source */
$source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first();
@@ -187,26 +187,26 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
if ($account->id === $source->account_id) {
$operator = 'negative';
$currency = $accountRepos->getAccountCurrency($source->account) ?? $primaryCurrency;
- app('log')->debug(sprintf('Currency will draw money out of piggy bank. Source currency is %s', $currency->code));
+ Log::debug(sprintf('Currency will draw money out of piggy bank. Source currency is %s', $currency->code));
++$hits;
}
// matches destination, which means amount will be added to piggy.
if ($account->id === $destination->account_id) {
$operator = 'positive';
$currency = $accountRepos->getAccountCurrency($destination->account) ?? $primaryCurrency;
- app('log')->debug(sprintf('Currency will add money to piggy bank. Destination currency is %s', $currency->code));
+ Log::debug(sprintf('Currency will add money to piggy bank. Destination currency is %s', $currency->code));
++$hits;
}
}
if ($hits > 1) {
- app('log')->debug(sprintf('Transaction journal is related to %d of the accounts, cannot determine what to do. Return "0".', $hits));
+ Log::debug(sprintf('Transaction journal is related to %d of the accounts, cannot determine what to do. Return "0".', $hits));
return '0';
}
if (null === $operator || null === $currency) {
- app('log')->debug('Currency is NULL and operator is NULL, return "0".');
+ Log::debug('Currency is NULL and operator is NULL, return "0".');
return '0';
}
@@ -214,52 +214,52 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
// which amount from the transaction matches?
$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
+ Log::debug('Use normal amount');
+ $amount = Steam::{$operator}($source->amount); // @phpstan-ignore-line
}
if ((int) $source->foreign_currency_id === $currency->id) {
- app('log')->debug('Use foreign amount');
- $amount = app('steam')->{$operator}($source->foreign_amount); // @phpstan-ignore-line
+ Log::debug('Use foreign amount');
+ $amount = Steam::{$operator}($source->foreign_amount); // @phpstan-ignore-line
}
if (null === $amount) {
- app('log')->debug('No match on currency, so amount remains null, return "0".');
+ Log::debug('No match on currency, so amount remains null, return "0".');
return '0';
}
- app('log')->debug(sprintf('The currency is %s and the amount is %s', $currency->code, $amount));
+ Log::debug(sprintf('The currency is %s and the amount is %s', $currency->code, $amount));
$currentAmount = $this->getCurrentAmount($piggyBank);
$room = bcsub($piggyBank->target_amount, $currentAmount);
$compare = bcmul($currentAmount, '-1');
if (0 === bccomp($piggyBank->target_amount, '0')) {
// amount is zero? then the "room" is positive amount of we wish to add or remove.
- $room = app('steam')->positive($amount);
- app('log')->debug(sprintf('Room is now %s', $room));
+ $room = Steam::positive($amount);
+ Log::debug(sprintf('Room is now %s', $room));
}
- app('log')->debug(sprintf('Will add/remove %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
+ Log::debug(sprintf('Will add/remove %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
// if the amount is positive, make sure it fits in piggy bank:
- if (1 === bccomp($amount, '0') && -1 === bccomp((string) $room, $amount)) {
+ if (1 === bccomp($amount, '0') && -1 === bccomp( $room, $amount)) {
// amount is positive and $room is smaller than $amount
- app('log')->debug(sprintf('Room in piggy bank for extra money is %f', $room));
- app('log')->debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
- app('log')->debug(sprintf('New amount is %f', $room));
+ Log::debug(sprintf('Room in piggy bank for extra money is %f', $room));
+ Log::debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
+ Log::debug(sprintf('New amount is %f', $room));
return $room;
}
// amount is negative and $currentAmount is smaller than $amount
if (-1 === bccomp($amount, '0') && 1 === bccomp($compare, $amount)) {
- app('log')->debug(sprintf('Max amount to remove is %f', $currentAmount));
- app('log')->debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
- app('log')->debug(sprintf('New amount is %f', $compare));
+ Log::debug(sprintf('Max amount to remove is %f', $currentAmount));
+ Log::debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
+ Log::debug(sprintf('New amount is %f', $compare));
return $compare;
}
- return (string) $amount;
+ return $amount;
}
/**
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index 11edb3a29d..8acdc53a5d 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -31,6 +31,7 @@ use FireflyIII\Models\Attachment;
use FireflyIII\Models\Location;
use FireflyIII\Models\Note;
use FireflyIII\Models\Tag;
+use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Support\Collection;
@@ -268,12 +269,12 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface
];
// add amount to correct type:
- $amount = app('steam')->positive((string) $journal['amount']);
+ $amount = Steam::positive((string) $journal['amount']);
$type = $journal['transaction_type_type'];
if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
- $amount = bcmul((string) $amount, '-1');
+ $amount = bcmul( $amount, '-1');
}
- $sums[$currencyId][$type] = bcadd((string) $sums[$currencyId][$type], (string) $amount);
+ $sums[$currencyId][$type] = bcadd((string) $sums[$currencyId][$type], $amount);
$foreignCurrencyId = $journal['foreign_currency_id'];
if (null !== $foreignCurrencyId && 0 !== $foreignCurrencyId) {
@@ -289,11 +290,11 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface
TransactionTypeEnum::OPENING_BALANCE->value => '0',
];
// add foreign amount to correct type:
- $amount = app('steam')->positive((string) $journal['foreign_amount']);
+ $amount = Steam::positive((string) $journal['foreign_amount']);
if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
- $amount = bcmul((string) $amount, '-1');
+ $amount = bcmul( $amount, '-1');
}
- $sums[$foreignCurrencyId][$type] = bcadd((string) $sums[$foreignCurrencyId][$type], (string) $amount);
+ $sums[$foreignCurrencyId][$type] = bcadd((string) $sums[$foreignCurrencyId][$type], $amount);
}
}
diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
index 046a8c9145..fe69b41f5c 100644
--- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php
+++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Repositories\TransactionGroup;
use Carbon\Carbon;
+use Exception;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\DuplicateTransactionException;
use FireflyIII\Exceptions\FireflyException;
@@ -42,14 +43,13 @@ use FireflyIII\Models\TransactionJournalLink;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService;
use FireflyIII\Services\Internal\Update\GroupUpdateService;
+use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\NullArrayObject;
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
-use Exception;
-
use function Safe\json_decode;
/**
@@ -143,22 +143,21 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
{
$repository = app(AttachmentRepositoryInterface::class);
$repository->setUser($this->user);
- $journals = $group->transactionJournals->pluck('id')->toArray();
- $set = Attachment::whereIn('attachable_id', $journals)
- ->where('attachable_type', TransactionJournal::class)
- ->where('uploaded', true)
- ->whereNull('deleted_at')->get()
- ;
+ $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;
$result[$journalId][] = $current;
@@ -174,9 +173,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
{
/** @var null|Note $note */
$note = Note::where('noteable_id', $journalId)
- ->where('noteable_type', TransactionJournal::class)
- ->first()
- ;
+ ->where('noteable_type', TransactionJournal::class)
+ ->first();
if (null === $note) {
return null;
}
@@ -197,14 +195,13 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
$q->orWhereIn('destination_id', $journals);
}
)
- ->with(['source', 'destination', 'source.transactions'])
- ->leftJoin('link_types', 'link_types.id', '=', 'journal_links.link_type_id')
- ->get(['journal_links.*', 'link_types.inward', 'link_types.outward', 'link_types.editable'])
- ;
+ ->with(['source', 'destination', 'source.transactions'])
+ ->leftJoin('link_types', 'link_types.id', '=', 'journal_links.link_type_id')
+ ->get(['journal_links.*', 'link_types.inward', 'link_types.outward', 'link_types.editable']);
/** @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.
@@ -248,13 +245,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
$type = $journal->transactionType->type;
$amount = app('steam')->positive($transaction->amount);
if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
- return app('amount')->formatAnything($currency, app('steam')->negative($amount));
+ return Amount::formatAnything($currency, app('steam')->negative($amount));
}
- if (TransactionTypeEnum::WITHDRAWAL->value !== $type) {
- return app('amount')->formatAnything($currency, $amount);
- }
-
- return '';
+ return Amount::formatAnything($currency, $amount);
}
private function getFormattedForeignAmount(TransactionJournal $journal): string
@@ -264,20 +257,18 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
if (null === $transaction->foreign_amount || '' === $transaction->foreign_amount) {
return '';
}
+
if (0 === bccomp('0', (string)$transaction->foreign_amount)) {
return '';
}
- $currency = $transaction->foreignCurrency;
- $type = $journal->transactionType->type;
- $amount = app('steam')->positive($transaction->foreign_amount);
- if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
- return app('amount')->formatAnything($currency, app('steam')->negative($amount));
- }
- if (TransactionTypeEnum::WITHDRAWAL->value !== $type) {
- return app('amount')->formatAnything($currency, $amount);
- }
- return '';
+ $currency = $transaction->foreignCurrency;
+ $type = $journal->transactionType->type;
+ $amount = app('steam')->positive($transaction->foreign_amount);
+ if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
+ return Amount::formatAnything($currency, app('steam')->negative($amount));
+ }
+ return Amount::formatAnything($currency, $amount);
}
public function getLocation(int $journalId): ?Location
@@ -297,11 +288,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
public function getMetaDateFields(int $journalId, array $fields): NullArrayObject
{
$query = DB::table('journal_meta')
- ->where('transaction_journal_id', $journalId)
- ->whereIn('name', $fields)
- ->whereNull('deleted_at')
- ->get(['name', 'data'])
- ;
+ ->where('transaction_journal_id', $journalId)
+ ->whereIn('name', $fields)
+ ->whereNull('deleted_at')
+ ->get(['name', 'data']);
$return = [];
foreach ($query as $row) {
@@ -317,11 +307,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
public function getMetaFields(int $journalId, array $fields): NullArrayObject
{
$query = DB::table('journal_meta')
- ->where('transaction_journal_id', $journalId)
- ->whereIn('name', $fields)
- ->whereNull('deleted_at')
- ->get(['name', 'data'])
- ;
+ ->where('transaction_journal_id', $journalId)
+ ->whereIn('name', $fields)
+ ->whereNull('deleted_at')
+ ->get(['name', 'data']);
$return = [];
foreach ($query as $row) {
@@ -340,11 +329,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
{
$return = [];
$journals = $group->transactionJournals->pluck('id')->toArray();
- $currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup);
+ $currency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
$data = PiggyBankEvent::whereIn('transaction_journal_id', $journals)
- ->with('piggyBank', 'piggyBank.account')
- ->get(['piggy_bank_events.*'])
- ;
+ ->with('piggyBank', 'piggyBank.account')
+ ->get(['piggy_bank_events.*']);
/** @var PiggyBankEvent $row */
foreach ($data as $row) {
@@ -352,20 +340,19 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
continue;
}
// get currency preference.
- $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id)
- ->where('name', 'currency_id')
- ->first()
- ;
+ $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][] = [
'piggy' => $row->piggyBank->name,
'piggy_id' => $row->piggy_bank_id,
- 'amount' => app('amount')->formatAnything($currency, $row->amount),
+ 'amount' => Amount::formatAnything($currency, $row->amount),
];
}
@@ -386,11 +373,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
public function getTags(int $journalId): array
{
$result = DB::table('tag_transaction_journal')
- ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id')
- ->where('tag_transaction_journal.transaction_journal_id', $journalId)
- ->orderBy('tags.tag', 'ASC')
- ->get(['tags.tag'])
- ;
+ ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id')
+ ->where('tag_transaction_journal.transaction_journal_id', $journalId)
+ ->orderBy('tags.tag', 'ASC')
+ ->get(['tags.tag']);
return $result->pluck('tag')->toArray();
}
@@ -445,7 +431,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
/** @var Transaction $transaction */
foreach ($journal->transactions as $transaction) {
if (-1 === bccomp('0', (string)$transaction->amount)) {
- $sum = bcadd($sum, (string) $transaction->amount);
+ $sum = bcadd($sum, (string)$transaction->amount);
$names = sprintf('%s%s', $names, $transaction->account->name);
}
}
diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php
index 418f16ef8b..28b38e4c02 100644
--- a/app/Repositories/UserGroups/Account/AccountRepository.php
+++ b/app/Repositories/UserGroups/Account/AccountRepository.php
@@ -169,6 +169,7 @@ class AccountRepository implements AccountRepositoryInterface
{
$account = $this->user->accounts()->find($accountId);
if (null === $account) {
+ /** @var null|Account */
return $this->userGroup->accounts()->find($accountId);
}
@@ -242,11 +243,7 @@ class AccountRepository implements AccountRepositoryInterface
#[Override]
public function getLastActivity(Collection $accounts): array
{
- return Transaction::whereIn('account_id', $accounts->pluck('id')->toArray())
- ->leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id')
- ->groupBy('transactions.account_id')
- ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) as date_max')])->toArray() // @phpstan-ignore-line
- ;
+ return Transaction::whereIn('account_id', $accounts->pluck('id')->toArray())->leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id')->groupBy('transactions.account_id')->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) as date_max')])->toArray();
}
#[Override]
diff --git a/app/Rules/IsValidBulkClause.php b/app/Rules/IsValidBulkClause.php
index 8be8759eed..7d5ed57290 100644
--- a/app/Rules/IsValidBulkClause.php
+++ b/app/Rules/IsValidBulkClause.php
@@ -96,7 +96,7 @@ class IsValidBulkClause implements ValidationRule
'value' => $this->rules[$clause][$arrayKey],
]);
if ($validator->fails()) {
- $this->error = sprintf('%s: %s: %s', $clause, $arrayKey, implode(', ', $validator->errors()->get('value')));
+ $this->error = sprintf('%s: %s: %s', $clause, $arrayKey, implode(', ', $validator->errors()->get('value'))); // @phpstan-ignore-line
return false;
}
diff --git a/app/Services/Internal/Destroy/AccountDestroyService.php b/app/Services/Internal/Destroy/AccountDestroyService.php
index e2e4cb994b..2bd2f62c4e 100644
--- a/app/Services/Internal/Destroy/AccountDestroyService.php
+++ b/app/Services/Internal/Destroy/AccountDestroyService.php
@@ -108,10 +108,7 @@ class AccountDestroyService
app('log')->debug(sprintf('Move from account #%d to #%d', $account->id, $moveTo->id));
DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]);
- $collection = Transaction::groupBy('transaction_journal_id', 'account_id')
- ->where('account_id', $moveTo->id)
- ->get(['transaction_journal_id', 'account_id', DB::raw('count(*) as the_count')]) // @phpstan-ignore-line
- ;
+ $collection = Transaction::groupBy('transaction_journal_id', 'account_id')->where('account_id', $moveTo->id)->get(['transaction_journal_id', 'account_id', DB::raw('count(*) as the_count')]);
if (0 === $collection->count()) {
return;
}
diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php
index da77efb15a..62a445bc5c 100644
--- a/app/Services/Internal/Support/CreditRecalculateService.php
+++ b/app/Services/Internal/Support/CreditRecalculateService.php
@@ -277,66 +277,66 @@ class CreditRecalculateService
if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1
$usedAmount = app('steam')->positive($usedAmount);
- return bcadd($leftOfDebt, (string) $usedAmount);
+ return bcadd($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isCredit && $this->isWithdrawalOut($usedAmount, $type)) { // case 2
$usedAmount = app('steam')->positive($usedAmount);
- return bcsub($leftOfDebt, (string) $usedAmount);
+ return bcsub($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isCredit && $this->isDepositOut($usedAmount, $type)) { // case 3
$usedAmount = app('steam')->positive($usedAmount);
- return bcsub($leftOfDebt, (string) $usedAmount);
+ return bcsub($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isCredit && $this->isDepositIn($usedAmount, $type)) { // case 4
$usedAmount = app('steam')->positive($usedAmount);
- return bcadd($leftOfDebt, (string) $usedAmount);
+ return bcadd($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isCredit && $this->isTransferIn($usedAmount, $type)) { // case 5
$usedAmount = app('steam')->positive($usedAmount);
- return bcadd($leftOfDebt, (string) $usedAmount);
+ return bcadd($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isDebit && $this->isWithdrawalIn($usedAmount, $type)) { // case 6
$usedAmount = app('steam')->positive($usedAmount);
- return bcsub($leftOfDebt, (string) $usedAmount);
+ return bcsub($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isDebit && $this->isDepositOut($usedAmount, $type)) { // case 7
$usedAmount = app('steam')->positive($usedAmount);
- return bcadd($leftOfDebt, (string) $usedAmount);
+ return bcadd($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isDebit && $this->isWithdrawalOut($usedAmount, $type)) { // case 8
$usedAmount = app('steam')->positive($usedAmount);
- return bcadd($leftOfDebt, (string) $usedAmount);
+ return bcadd($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isDebit && $this->isTransferIn($usedAmount, $type)) { // case 9
$usedAmount = app('steam')->positive($usedAmount);
- return bcsub($leftOfDebt, (string) $usedAmount);
+ return bcsub($leftOfDebt, $usedAmount);
// 2024-10-05, #9225 this used to say you would owe more, but a transfer INTO a debit from wherever means you owe LESS.
// Log::debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
if ($isSameAccount && $isDebit && $this->isTransferOut($usedAmount, $type)) { // case 10
$usedAmount = app('steam')->positive($usedAmount);
- return bcadd($leftOfDebt, (string) $usedAmount);
+ return bcadd($leftOfDebt, $usedAmount);
// 2024-10-05, #9225 this used to say you would owe less, but a transfer OUT OF a debit from wherever means you owe MORE.
// Log::debug(sprintf('Case 10 (transfer out of debit liability, means you owe MORE): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
@@ -345,7 +345,7 @@ class CreditRecalculateService
if (in_array($type, [TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value], true)) {
$usedAmount = app('steam')->negative($usedAmount);
- return bcadd($leftOfDebt, (string) $usedAmount);
+ return bcadd($leftOfDebt, $usedAmount);
// Log::debug(sprintf('Case X (all other cases): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2)));
}
diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php
index 9f53540109..731d98ef6e 100644
--- a/app/Services/Internal/Update/JournalUpdateService.php
+++ b/app/Services/Internal/Update/JournalUpdateService.php
@@ -780,10 +780,10 @@ class JournalUpdateService
private function isBetweenAssetAndLiability(): bool
{
- /** @var Transaction $sourceTransaction */
+ /** @var Transaction|null $sourceTransaction */
$sourceTransaction = $this->transactionJournal->transactions()->where('amount', '<', 0)->first();
- /** @var Transaction $destinationTransaction */
+ /** @var Transaction|null $destinationTransaction */
$destinationTransaction = $this->transactionJournal->transactions()->where('amount', '>', 0)->first();
if (null === $sourceTransaction || null === $destinationTransaction) {
Log::warning('Either transaction is false, stop.');
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index b192b5d035..e4edc5c4fb 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -33,6 +33,7 @@ use FireflyIII\Support\Singleton\PreferencesSingleton;
use FireflyIII\User;
use Illuminate\Support\Collection;
use NumberFormatter;
+use FireflyIII\Support\Facades\Steam;
/**
* Class Amount.
@@ -58,8 +59,8 @@ 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 = Steam::getLocale();
+ $rounded = Steam::bcround($amount, $decimalPlaces);
$coloured ??= true;
$fmt = new NumberFormatter($locale, NumberFormatter::CURRENCY);
@@ -69,10 +70,10 @@ class Amount
$result = (string)$fmt->format((float)$rounded); // intentional float
if (true === $coloured) {
- if (1 === bccomp((string)$rounded, '0')) {
+ if (1 === bccomp($rounded, '0')) {
return sprintf('%s', $result);
}
- if (-1 === bccomp((string)$rounded, '0')) {
+ if (-1 === bccomp($rounded, '0')) {
return sprintf('%s', $result);
}
@@ -242,8 +243,8 @@ class Amount
private function getLocaleInfo(): array
{
// get config from preference, not from translation:
- $locale = app('steam')->getLocale();
- $array = app('steam')->getLocaleArray($locale);
+ $locale = Steam::getLocale();
+ $array = Steam::getLocaleArray($locale);
setlocale(LC_MONETARY, $array);
$info = localeconv();
diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php
index ad0f0b4b71..d4a44e4e6a 100644
--- a/app/Support/Export/ExportDataGenerator.php
+++ b/app/Support/Export/ExportDataGenerator.php
@@ -85,7 +85,7 @@ class ExportDataGenerator
private bool $exportTransactions;
private Carbon $start;
private User $user;
- private UserGroup $userGroup;
+ private UserGroup $userGroup; // @phpstan-ignore-line
public function __construct()
{
diff --git a/app/Support/Facades/Navigation.php b/app/Support/Facades/Navigation.php
index bb171321a6..8fd37589c4 100644
--- a/app/Support/Facades/Navigation.php
+++ b/app/Support/Facades/Navigation.php
@@ -26,25 +26,6 @@ namespace FireflyIII\Support\Facades;
use Carbon\Carbon;
use Illuminate\Support\Facades\Facade;
-/**
- * Class Navigation.
- *
- * @method Carbon addPeriod(Carbon $theDate, string $repeatFreq, int $skip)
- * @method array blockPeriods(Carbon $start, Carbon $end, string $range)
- * @method Carbon endOfPeriod(Carbon $end, string $repeatFreq)
- * @method Carbon endOfX(Carbon $theCurrentEnd, string $repeatFreq, Carbon $maxDate = null)
- * @method array listOfPeriods(Carbon $start, Carbon $end)
- * @method string periodShow(Carbon $theDate, string $repeatFrequency)
- * @method string preferredCarbonFormat(Carbon $start, Carbon $end)
- * @method string preferredCarbonLocalizedFormat(Carbon $start, Carbon $end)
- * @method string preferredEndOfPeriod(Carbon $start, Carbon $end)
- * @method string preferredRangeFormat(Carbon $start, Carbon $end)
- * @method string preferredSqlFormat(Carbon $start, Carbon $end)
- * @method Carbon startOfPeriod(Carbon $theDate, string $repeatFreq)
- * @method Carbon subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = 1)
- * @method Carbon updateEndDate(string $range, Carbon $start)
- * @method Carbon updateStartDate(string $range, Carbon $start)
- */
class Navigation extends Facade
{
/**
diff --git a/app/Support/Http/Api/AccountBalanceGrouped.php b/app/Support/Http/Api/AccountBalanceGrouped.php
index 397146be61..4ef803e957 100644
--- a/app/Support/Http/Api/AccountBalanceGrouped.php
+++ b/app/Support/Http/Api/AccountBalanceGrouped.php
@@ -163,7 +163,7 @@ class AccountBalanceGrouped
// get conversion rate
$rate = $this->getRate($currency, $journal['date']);
- $amountConverted = bcmul((string)$amount, $rate);
+ $amountConverted = bcmul($amount, $rate);
// perhaps transaction already has the foreign amount in the primary currency.
if ((int)$journal['foreign_currency_id'] === $this->primary->id) {
@@ -172,11 +172,11 @@ class AccountBalanceGrouped
}
// add normal entry
- $this->data[$currencyId][$period][$key] = bcadd((string)$this->data[$currencyId][$period][$key], (string)$amount);
+ $this->data[$currencyId][$period][$key] = bcadd((string)$this->data[$currencyId][$period][$key], $amount);
// add converted entry
$convertedKey = sprintf('pc_%s', $key);
- $this->data[$currencyId][$period][$convertedKey] = bcadd((string)$this->data[$currencyId][$period][$convertedKey], (string)$amountConverted);
+ $this->data[$currencyId][$period][$convertedKey] = bcadd((string)$this->data[$currencyId][$period][$convertedKey], $amountConverted);
}
private function findCurrency(int $currencyId): TransactionCurrency
diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.php
index 4baecf7163..109fad9854 100644
--- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php
@@ -300,7 +300,7 @@ class AccountEnrichment implements EnrichmentInterface
// collect current balances:
$currentBalance = Steam::bcround($finalBalance[$currency->code] ?? '0', $currency->decimal_places);
$openingBalance = Steam::bcround($meta['opening_balance_amount'] ?? '0', $currency->decimal_places);
- $virtualBalance = Steam::bcround($account->virtual_balance ?? '0', $currency->decimal_places);
+ $virtualBalance = Steam::bcround($item->virtual_balance ?? '0', $currency->decimal_places);
$debtAmount = $meta['current_debt'] ?? null;
// set some pc_ default values to NULL:
@@ -440,7 +440,7 @@ class AccountEnrichment implements EnrichmentInterface
private function sortData(): void
{
$dbParams = config('firefly.allowed_db_sort_parameters.Account', []);
- /** @var array $parameter */
+ /** @var array $parameter */
foreach ($this->sort as $parameter) {
if (in_array($parameter[0], $dbParams, true)) {
continue;