Replace method calls.

This commit is contained in:
James Cole
2025-09-10 16:07:19 +02:00
parent a3674c4dfe
commit cb0b42e44b
51 changed files with 87 additions and 91 deletions

View File

@@ -235,7 +235,7 @@ class AccountController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))
$collector->setAccounts(new Collection()->push($account))
->setRange($start, $end)
->withBudgetInformation()->setTypes([TransactionTypeEnum::WITHDRAWAL->value])
;
@@ -322,7 +322,7 @@ class AccountController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionTypeEnum::WITHDRAWAL->value]);
$collector->setAccounts(new Collection()->push($account))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionTypeEnum::WITHDRAWAL->value]);
$journals = $collector->getExtractedJournals();
$result = [];
$chartData = [];
@@ -429,7 +429,7 @@ class AccountController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionTypeEnum::DEPOSIT->value]);
$collector->setAccounts(new Collection()->push($account))->setRange($start, $end)->withCategoryInformation()->setTypes([TransactionTypeEnum::DEPOSIT->value]);
$journals = $collector->getExtractedJournals();
$result = [];
$chartData = [];

View File

@@ -100,7 +100,7 @@ class BudgetController extends Controller
return response()->json($cache->get());
}
$step = $this->calculateStep($start, $end); // depending on diff, do something with range of chart.
$collection = new Collection([$budget]);
$collection = new Collection()->push($budget);
$chartData = [];
$loopStart = clone $start;
$loopStart = Navigation::startOfPeriod($loopStart, $step);
@@ -169,7 +169,7 @@ class BudgetController extends Controller
$locale = app('steam')->getLocale();
$entries = [];
$amount = $budgetLimit->amount ?? '0';
$budgetCollection = new Collection([$budget]);
$budgetCollection = new Collection()->push($budget);
$currency = $budgetLimit->transactionCurrency;
if ($this->convertToPrimary) {
$amount = $budgetLimit->native_amount ?? $amount;
@@ -535,7 +535,7 @@ class BudgetController extends Controller
}
// get spent amount in this period for this currency.
$sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection([$budget]), $currency);
$sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency);
$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0');
$chartData[0]['entries'][$title] = app('steam')->bcround($amount, $currency->decimal_places);

View File

@@ -163,7 +163,7 @@ class BudgetReportController extends Controller
public function mainChart(Collection $accounts, Budget $budget, Carbon $start, Carbon $end): JsonResponse
{
$chartData = [];
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection([$budget]));
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection()->push($budget));
$format = Navigation::preferredCarbonLocalizedFormat($start, $end);
// loop expenses.

View File

@@ -174,7 +174,7 @@ class CategoryController extends Controller
$opsRepository = app(OperationsRepositoryInterface::class);
$categoryId = $category->id;
// this gives us all currencies
$collection = new Collection([$category]);
$collection = new Collection()->push($category);
$expenses = $opsRepository->listExpenses($start, $end, $accounts, $collection);
$income = $opsRepository->listIncome($start, $end, $accounts, $collection);
}

View File

@@ -208,8 +208,8 @@ class CategoryReportController extends Controller
public function mainChart(Collection $accounts, Category $category, Carbon $start, Carbon $end): JsonResponse
{
$chartData = [];
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection([$category]));
$earned = $this->opsRepository->listIncome($start, $end, $accounts, new Collection([$category]));
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection()->push($category));
$earned = $this->opsRepository->listIncome($start, $end, $accounts, new Collection()->push($category));
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
// loop expenses.
foreach ($spent as $currency) {

View File

@@ -150,7 +150,7 @@ class DoubleReportController extends Controller
{
$chartData = [];
$opposing = $this->repository->expandWithDoubles(new Collection([$account]));
$opposing = $this->repository->expandWithDoubles(new Collection()->push($account));
$accounts = $accounts->merge($opposing);
$spent = $this->opsRepository->listExpenses($start, $end, $accounts);
$earned = $this->opsRepository->listIncome($start, $end, $accounts);

View File

@@ -212,8 +212,8 @@ class TagReportController extends Controller
public function mainChart(Collection $accounts, Tag $tag, Carbon $start, Carbon $end): JsonResponse
{
$chartData = [];
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection([$tag]));
$earned = $this->opsRepository->listIncome($start, $end, $accounts, new Collection([$tag]));
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, new Collection()->push($tag));
$earned = $this->opsRepository->listIncome($start, $end, $accounts, new Collection()->push($tag));
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
// loop expenses.