Skip to content

Firefly III: a personal finances manager

Refactor method to original name #524

James Cole7c5ee8a67d4c
diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php
index cf1404f0dd..a8a17ea00c 100644
--- a/app/Http/Controllers/CategoryController.php
+++ b/app/Http/Controllers/CategoryController.php
@@ -345,7 +345,7 @@ class CategoryController extends Controller
while ($end >= $first) {
$end = Navigation::startOfPeriod($end, $range);
$currentEnd = Navigation::endOfPeriod($end, $range);
- $spent = $repository->spentInPeriodCollector(new Collection([$category]), $accounts, $end, $currentEnd);
+ $spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $end, $currentEnd);
$earned = $repository->earnedInPeriod(new Collection([$category]), $accounts, $end, $currentEnd);
$dateStr = $end->format('Y-m-d');
$dateName = Navigation::periodShow($end, $range);
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index 15c807412f..5e8240e116 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -90,7 +90,7 @@ class CategoryController extends Controller
while ($start <= $end) {
$currentEnd = Navigation::endOfPeriod($start, $range);
- $spent = $repository->spentInPeriodCollector(new Collection([$category]), $accounts, $start, $currentEnd);
+ $spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $currentEnd);
$earned = $repository->earnedInPeriod(new Collection([$category]), $accounts, $start, $currentEnd);
$label = Navigation::periodShow($start, $range);
$chartData[0]['entries'][$label] = bcmul($spent, '-1');
@@ -143,7 +143,7 @@ class CategoryController extends Controller
$accounts = $accountRepository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT]);
/** @var Category $category */
foreach ($categories as $category) {
- $spent = $repository->spentInPeriodCollector(new Collection([$category]), $accounts, $start, $end);
+ $spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
if (bccomp($spent, '0') === -1) {
$chartData[$category->name] = bcmul($spent, '-1');
}
@@ -315,7 +315,7 @@ class CategoryController extends Controller
];
while ($start <= $end) {
- $spent = $repository->spentInPeriodCollector(new Collection([$category]), $accounts, $start, $start);
+ $spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $start);
$earned = $repository->earnedInPeriod(new Collection([$category]), $accounts, $start, $start);
$label = Navigation::periodShow($start, '1D');
diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php
index 2426dd6ea6..730deeaece 100644
--- a/app/Http/Controllers/Report/CategoryController.php
+++ b/app/Http/Controllers/Report/CategoryController.php
@@ -123,7 +123,7 @@ class CategoryController extends Controller
$report = [];
/** @var Category $category */
foreach ($categories as $category) {
- $spent = $repository->spentInPeriodCollector(new Collection([$category]), $accounts, $start, $end);
+ $spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
if (bccomp($spent, '0') !== 0) {
$report[$category->id] = ['name' => $category->name, 'spent' => $spent];
}
diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php
index 8d4d7ed1ec..637e31dccd 100644
--- a/app/Repositories/Category/CategoryRepository.php
+++ b/app/Repositories/Category/CategoryRepository.php
@@ -392,7 +392,7 @@ class CategoryRepository implements CategoryRepositoryInterface
*
* @return string
*/
- public function spentInPeriodCollector(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string
+ public function spentInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [$this->user]);
diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php
index 66bfe14a19..3bc70a9459 100644
--- a/app/Repositories/Category/CategoryRepositoryInterface.php
+++ b/app/Repositories/Category/CategoryRepositoryInterface.php
@@ -129,7 +129,7 @@ interface CategoryRepositoryInterface
*
* @return string
*/
- public function spentInPeriodCollector(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string;
+ public function spentInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string;
/**
* @param Collection $accounts