mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-15 19:09:50 +00:00
Code cleanup
This commit is contained in:
@@ -126,7 +126,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
// find budget limit:
|
||||
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $start, $end);
|
||||
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_RESET === (int)$autoBudget->auto_budget_type) {
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_RESET === (int) $autoBudget->auto_budget_type) {
|
||||
// that's easy: create one.
|
||||
// do nothing else.
|
||||
$this->createBudgetLimit($autoBudget, $start, $end);
|
||||
@@ -135,14 +135,14 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ROLLOVER === (int)$autoBudget->auto_budget_type) {
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ROLLOVER === (int) $autoBudget->auto_budget_type) {
|
||||
// budget limit exists already,
|
||||
$this->createRollover($autoBudget);
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
return;
|
||||
}
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ADJUSTED === (int)$autoBudget->auto_budget_type) {
|
||||
if (null === $budgetLimit && AutoBudget::AUTO_BUDGET_ADJUSTED === (int) $autoBudget->auto_budget_type) {
|
||||
// budget limit exists already,
|
||||
$this->createAdjustedLimit($autoBudget);
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
@@ -441,7 +441,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
'identifier' => $index,
|
||||
'recurrence_id' => $recurrence->id,
|
||||
'order' => $index,
|
||||
'notes' => (string)trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]),
|
||||
'notes' => (string) trans('firefly.created_from_recurrence', ['id' => $recurrence->id, 'title' => $recurrence->title]),
|
||||
'tags' => $this->repository->getTags($transaction),
|
||||
'piggy_bank_id' => $this->repository->getPiggyBank($transaction),
|
||||
'piggy_bank_name' => null,
|
||||
|
||||
@@ -95,7 +95,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
private function downloadRates(TransactionCurrency $currency): void
|
||||
{
|
||||
app('log')->debug(sprintf('Now downloading new exchange rates for currency %s.', $currency->code));
|
||||
$base = sprintf('%s/%s/%s', (string)config('cer.url'), $this->date->year, $this->date->isoWeek);
|
||||
$base = sprintf('%s/%s/%s', (string) config('cer.url'), $this->date->year, $this->date->isoWeek);
|
||||
$client = new Client();
|
||||
$url = sprintf('%s/%s.json', $base, $currency->code);
|
||||
|
||||
@@ -112,7 +112,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
|
||||
return;
|
||||
}
|
||||
$body = (string)$res->getBody();
|
||||
$body = (string) $res->getBody();
|
||||
$json = json_decode($body, true);
|
||||
if (false === $json || null === $json) {
|
||||
app('log')->warning(sprintf('Trying to grab "%s" resulted in bad JSON.', $url));
|
||||
|
||||
@@ -63,7 +63,7 @@ class MailError extends Job implements ShouldQueue
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$email = (string)config('firefly.site_owner');
|
||||
$email = (string) config('firefly.site_owner');
|
||||
$args = $this->exception;
|
||||
$args['loggedIn'] = $this->userData['id'] > 0;
|
||||
$args['user'] = $this->userData;
|
||||
@@ -84,7 +84,7 @@ class MailError extends Job implements ShouldQueue
|
||||
$args,
|
||||
static function (Message $message) use ($email): void {
|
||||
if ('mail@example.com' !== $email) {
|
||||
$message->to($email, $email)->subject((string)trans('email.error_subject'));
|
||||
$message->to($email, $email)->subject((string) trans('email.error_subject'));
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -130,7 +130,7 @@ class MailError extends Job implements ShouldQueue
|
||||
}
|
||||
if (file_exists($file)) {
|
||||
Log::debug(sprintf('Read file in "%s"', $file));
|
||||
$limits = json_decode((string)file_get_contents($file), true);
|
||||
$limits = json_decode((string) file_get_contents($file), true);
|
||||
}
|
||||
// limit reached?
|
||||
foreach ($types as $type => $info) {
|
||||
|
||||
@@ -128,7 +128,7 @@ class WarnAboutBills implements ShouldQueue
|
||||
$today = clone $this->date;
|
||||
$carbon = clone $bill->{$field};
|
||||
|
||||
return (int)$today->diffInDays($carbon);
|
||||
return (int) $today->diffInDays($carbon);
|
||||
}
|
||||
|
||||
private function sendWarning(Bill $bill, string $field): void
|
||||
|
||||
Reference in New Issue
Block a user