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

@@ -66,10 +66,10 @@ class DoubleReportController extends Controller
}
/**
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -86,10 +86,10 @@ class DoubleReportController extends Controller
$categoryName = $journal['budget_name'] ?? trans('firefly.no_budget');
$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);
}
@@ -101,10 +101,10 @@ class DoubleReportController extends Controller
}
/**
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -121,10 +121,10 @@ class DoubleReportController 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);
}
@@ -136,10 +136,10 @@ class DoubleReportController extends Controller
}
/**
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -156,10 +156,10 @@ class DoubleReportController 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);
}
@@ -171,10 +171,10 @@ class DoubleReportController extends Controller
}
/**
* @param Collection $accounts
* @param Account $account
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Account $account
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*
@@ -196,17 +196,17 @@ class DoubleReportController extends Controller
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
$chartData[$spentKey] = $chartData[$spentKey] ?? [
'label' => sprintf(
'%s (%s)',
(string) trans('firefly.spent_in_specific_double', ['account' => $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_double', ['account' => $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['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
@@ -222,17 +222,17 @@ class DoubleReportController extends Controller
$name = $this->getCounterpartName($accounts, $account->id, $account->name, $account->iban);
$chartData[$earnedKey] = $chartData[$earnedKey] ?? [
'label' => sprintf(
'%s (%s)',
(string) trans('firefly.earned_in_specific_double', ['account' => $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.earned_in_specific_double', ['account' => $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['transaction_journals'] as $journal) {
$key = $journal['date']->isoFormat($format);
@@ -250,10 +250,10 @@ class DoubleReportController extends Controller
/**
* TODO duplicate function
*
* @param Collection $accounts
* @param int $id
* @param string $name
* @param null|string $iban
* @param Collection $accounts
* @param int $id
* @param string $name
* @param null|string $iban
*
* @return string
*/
@@ -275,8 +275,8 @@ class DoubleReportController extends Controller
/**
* TODO duplicate function
*
* @param Carbon $start
* @param Carbon $end
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
@@ -298,10 +298,10 @@ class DoubleReportController extends Controller
}
/**
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -324,10 +324,10 @@ class DoubleReportController extends Controller
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $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);
}
@@ -342,10 +342,10 @@ class DoubleReportController extends Controller
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $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);
}
@@ -358,10 +358,10 @@ class DoubleReportController extends Controller
}
/**
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Collection $others
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/
@@ -384,10 +384,10 @@ class DoubleReportController extends Controller
$tagName = trans('firefly.no_tags');
$title = sprintf('%s (%s)', $tagName, $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);
}
@@ -402,10 +402,10 @@ class DoubleReportController extends Controller
$tagName = $tag['name'];
$title = sprintf('%s (%s)', $tagName, $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);
}