mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-21 03:39:00 +00:00
chore: reformat code.
This commit is contained in:
@@ -48,8 +48,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Throwable $e
|
||||
* @param Request $request
|
||||
* @param Throwable $e
|
||||
*
|
||||
* @return Application|JsonResponse|\Illuminate\Http\Response|Redirector|RedirectResponse|Response
|
||||
* @throws Throwable
|
||||
@@ -135,8 +135,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
@@ -169,8 +169,47 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
*/
|
||||
private function handleGroup(Request $request, Throwable $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted group. Redirect to overview of group types.');
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
$groupId = (int)$route->parameter('transactionGroup');
|
||||
|
||||
/** @var TransactionGroup|null $group */
|
||||
$group = $user->transactionGroups()->withTrashed()->find($groupId);
|
||||
if (null === $group) {
|
||||
Log::error(sprintf('Could not find group %d, so give big fat error.', $groupId));
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
/** @var TransactionJournal|null $journal */
|
||||
$journal = $group->transactionJournals()->withTrashed()->first();
|
||||
if (null === $journal) {
|
||||
Log::error(sprintf('Could not find journal for group %d, so give big fat error.', $groupId));
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
$type = $journal->transactionType->type;
|
||||
$request->session()->reflash();
|
||||
|
||||
if (TransactionType::RECONCILIATION === $type) {
|
||||
return redirect(route('accounts.index', ['asset']));
|
||||
}
|
||||
|
||||
return redirect(route('transactions.index', [strtolower($type)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
@@ -211,43 +250,4 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Throwable $exception
|
||||
*
|
||||
* @return Response
|
||||
* @throws Throwable
|
||||
*/
|
||||
private function handleGroup(Request $request, Throwable $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted group. Redirect to overview of group types.');
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
$groupId = (int)$route->parameter('transactionGroup');
|
||||
|
||||
/** @var TransactionGroup|null $group */
|
||||
$group = $user->transactionGroups()->withTrashed()->find($groupId);
|
||||
if (null === $group) {
|
||||
Log::error(sprintf('Could not find group %d, so give big fat error.', $groupId));
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
/** @var TransactionJournal|null $journal */
|
||||
$journal = $group->transactionJournals()->withTrashed()->first();
|
||||
if (null === $journal) {
|
||||
Log::error(sprintf('Could not find journal for group %d, so give big fat error.', $groupId));
|
||||
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
$type = $journal->transactionType->type;
|
||||
$request->session()->reflash();
|
||||
|
||||
if (TransactionType::RECONCILIATION === $type) {
|
||||
return redirect(route('accounts.index', ['asset']));
|
||||
}
|
||||
|
||||
return redirect(route('transactions.index', [strtolower($type)]));
|
||||
}
|
||||
}
|
||||
|
@@ -72,8 +72,8 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Throwable $e
|
||||
* @param Request $request
|
||||
* @param Throwable $e
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Throwable
|
||||
@@ -176,7 +176,7 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param Throwable $e
|
||||
* @param Throwable $e
|
||||
*
|
||||
* @return void
|
||||
* @throws Throwable
|
||||
@@ -225,15 +225,32 @@ class Handler extends ExceptionHandler
|
||||
parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Throwable $e
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function shouldntReportLocal(Throwable $e): bool
|
||||
{
|
||||
return !is_null(
|
||||
Arr::first(
|
||||
$this->dontReport,
|
||||
function ($type) use ($e) {
|
||||
return $e instanceof $type;
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a validation exception into a response.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param LaravelValidationException $exception
|
||||
* @param Request $request
|
||||
* @param LaravelValidationException $exception
|
||||
*
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
*/
|
||||
protected function invalid($request, LaravelValidationException $exception): Application|RedirectResponse|Redirector
|
||||
protected function invalid($request, LaravelValidationException $exception): Application | RedirectResponse | Redirector
|
||||
{
|
||||
// protect against open redirect when submitting invalid forms.
|
||||
$previous = app('steam')->getSafePreviousUrl();
|
||||
@@ -247,7 +264,7 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* Only return the redirectTo property from the exception if it is a valid URL. Return NULL otherwise.
|
||||
*
|
||||
* @param LaravelValidationException $exception
|
||||
* @param LaravelValidationException $exception
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
@@ -263,21 +280,4 @@ class Handler extends ExceptionHandler
|
||||
|
||||
return null !== $previousHost && $previousHost === $safeHost ? $previous : $safe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Throwable $e
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function shouldntReportLocal(Throwable $e): bool
|
||||
{
|
||||
return !is_null(
|
||||
Arr::first(
|
||||
$this->dontReport,
|
||||
function ($type) use ($e) {
|
||||
return $e instanceof $type;
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user