Grabar UF y capacidad de obtener hoy.
This commit is contained in:
@ -33,11 +33,12 @@ class Money
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public function getUF(DateTimeInterface $dateTime): float
|
||||
public function getUF(?DateTimeInterface $dateTime = null): float
|
||||
{
|
||||
try {
|
||||
return $this->getProvider('uf')->get(MiIndicador::UF, $dateTime);
|
||||
} catch (EmptyResponse) {
|
||||
} catch (EmptyResponse $exception) {
|
||||
$this->logger->debug($exception);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,12 @@ class MiIndicador implements Provider
|
||||
/**
|
||||
* @throws EmptyResponse
|
||||
*/
|
||||
public function get(string $money_symbol, DateTimeInterface $dateTime): float
|
||||
public function get(string $money_symbol, ?DateTimeInterface $dateTime = null): float
|
||||
{
|
||||
$request_uri = "{$money_symbol}";
|
||||
if ($dateTime !== null) {
|
||||
$request_uri = "{$money_symbol}/{$dateTime->format('d-m-Y')}";
|
||||
}
|
||||
try {
|
||||
$response = $this->client->get($request_uri);
|
||||
} catch (GuzzleException) {
|
||||
|
@ -76,7 +76,6 @@ class UF
|
||||
$uf = $this->get($date);
|
||||
return $input * (($from === 'uf') ? $uf : 1/$uf);
|
||||
}
|
||||
|
||||
protected array $redisUFs;
|
||||
public function getRedisUFs(): array
|
||||
{
|
||||
|
Reference in New Issue
Block a user