Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:42:26 +01:00
parent dbf3e76ecc
commit 6cfdc58cb1
415 changed files with 7462 additions and 6874 deletions

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Transaction;
use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
@@ -32,6 +32,8 @@ use FireflyIII\Support\Http\Controllers\PeriodOverview;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class IndexController
@@ -55,7 +57,7 @@ class IndexController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-exchange');
app('view')->share('title', (string) trans('firefly.transactions'));
app('view')->share('title', (string)trans('firefly.transactions'));
$this->repository = app(JournalRepositoryInterface::class);
@@ -67,15 +69,15 @@ class IndexController extends Controller
/**
* Index for a range of transactions.
*
* @param Request $request
* @param string $objectType
* @param Carbon|null $start
* @param Carbon|null $end
* @param Request $request
* @param string $objectType
* @param Carbon|null $start
* @param Carbon|null $end
*
* @return Factory|View
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function index(Request $request, string $objectType, Carbon $start = null, Carbon $end = null)
{
@@ -83,10 +85,10 @@ class IndexController extends Controller
$objectType = 'transfer';
}
$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);
$types = config('firefly.transactionTypesByType.' . $objectType);
$page = (int) $request->get('page');
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
$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) {
$start = session('start');
$end = session('end');
@@ -101,7 +103,7 @@ class IndexController extends Controller
$path = route('transactions.index', [$objectType, $start->format('Y-m-d'), $end->format('Y-m-d')]);
$startStr = $start->isoFormat($this->monthAndDayFormat);
$endStr = $end->isoFormat($this->monthAndDayFormat);
$subTitle = (string) trans(sprintf('firefly.title_%s_between', $objectType), ['start' => $startStr, 'end' => $endStr]);
$subTitle = (string)trans(sprintf('firefly.title_%s_between', $objectType), ['start' => $startStr, 'end' => $endStr]);
$firstJournal = $this->repository->firstNull();
$startPeriod = null === $firstJournal ? new Carbon() : $firstJournal->date;
@@ -128,26 +130,26 @@ class IndexController extends Controller
/**
* Index for ALL transactions.
*
* @param Request $request
* @param string $objectType
* @param Request $request
* @param string $objectType
*
* @return Factory|View
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws FireflyException
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function indexAll(Request $request, string $objectType)
{
$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);
$types = config('firefly.transactionTypesByType.' . $objectType);
$page = (int) $request->get('page');
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
$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]);
$first = $this->repository->firstNull();
$start = null === $first ? new Carbon() : $first->date;
$last = $this->repository->getLast();
$end = $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);