Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 12:24:51 +01:00
parent bdcd9825ec
commit b27fe59ab4
44 changed files with 414 additions and 332 deletions

View File

@@ -212,7 +212,7 @@ class ApplyRules extends Command
$accountRepository = app(AccountRepositoryInterface::class);
$accountRepository->setUser($this->getUser());
foreach ($accountList as $accountId) {
$accountId = (int) $accountId;
$accountId = (int)$accountId;
$account = $accountRepository->find($accountId);
if (null !== $account && in_array($account->accountType->type, $this->acceptedAccounts, true)) {
$finalList->push($account);
@@ -242,7 +242,7 @@ class ApplyRules extends Command
$ruleGroupList = explode(',', $ruleGroupString);
foreach ($ruleGroupList as $ruleGroupId) {
$ruleGroup = $this->ruleGroupRepository->find((int) $ruleGroupId);
$ruleGroup = $this->ruleGroupRepository->find((int)$ruleGroupId);
if ($ruleGroup->active) {
$this->ruleGroupSelection[] = $ruleGroup->id;
}
@@ -267,7 +267,7 @@ class ApplyRules extends Command
$ruleList = explode(',', $ruleString);
foreach ($ruleList as $ruleId) {
$rule = $this->ruleRepository->find((int) $ruleId);
$rule = $this->ruleRepository->find((int)$ruleId);
if (null !== $rule && $rule->active) {
$this->ruleSelection[] = $rule->id;
}
@@ -343,8 +343,8 @@ class ApplyRules extends Command
}
/**
* @param Rule $rule
* @param RuleGroup $group
* @param Rule $rule
* @param RuleGroup $group
*
* @return bool
*/

View File

@@ -68,7 +68,7 @@ class Cron extends Command
} catch (InvalidArgumentException $e) {
$this->error(sprintf('"%s" is not a valid date', $this->option('date')));
}
$force = (bool) $this->option('force');
$force = (bool)$this->option('force');
/*
* Fire recurring transaction cron job.
@@ -122,8 +122,35 @@ class Cron extends Command
}
/**
* @param bool $force
* @param Carbon|null $date
* @param bool $force
* @param Carbon|null $date
* @throws FireflyException
*/
private function exchangeRatesCronJob(bool $force, ?Carbon $date): void
{
$exchangeRates = new ExchangeRatesCronjob();
$exchangeRates->setForce($force);
// set date in cron job:
if (null !== $date) {
$exchangeRates->setDate($date);
}
$exchangeRates->fire();
if ($exchangeRates->jobErrored) {
$this->error(sprintf('Error in "exchange rates" cron: %s', $exchangeRates->message));
}
if ($exchangeRates->jobFired) {
$this->line(sprintf('"Exchange rates" cron fired: %s', $exchangeRates->message));
}
if ($exchangeRates->jobSucceeded) {
$this->info(sprintf('"Exchange rates" cron ran with success: %s', $exchangeRates->message));
}
}
/**
* @param bool $force
* @param Carbon|null $date
*
* @throws FireflyException
*/
@@ -150,8 +177,8 @@ class Cron extends Command
}
/**
* @param bool $force
* @param Carbon|null $date
* @param bool $force
* @param Carbon|null $date
*
*/
private function autoBudgetCronJob(bool $force, ?Carbon $date): void
@@ -177,8 +204,8 @@ class Cron extends Command
}
/**
* @param bool $force
* @param Carbon|null $date
* @param bool $force
* @param Carbon|null $date
* @throws FireflyException
*/
private function billWarningCronJob(bool $force, ?Carbon $date): void
@@ -202,31 +229,4 @@ class Cron extends Command
$this->info(sprintf('"Send bill warnings" cron ran with success: %s', $autoBudget->message));
}
}
/**
* @param bool $force
* @param Carbon|null $date
* @throws FireflyException
*/
private function exchangeRatesCronJob(bool $force, ?Carbon $date): void
{
$exchangeRates = new ExchangeRatesCronjob();
$exchangeRates->setForce($force);
// set date in cron job:
if (null !== $date) {
$exchangeRates->setDate($date);
}
$exchangeRates->fire();
if ($exchangeRates->jobErrored) {
$this->error(sprintf('Error in "exchange rates" cron: %s', $exchangeRates->message));
}
if ($exchangeRates->jobFired) {
$this->line(sprintf('"Exchange rates" cron fired: %s', $exchangeRates->message));
}
if ($exchangeRates->jobSucceeded) {
$this->info(sprintf('"Exchange rates" cron ran with success: %s', $exchangeRates->message));
}
}
}