Code cleanup.

This commit is contained in:
James Cole
2021-03-28 11:46:23 +02:00
parent 2c575f3ca5
commit b5eeacc128
124 changed files with 1568 additions and 1384 deletions

View File

@@ -22,6 +22,7 @@
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Recurring;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
@@ -42,6 +43,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
class IndexController extends Controller
{
use GetConfigurationData;
private RecurringRepositoryInterface $recurringRepos;
/**
@@ -57,7 +59,7 @@ class IndexController extends Controller
$this->middleware(
function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-paint-brush');
app('view')->share('title', (string) trans('firefly.recurrences'));
app('view')->share('title', (string)trans('firefly.recurrences'));
$this->recurringRepos = app(RecurringRepositoryInterface::class);
@@ -72,20 +74,20 @@ class IndexController extends Controller
*
* @param Request $request
*
* @return Factory|View
* @throws FireflyException
*
* @return Factory|View
*/
public function index(Request $request)
{
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
$page = 0 === (int)$request->get('page') ? 1 : (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$collection = $this->recurringRepos->get();
$today = today(config('app.timezone'));
$year = today(config('app.timezone'));
// split collection
$total = $collection->count();
$total = $collection->count();
$recurrences = $collection->slice(($page - 1) * $pageSize, $pageSize);
/** @var RecurrenceTransformer $transformer */