Small code cleanup.

This commit is contained in:
James Cole
2021-04-27 06:23:16 +02:00
parent cf2c99d986
commit fab0c5bfd9
19 changed files with 26 additions and 73 deletions

View File

@@ -108,7 +108,7 @@ class BudgetController extends Controller
$currencies = [];
$defaultEntries = [];
while ($end >= $loopStart) {
/** @var Carbon $currentEnd */
/** @var Carbon $loopEnd */
$loopEnd = app('navigation')->endOfPeriod($loopStart, $step);
$spent = $this->opsRepository->sumExpenses($loopStart, $loopEnd, null, $collection);
$label = trim(app('navigation')->periodShow($loopStart, $step));

View File

@@ -76,7 +76,7 @@ class CategoryController extends Controller
$cache->addProperty('chart.category.all');
$cache->addProperty($category->id);
if ($cache->has()) {
return response()->json($cache->get());
return response()->json($cache->get());
}
/** @var CategoryRepositoryInterface $repository */
$repository = app(CategoryRepositoryInterface::class);
@@ -125,7 +125,7 @@ class CategoryController extends Controller
$cache->addProperty($end);
$cache->addProperty('chart.category.frontpage');
if ($cache->has()) {
return response()->json($cache->get());
return response()->json($cache->get());
}
$frontPageGenerator = new FrontpageChartGenerator($start, $end);
@@ -270,7 +270,7 @@ class CategoryController extends Controller
$cache->addProperty('chart.category.period.no-cat');
$cache->addProperty($accounts->pluck('id')->toArray());
if ($cache->has()) {
return response()->json($cache->get());
return response()->json($cache->get());
}
$data = $this->reportPeriodChart($accounts, $start, $end, null);
@@ -283,8 +283,8 @@ class CategoryController extends Controller
* Chart for a specific period.
* TODO test method, for category refactor.
*
* @param Category $category
* @param $date
* @param Category $category
* @param Carbon $date
*
* @return JsonResponse
*/
@@ -294,7 +294,7 @@ class CategoryController extends Controller
$start = app('navigation')->startOfPeriod($date, $range);
$end = session()->get('end');
if ($end < $start) {
[$end, $start] = [$start, $end];
[$end, $start] = [$start, $end];
}
$cache = new CacheProperties;
@@ -303,7 +303,7 @@ class CategoryController extends Controller
$cache->addProperty($category->id);
$cache->addProperty('chart.category.period-chart');
if ($cache->has()) {
return response()->json($cache->get());
return response()->json($cache->get());
}
/** @var WholePeriodChartGenerator $chartGenerator */

View File

@@ -140,10 +140,8 @@ class CategoryReportController extends Controller
* @param Collection $categories
* @param Carbon $start
* @param Carbon $end
* @param string $others
*
* @return JsonResponse
*
*/
public function categoryIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): JsonResponse
{

View File

@@ -80,7 +80,7 @@ class PiggyBankController extends Controller
$locale = app('steam')->getLocale();
// get first event or start date of piggy bank or today
$startDate = $piggyBank->start_date ?? today(config('app.timezone'));
$startDate = $piggyBank->startdate ?? today(config('app.timezone'));
/** @var PiggyBankEvent $first */
$firstEvent = $set->first();

View File

@@ -52,12 +52,10 @@ class TransactionController extends Controller
}
/**
* @param string $objectType
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
* @throws FireflyException
*/
public function budgets(Carbon $start, Carbon $end)
{