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