Various code cleanup and fixed alignments.

This commit is contained in:
James Cole
2024-01-01 14:43:56 +01:00
parent 1368aafe5f
commit f963ac63f1
443 changed files with 3668 additions and 3672 deletions

View File

@@ -54,7 +54,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
if (null === $route) {
return parent::render($request, $e);
}
$name = $route->getName();
$name = $route->getName();
if (!auth()->check()) {
return parent::render($request, $e);
}
@@ -160,7 +160,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
/** @var null|Account $account */
$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
if (null === $account) {
app('log')->error(sprintf('Could not find account %d, so give big fat error.', $accountId));
@@ -189,7 +189,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$groupId = !is_object($param) ? (int)$param : 0;
/** @var null|TransactionGroup $group */
$group = $user->transactionGroups()->withTrashed()->find($groupId);
$group = $user->transactionGroups()->withTrashed()->find($groupId);
if (null === $group) {
app('log')->error(sprintf('Could not find group %d, so give big fat error.', $groupId));
@@ -203,7 +203,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
return parent::render($request, $exception);
}
$type = $journal->transactionType->type;
$type = $journal->transactionType->type;
$request->session()->reflash();
if (TransactionType::RECONCILIATION === $type) {
@@ -229,7 +229,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$attachmentId = is_object($param) ? 0 : (int)$param;
/** @var null|Attachment $attachment */
$attachment = $user->attachments()->withTrashed()->find($attachmentId);
$attachment = $user->attachments()->withTrashed()->find($attachmentId);
if (null === $attachment) {
app('log')->error(sprintf('Could not find attachment %d, so give big fat error.', $attachmentId));

View File

@@ -128,7 +128,7 @@ class Handler extends ExceptionHandler
$errorCode = 500;
$errorCode = $e instanceof MethodNotAllowedHttpException ? 405 : $errorCode;
$isDebug = (bool) config('app.debug', false);
$isDebug = (bool) config('app.debug', false);
if ($isDebug) {
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
@@ -191,7 +191,7 @@ class Handler extends ExceptionHandler
return;
}
$userData = [
$userData = [
'id' => 0,
'email' => 'unknown@example.com',
];
@@ -200,9 +200,9 @@ class Handler extends ExceptionHandler
$userData['email'] = auth()->user()->email;
}
$headers = request()->headers->all();
$headers = request()->headers->all();
$data = [
$data = [
'class' => get_class($e),
'errorMessage' => $e->getMessage(),
'time' => date('r'),
@@ -219,8 +219,8 @@ class Handler extends ExceptionHandler
];
// create job that will mail.
$ipAddress = request()->ip() ?? '0.0.0.0';
$job = new MailError($userData, (string) config('firefly.site_owner'), $ipAddress, $data);
$ipAddress = request()->ip() ?? '0.0.0.0';
$job = new MailError($userData, (string) config('firefly.site_owner'), $ipAddress, $data);
dispatch($job);
parent::report($e);

View File

@@ -50,7 +50,7 @@ final class IntervalException extends \Exception
int $code = 0,
?\Throwable $previous = null
): self {
$message = sprintf(
$message = sprintf(
'The periodicity %s is unknown. Choose one of available periodicity: %s',
$periodicity->name,
implode(', ', $intervals)