FIX: Circular dependency

This commit is contained in:
Juan Pablo Vial
2025-05-05 19:08:44 -04:00
parent 186cd0f5b8
commit 0e903f99c4
2 changed files with 7 additions and 9 deletions

View File

@ -15,7 +15,7 @@ use Incoviba\Service;
class SII implements Define\Money\Provider
{
public function __construct(protected ClientInterface $client, protected Service\Valor $valorService,
public function __construct(protected ClientInterface $client,
protected Repository\UF $ufRepository) {}
public function get(string $money_symbol, ?DateTimeInterface $dateTime = null): float
@ -85,7 +85,7 @@ class SII implements Define\Money\Provider
$m = str_pad($j + 1, 2, '0', STR_PAD_LEFT);
$d = str_pad($i + 1, 2, '0', STR_PAD_LEFT);
$date = "{$dateTime->format('Y')}-{$m}-{$d}";
$value = $this->valorService->clean($value);
$value = $this->clean($value);
$year[$date] = $value;
}
}
@ -130,4 +130,8 @@ class SII implements Define\Money\Provider
}
}
}
protected function clean(string $value): float
{
return trim(str_replace(',', '.', str_replace(['.', '$'], '', $value)));
}
}