Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 14:24:19 +01:00
parent 64ff5eed27
commit 2eebcb21f1
60 changed files with 103 additions and 158 deletions

View File

@@ -48,7 +48,9 @@ use Log;
*/
class AccountController extends Controller
{
use DateCalculation, AugumentData, ChartGeneration;
use DateCalculation;
use AugumentData;
use ChartGeneration;
protected GeneratorInterface $generator;
private AccountRepositoryInterface $accountRepository;
@@ -88,7 +90,7 @@ class AccountController extends Controller
$start = clone session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
$end = clone session('end', Carbon::now()->endOfMonth());
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.account.expense-accounts');
@@ -196,7 +198,7 @@ class AccountController extends Controller
*/
public function expenseBudget(Account $account, Carbon $start, Carbon $end): JsonResponse
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty($start);
$cache->addProperty($end);
@@ -271,7 +273,7 @@ class AccountController extends Controller
*/
public function expenseCategory(Account $account, Carbon $start, Carbon $end): JsonResponse
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty($start);
$cache->addProperty($end);
@@ -372,7 +374,7 @@ class AccountController extends Controller
*/
public function incomeCategory(Account $account, Carbon $start, Carbon $end): JsonResponse
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($account->id);
$cache->addProperty($start);
$cache->addProperty($end);
@@ -432,7 +434,7 @@ class AccountController extends Controller
public function period(Account $account, Carbon $start, Carbon $end): JsonResponse
{
$chartData = [];
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('chart.account.period');
$cache->addProperty($start);
$cache->addProperty($end);
@@ -508,7 +510,6 @@ class AccountController extends Controller
$current = app('navigation')->addPeriod($current, $step, 0);
}
break;
}
$result['entries'] = $entries;
@@ -547,7 +548,7 @@ class AccountController extends Controller
$start = clone session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
$end = clone session('end', Carbon::now()->endOfMonth());
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.account.revenue-accounts');

View File

@@ -62,7 +62,7 @@ class BillController extends Controller
{
$start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth());
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.bill.frontpage');
@@ -106,7 +106,7 @@ class BillController extends Controller
*/
public function single(Bill $bill): JsonResponse
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('chart.bill.single');
$cache->addProperty($bill->id);
if ($cache->has()) {

View File

@@ -49,7 +49,8 @@ use JsonException;
*/
class BudgetController extends Controller
{
use DateCalculation, AugumentData;
use DateCalculation;
use AugumentData;
protected GeneratorInterface $generator;
protected OperationsRepositoryInterface $opsRepository;
@@ -209,7 +210,7 @@ class BudgetController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id;
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($budget->id);
$cache->addProperty($budgetLimitId);
$cache->addProperty('chart.budget.expense-asset');
@@ -277,7 +278,7 @@ class BudgetController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id;
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($budget->id);
$cache->addProperty($budgetLimitId);
$cache->addProperty('chart.budget.expense-category');
@@ -341,7 +342,7 @@ class BudgetController extends Controller
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id;
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($budget->id);
$cache->addProperty($budgetLimitId);
$cache->addProperty('chart.budget.expense-expense');

View File

@@ -41,7 +41,8 @@ use Illuminate\Support\Collection;
*/
class BudgetReportController extends Controller
{
use AugumentData, TransactionCalculation;
use AugumentData;
use TransactionCalculation;
/** @var GeneratorInterface Chart generation methods. */
private $generator;

View File

@@ -46,7 +46,9 @@ use JsonException;
*/
class CategoryController extends Controller
{
use DateCalculation, AugumentData, ChartGeneration;
use DateCalculation;
use AugumentData;
use ChartGeneration;
/** @var GeneratorInterface Chart generation methods. */
protected $generator;
@@ -77,7 +79,7 @@ class CategoryController extends Controller
public function all(Category $category): JsonResponse
{
// cache results:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('chart.category.all');
$cache->addProperty($category->id);
if ($cache->has()) {
@@ -125,7 +127,7 @@ class CategoryController extends Controller
$start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth());
// chart properties for cache:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.category.frontpage');
@@ -154,7 +156,7 @@ class CategoryController extends Controller
*/
public function reportPeriod(Category $category, Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.category.period');
@@ -202,7 +204,6 @@ class CategoryController extends Controller
$collection = new Collection([$category]);
$expenses = $opsRepository->listExpenses($start, $end, null, $collection);
$income = $opsRepository->listIncome($start, $end, null, $collection);
}
$currencies = array_unique(array_merge(array_keys($income), array_keys($expenses)));
$periods = app('navigation')->listOfPeriods($start, $end);
@@ -269,7 +270,7 @@ class CategoryController extends Controller
*/
public function reportPeriodNoCategory(Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.category.period.no-cat');
@@ -305,7 +306,7 @@ class CategoryController extends Controller
[$end, $start] = [$start, $end];
}
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($category->id);

View File

@@ -39,7 +39,8 @@ use Illuminate\Support\Collection;
*/
class CategoryReportController extends Controller
{
use AugumentData, TransactionCalculation;
use AugumentData;
use TransactionCalculation;
/** @var GeneratorInterface Chart generation methods. */
private $generator;

View File

@@ -38,7 +38,6 @@ use Illuminate\Support\Collection;
*/
class DoubleReportController extends Controller
{
/** @var GeneratorInterface Chart generation methods. */
private $generator;
/** @var OperationsRepositoryInterface */

View File

@@ -42,7 +42,8 @@ use JsonException;
*/
class ExpenseReportController extends Controller
{
use AugumentData, TransactionCalculation;
use AugumentData;
use TransactionCalculation;
/** @var AccountRepositoryInterface The account repository */
protected $accountRepository;
@@ -82,7 +83,7 @@ class ExpenseReportController extends Controller
*/
public function mainChart(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): JsonResponse
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('chart.expense.report.main');
$cache->addProperty($accounts);
$cache->addProperty($expense);
@@ -98,7 +99,7 @@ class ExpenseReportController extends Controller
$currentStart = clone $start;
$combined = $this->combineAccounts($expense);
// make "all" set:
$all = new Collection;
$all = new Collection();
foreach ($combined as $name => $combination) {
$all = $all->merge($combination);
}