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

@@ -46,8 +46,6 @@ class IndexController extends Controller
/**
* IndexController constructor.
*
*/
public function __construct()
{
@@ -69,12 +67,8 @@ class IndexController extends Controller
/**
* Index for a range of transactions.
*
* @param Request $request
* @param string $objectType
* @param Carbon|null $start
* @param Carbon|null $end
*
* @return Factory|View
*
* @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
@@ -85,8 +79,8 @@ class IndexController extends Controller
$objectType = 'transfer';
}
$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);
$types = config('firefly.transactionTypesByType.' . $objectType);
$subTitleIcon = config('firefly.transactionIconsByType.'.$objectType);
$types = config('firefly.transactionTypesByType.'.$objectType);
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
if (null === $start) {
@@ -114,13 +108,14 @@ class IndexController extends Controller
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)
->setTypes($types)
->setLimit($pageSize)
->setPage($page)
->withBudgetInformation()
->withCategoryInformation()
->withAccountInformation()
->withAttachmentInformation();
->setTypes($types)
->setLimit($pageSize)
->setPage($page)
->withBudgetInformation()
->withCategoryInformation()
->withAccountInformation()
->withAttachmentInformation()
;
$groups = $collector->getPaginatedGroups();
$groups->setPath($path);
@@ -130,17 +125,15 @@ class IndexController extends Controller
/**
* Index for ALL transactions.
*
* @param Request $request
* @param string $objectType
*
* @return Factory|View
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function indexAll(Request $request, string $objectType)
{
$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);
$types = config('firefly.transactionTypesByType.' . $objectType);
$subTitleIcon = config('firefly.transactionIconsByType.'.$objectType);
$types = config('firefly.transactionTypesByType.'.$objectType);
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$path = route('transactions.index.all', [$objectType]);
@@ -148,19 +141,20 @@ class IndexController extends Controller
$start = null === $first ? new Carbon() : $first->date;
$last = $this->repository->getLast();
$end = null !== $last ? $last->date : today(config('app.timezone'));
$subTitle = (string)trans('firefly.all_' . $objectType);
$subTitle = (string)trans('firefly.all_'.$objectType);
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector->setRange($start, $end)
->setTypes($types)
->setLimit($pageSize)
->setPage($page)
->withAccountInformation()
->withBudgetInformation()
->withCategoryInformation()
->withAttachmentInformation();
->setTypes($types)
->setLimit($pageSize)
->setPage($page)
->withAccountInformation()
->withBudgetInformation()
->withCategoryInformation()
->withAttachmentInformation()
;
$groups = $collector->getPaginatedGroups();
$groups->setPath($path);