Code cleanup.

This commit is contained in:
James Cole
2023-12-20 19:35:52 +01:00
parent c4f6366642
commit 64ec0cf62e
997 changed files with 12908 additions and 28136 deletions

View File

@@ -41,7 +41,6 @@ use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
*
* Class ShowController
*/
class ShowController extends Controller
@@ -54,8 +53,6 @@ class ShowController extends Controller
/**
* ShowController constructor.
*
*/
public function __construct()
{
@@ -76,20 +73,17 @@ class ShowController extends Controller
/**
* Show transactions without a budget.
*
* @param Request $request
* @param Carbon|null $start
* @param Carbon|null $end
*
* @return Factory|View
*
* @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function noBudget(Request $request, Carbon $start = null, Carbon $end = null)
{
/** @var Carbon $start */
// @var Carbon $start
$start ??= session('start');
/** @var Carbon $end */
// @var Carbon $end
$end ??= session('end');
$subTitle = trans(
'firefly.without_budget_between',
@@ -106,7 +100,8 @@ class ShowController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withAccountInformation()->withCategoryInformation();
->withoutBudget()->withAccountInformation()->withCategoryInformation()
;
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget'));
@@ -116,9 +111,8 @@ class ShowController extends Controller
/**
* Shows ALL transactions without a budget.
*
* @param Request $request
*
* @return Factory|View
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
@@ -134,7 +128,8 @@ class ShowController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withAccountInformation()->withCategoryInformation();
->withoutBudget()->withAccountInformation()->withCategoryInformation()
;
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget-all'));
@@ -144,10 +139,8 @@ class ShowController extends Controller
/**
* Show a single budget.
*
* @param Request $request
* @param Budget $budget
*
* @return Factory|View
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
@@ -166,8 +159,9 @@ class ShowController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($allStart, $allEnd)->setBudget($budget)
->withAccountInformation()
->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation();
->withAccountInformation()
->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation()
;
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.show', [$budget->id]));
@@ -179,11 +173,8 @@ class ShowController extends Controller
/**
* Show a single budget by a budget limit.
*
* @param Request $request
* @param Budget $budget
* @param BudgetLimit $budgetLimit
*
* @return Factory|View
*
* @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
@@ -211,9 +202,11 @@ class ShowController extends Controller
$collector = app(GroupCollectorInterface::class);
$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date)->withAccountInformation()
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation();
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withBudgetInformation()->withCategoryInformation()
;
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.show.limit', [$budget->id, $budgetLimit->id]));
/** @var Carbon $start */
$start = session('first', today(config('app.timezone'))->startOfYear());
$end = today(config('app.timezone'));