chore: reformat code.

This commit is contained in:
James Cole
2023-06-21 12:34:58 +02:00
parent 8d87abde64
commit 3dcb35710b
799 changed files with 23319 additions and 22173 deletions

View File

@@ -127,7 +127,7 @@ class BoxController extends Controller
/**
* Current total balance.
*
* @param CurrencyRepositoryInterface $repository
* @param CurrencyRepositoryInterface $repository
*
* @return JsonResponse
*/

View File

@@ -68,9 +68,9 @@ class BudgetController extends Controller
}
/**
* @param TransactionCurrency $currency
* @param Carbon $start
* @param Carbon $end
* @param TransactionCurrency $currency
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
*/

View File

@@ -39,7 +39,7 @@ class FrontpageController extends Controller
/**
* Piggy bank pie chart.
*
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBankRepositoryInterface $repository
*
* @return JsonResponse
* @throws FireflyException

View File

@@ -39,8 +39,8 @@ class IntroController extends Controller
/**
* Returns the introduction wizard for a page.
*
* @param string $route
* @param string|null $specificPage
* @param string $route
* @param string|null $specificPage
*
* @return JsonResponse
*/
@@ -74,7 +74,7 @@ class IntroController extends Controller
/**
* Returns true if there is a general outro step.
*
* @param string $route
* @param string $route
*
* @return bool
*/
@@ -99,8 +99,8 @@ class IntroController extends Controller
/**
* Enable the boxes for a specific page again.
*
* @param string $route
* @param string|null $specialPage
* @param string $route
* @param string|null $specialPage
*
* @return JsonResponse
* @throws FireflyException
@@ -109,9 +109,9 @@ class IntroController extends Controller
{
$specialPage = $specialPage ?? '';
$route = str_replace('.', '_', $route);
$key = 'shown_demo_'.$route;
$key = 'shown_demo_' . $route;
if ('' !== $specialPage) {
$key .= '_'.$specialPage;
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, false);
@@ -123,8 +123,8 @@ class IntroController extends Controller
/**
* Set that you saw them.
*
* @param string $route
* @param string|null $specialPage
* @param string $route
* @param string|null $specialPage
*
* @return JsonResponse
* @throws FireflyException
@@ -132,9 +132,9 @@ class IntroController extends Controller
public function postFinished(string $route, string $specialPage = null): JsonResponse
{
$specialPage = $specialPage ?? '';
$key = 'shown_demo_'.$route;
$key = 'shown_demo_' . $route;
if ('' !== $specialPage) {
$key .= '_'.$specialPage;
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
app('preferences')->set($key, true);

View File

@@ -70,10 +70,10 @@ class ReconcileController extends Controller
/**
* Overview of reconciliation.
*
* @param Request $request
* @param Account|null $account
* @param Carbon|null $start
* @param Carbon|null $end
* @param Request $request
* @param Account|null $account
* @param Carbon|null $start
* @param Carbon|null $end
*
* @return JsonResponse
* @throws FireflyException
@@ -169,12 +169,52 @@ class ReconcileController extends Controller
return response()->json($return);
}
/**
* @param Account $account
* @param TransactionCurrency $currency
* @param array $journal
* @param string $amount
*
* @return string
*/
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
{
$toAdd = '0';
Log::debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
// not much magic below we need to cover using tests.
if ($account->id === $journal['source_account_id']) {
if ($currency->id === $journal['currency_id']) {
$toAdd = $journal['amount'];
}
if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
$toAdd = $journal['foreign_amount'];
}
}
if ($account->id === $journal['destination_account_id']) {
if ($currency->id === $journal['currency_id']) {
$toAdd = bcmul($journal['amount'], '-1');
}
if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
$toAdd = bcmul($journal['foreign_amount'], '-1');
}
}
Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
$amount = bcadd($amount, $toAdd);
Log::debug(sprintf('Result is %s', $amount));
return $amount;
}
/**
* Returns a list of transactions in a modal.
*
* @param Account $account
* @param Carbon|null $start
* @param Carbon|null $end
* @param Account $account
* @param Carbon|null $start
* @param Carbon|null $end
*
* @return JsonResponse
* @throws FireflyException
@@ -225,51 +265,11 @@ class ReconcileController extends Controller
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
}
/**
* @param Account $account
* @param TransactionCurrency $currency
* @param array $journal
* @param string $amount
*
* @return string
*/
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
{
$toAdd = '0';
Log::debug(sprintf('User submitted %s #%d: "%s"', $journal['transaction_type_type'], $journal['transaction_journal_id'], $journal['description']));
// not much magic below we need to cover using tests.
if ($account->id === $journal['source_account_id']) {
if ($currency->id === $journal['currency_id']) {
$toAdd = $journal['amount'];
}
if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
$toAdd = $journal['foreign_amount'];
}
}
if ($account->id === $journal['destination_account_id']) {
if ($currency->id === $journal['currency_id']) {
$toAdd = bcmul($journal['amount'], '-1');
}
if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
$toAdd = bcmul($journal['foreign_amount'], '-1');
}
}
Log::debug(sprintf('Going to add %s to %s', $toAdd, $amount));
$amount = bcadd($amount, $toAdd);
Log::debug(sprintf('Result is %s', $amount));
return $amount;
}
/**
* "fix" amounts to make it easier on the reconciliation overview:
*
* @param Account $account
* @param array $array
* @param Account $account
* @param array $array
*
* @return array
*/

View File

@@ -63,7 +63,7 @@ class RecurrenceController extends Controller
/**
* Shows all events for a repetition. Used in calendar.
*
* @param Request $request
* @param Request $request
*
* @return JsonResponse
*
@@ -123,7 +123,7 @@ class RecurrenceController extends Controller
foreach ($occurrences as $current) {
if ($current->gte($start)) {
$event = [
'id' => $repetitionType.$firstDate->format('Ymd'),
'id' => $repetitionType . $firstDate->format('Ymd'),
'title' => 'X',
'allDay' => true,
'start' => $current->format('Y-m-d'),
@@ -141,7 +141,7 @@ class RecurrenceController extends Controller
/**
* Suggests repetition moments.
*
* @param Request $request
* @param Request $request
*
* @return JsonResponse
* @throws FireflyException

View File

@@ -38,7 +38,7 @@ class RuleController extends Controller
/**
* Render HTML form for rule action.
*
* @param Request $request
* @param Request $request
*
* @return JsonResponse
* @throws FireflyException
@@ -49,7 +49,7 @@ class RuleController extends Controller
$keys = array_keys(config('firefly.rule-actions'));
$actions = [];
foreach ($keys as $key) {
$actions[$key] = (string)trans('firefly.rule_action_'.$key.'_choice');
$actions[$key] = (string)trans('firefly.rule_action_' . $key . '_choice');
}
try {
$view = view('rules.partials.action', compact('actions', 'count'))->render();
@@ -65,7 +65,7 @@ class RuleController extends Controller
/**
* Render HTML for rule trigger.
*
* @param Request $request
* @param Request $request
*
* @return JsonResponse
* @throws FireflyException