Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:41:57 +01:00
parent 0022009dd5
commit dbf3e76ecc
340 changed files with 4079 additions and 3816 deletions

View File

@@ -71,10 +71,10 @@ class BudgetReportController extends Controller
/**
* Chart that groups the expenses by budget.
*
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -88,10 +88,10 @@ class BudgetReportController extends Controller
foreach ($currency['budgets'] as $budget) {
$title = sprintf('%s (%s)', $budget['name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
foreach ($budget['transaction_journals'] as $journal) {
$amount = app('steam')->positive($journal['amount']);
$result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
@@ -107,10 +107,10 @@ class BudgetReportController extends Controller
/**
* Chart that groups the expenses by budget.
*
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -125,10 +125,10 @@ class BudgetReportController extends Controller
$categoryName = $journal['category_name'] ?? trans('firefly.no_category');
$title = sprintf('%s (%s)', $categoryName, $currency['currency_name']);
$result[$title] = $result[$title] ?? [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
$amount = app('steam')->positive($journal['amount']);
$result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
@@ -144,10 +144,10 @@ class BudgetReportController extends Controller
/**
* Chart that groups expenses by the account.
*
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -162,10 +162,10 @@ class BudgetReportController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
$title = sprintf('%s (%s)', $journal['destination_account_name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
$amount = app('steam')->positive($journal['amount']);
$result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);
@@ -181,10 +181,10 @@ class BudgetReportController extends Controller
/**
* Main overview of a budget in the budget report.
*
* @param Collection $accounts
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -199,17 +199,17 @@ class BudgetReportController extends Controller
// add things to chart Data for each currency:
$spentKey = sprintf('%d-spent', $currency['currency_id']);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
'label' => sprintf(
'%s (%s)',
(string) trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
$currency['currency_name']
),
'type' => 'bar',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
'currency_id' => $currency['currency_id'],
'entries' => $this->makeEntries($start, $end),
];
'label' => sprintf(
'%s (%s)',
(string)trans('firefly.spent_in_specific_budget', ['budget' => $budget->name]),
$currency['currency_name']
),
'type' => 'bar',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
'currency_id' => $currency['currency_id'],
'entries' => $this->makeEntries($start, $end),
];
foreach ($currency['budgets'] as $currentBudget) {
foreach ($currentBudget['transaction_journals'] as $journal) {
@@ -227,8 +227,8 @@ class BudgetReportController extends Controller
}
/**
* @param Carbon $start
* @param Carbon $end
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
@@ -252,10 +252,10 @@ class BudgetReportController extends Controller
/**
* Chart that groups expenses by the account.
*
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -270,10 +270,10 @@ class BudgetReportController extends Controller
foreach ($budget['transaction_journals'] as $journal) {
$title = sprintf('%s (%s)', $journal['source_account_name'], $currency['currency_name']);
$result[$title] = $result[$title] ?? [
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
'amount' => '0',
'currency_symbol' => $currency['currency_symbol'],
'currency_code' => $currency['currency_code'],
];
$amount = app('steam')->positive($journal['amount']);
$result[$title]['amount'] = bcadd($result[$title]['amount'], $amount);