mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
chore: reformat code.
This commit is contained in:
@@ -58,7 +58,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
* Create a new job instance.
|
||||
*
|
||||
*
|
||||
* @param Carbon|null $date
|
||||
* @param Carbon|null $date
|
||||
*/
|
||||
public function __construct(?Carbon $date)
|
||||
{
|
||||
@@ -93,17 +93,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Carbon $date
|
||||
*/
|
||||
public function setDate(Carbon $date): void
|
||||
{
|
||||
$newDate = clone $date;
|
||||
$newDate->startOfDay();
|
||||
$this->date = $newDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionCurrency $currency
|
||||
* @param TransactionCurrency $currency
|
||||
* @return void
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
@@ -134,8 +124,21 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
$this->saveRates($currency, $date, $json['rates']);
|
||||
}
|
||||
|
||||
private function saveRates(TransactionCurrency $currency, Carbon $date, array $rates): void
|
||||
{
|
||||
foreach ($rates as $code => $rate) {
|
||||
$to = $this->getCurrency($code);
|
||||
if (null === $to) {
|
||||
Log::debug(sprintf('Currency %s is not in use, do not save rate.', $code));
|
||||
continue;
|
||||
}
|
||||
Log::debug(sprintf('Currency %s is in use.', $code));
|
||||
$this->saveRate($currency, $to, $date, $rate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @param string $code
|
||||
* @return TransactionCurrency|null
|
||||
*/
|
||||
private function getCurrency(string $code): ?TransactionCurrency
|
||||
@@ -175,16 +178,13 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
}
|
||||
}
|
||||
|
||||
private function saveRates(TransactionCurrency $currency, Carbon $date, array $rates): void
|
||||
/**
|
||||
* @param Carbon $date
|
||||
*/
|
||||
public function setDate(Carbon $date): void
|
||||
{
|
||||
foreach ($rates as $code => $rate) {
|
||||
$to = $this->getCurrency($code);
|
||||
if (null === $to) {
|
||||
Log::debug(sprintf('Currency %s is not in use, do not save rate.', $code));
|
||||
continue;
|
||||
}
|
||||
Log::debug(sprintf('Currency %s is in use.', $code));
|
||||
$this->saveRate($currency, $to, $date, $rate);
|
||||
}
|
||||
$newDate = clone $date;
|
||||
$newDate->startOfDay();
|
||||
$this->date = $newDate;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user