Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 14:24:28 +01:00
parent 2eebcb21f1
commit f53923f16c
187 changed files with 429 additions and 482 deletions

View File

@@ -69,7 +69,7 @@ class PiggyBankController extends Controller
public function history(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank): JsonResponse
{
// chart properties for cache:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('chart.piggy-bank.history');
$cache->addProperty($piggyBank->id);
if ($cache->has()) {
@@ -84,7 +84,7 @@ class PiggyBankController extends Controller
/** @var PiggyBankEvent $firstEvent */
$firstEvent = $set->first();
$firstDate = null === $firstEvent ? new Carbon : $firstEvent->date;
$firstDate = null === $firstEvent ? new Carbon() : $firstEvent->date;
// which ever is older:
$oldest = $startDate->lt($firstDate) ? $startDate : $firstDate;

View File

@@ -43,7 +43,8 @@ use Log;
*/
class ReportController extends Controller
{
use BasicDataSupport, ChartGeneration;
use BasicDataSupport;
use ChartGeneration;
/** @var GeneratorInterface Chart generation methods. */
protected $generator;
@@ -74,7 +75,7 @@ class ReportController extends Controller
public function netWorth(Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
// chart properties for cache:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('chart.report.net-worth');
$cache->addProperty($start);
$cache->addProperty(implode(',', $accounts->pluck('id')->toArray()));
@@ -125,7 +126,6 @@ class ReportController extends Controller
];
}
$chartData[$currencyId]['entries'][$label] = $netWorthItem['balance'];
}
$current->addDays(7);
}
@@ -149,7 +149,7 @@ class ReportController extends Controller
public function operations(Collection $accounts, Carbon $start, Carbon $end): JsonResponse
{
// chart properties for cache:
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty('chart.report.operations');
$cache->addProperty($start);
$cache->addProperty($accounts);

View File

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

View File

@@ -39,7 +39,6 @@ use JsonException;
*/
class TransactionController extends Controller
{
/** @var GeneratorInterface Chart generation methods. */
protected $generator;
@@ -60,7 +59,7 @@ class TransactionController extends Controller
*/
public function budgets(Carbon $start, Carbon $end)
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty('chart.transactions.budgets');
@@ -104,7 +103,7 @@ class TransactionController extends Controller
*/
public function categories(string $objectType, Carbon $start, Carbon $end)
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($objectType);
@@ -144,7 +143,6 @@ class TransactionController extends Controller
'currency_code' => $journal['currency_code'],
];
$data[$title]['amount'] = bcadd($data[$title]['amount'], $journal['amount']);
}
$chart = $this->generator->multiCurrencyPieChart($data);
$cache->store($chart);
@@ -162,7 +160,7 @@ class TransactionController extends Controller
*/
public function destinationAccounts(string $objectType, Carbon $start, Carbon $end)
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($objectType);
@@ -219,7 +217,7 @@ class TransactionController extends Controller
*/
public function sourceAccounts(string $objectType, Carbon $start, Carbon $end)
{
$cache = new CacheProperties;
$cache = new CacheProperties();
$cache->addProperty($start);
$cache->addProperty($end);
$cache->addProperty($objectType);
@@ -259,7 +257,6 @@ class TransactionController extends Controller
'currency_code' => $journal['currency_code'],
];
$data[$title]['amount'] = bcadd($data[$title]['amount'], $journal['amount']);
}
$chart = $this->generator->multiCurrencyPieChart($data);
$cache->store($chart);