mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-17 20:08:52 +00:00
Fix code quality with rector [skip ci]
This commit is contained in:
@@ -53,7 +53,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
$end = $availableBudget->end_date->format('Y-m-d');
|
||||
$key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end);
|
||||
if (array_key_exists($key, $exists)) {
|
||||
app('log')->debug(sprintf('Found duplicate AB: %s %s, %s-%s. Has been deleted', $availableBudget->transaction_currency_id, $availableBudget->amount, $start, $end));
|
||||
Log::debug(sprintf('Found duplicate AB: %s %s, %s-%s. Has been deleted', $availableBudget->transaction_currency_id, $availableBudget->amount, $start, $end));
|
||||
$availableBudget->delete();
|
||||
}
|
||||
$exists[$key] = true;
|
||||
|
||||
@@ -130,7 +130,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup
|
||||
public function getAllBudgetLimitsByCurrency(TransactionCurrency $currency, ?Carbon $start = null, ?Carbon $end = null): Collection
|
||||
{
|
||||
return $this->getAllBudgetLimits($start, $end)->filter(
|
||||
static fn (BudgetLimit $budgetLimit) => $budgetLimit->transaction_currency_id === $currency->id
|
||||
static fn (BudgetLimit $budgetLimit): bool => $budgetLimit->transaction_currency_id === $currency->id
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
$autoBudget = $this->getAutoBudget($budget);
|
||||
|
||||
// first things first: delete when no longer required:
|
||||
$autoBudgetType = array_key_exists('auto_budget_type', $data) ? $data['auto_budget_type'] : null;
|
||||
$autoBudgetType = $data['auto_budget_type'] ?? null;
|
||||
|
||||
if (0 === $autoBudgetType && $autoBudget instanceof AutoBudget) {
|
||||
// delete!
|
||||
@@ -534,7 +534,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
return $set->each(
|
||||
static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line
|
||||
static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line
|
||||
$notes = $attachment->notes()->first();
|
||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||
$attachment->notes_text = null !== $notes ? $notes->text : '';
|
||||
|
||||
@@ -54,7 +54,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
*/
|
||||
public function budgetedPerDay(Budget $budget): string
|
||||
{
|
||||
app('log')->debug(sprintf('Now with budget #%d "%s"', $budget->id, $budget->name));
|
||||
Log::debug(sprintf('Now with budget #%d "%s"', $budget->id, $budget->name));
|
||||
$total = '0';
|
||||
$count = 0;
|
||||
foreach ($budget->budgetlimits as $limit) {
|
||||
@@ -64,13 +64,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
$perDay = bcdiv((string) $amount, (string) $diff);
|
||||
$total = bcadd($total, $perDay);
|
||||
++$count;
|
||||
app('log')->debug(sprintf('Found %d budget limits. Per day is %s, total is %s', $count, $perDay, $total));
|
||||
Log::debug(sprintf('Found %d budget limits. Per day is %s, total is %s', $count, $perDay, $total));
|
||||
}
|
||||
$avg = $total;
|
||||
if ($count > 0) {
|
||||
$avg = bcdiv($total, (string) $count);
|
||||
}
|
||||
app('log')->debug(sprintf('%s / %d = %s = average.', $total, $count, $avg));
|
||||
Log::debug(sprintf('%s / %d = %s = average.', $total, $count, $avg));
|
||||
|
||||
return $avg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user