diff --git a/src/Rates.php b/src/Rates.php index 8963bce..a98a10b 100644 --- a/src/Rates.php +++ b/src/Rates.php @@ -4,7 +4,6 @@ namespace Ibericode\Vat; -use DateTime; use DateTimeInterface; use DateTimeImmutable; use Ibericode\Vat\Clients\ClientException; @@ -46,13 +45,13 @@ public function __construct(string $storagePath, int $refreshInterval = 12 * 360 $this->client = $client; } - private function load() + private function load(): void { if (count($this->rates) > 0) { return; } - if ($this->storagePath !== '' && file_exists($this->storagePath)) { + if ($this->storagePath !== '' && \is_file($this->storagePath)) { $this->loadFromFile(); // bail early if file is still valid @@ -65,7 +64,7 @@ private function load() $this->loadFromRemote(); } - private function loadFromFile() + private function loadFromFile(): void { $contents = file_get_contents($this->storagePath); $data = unserialize($contents, [ @@ -82,7 +81,7 @@ private function loadFromFile() $this->rates = $data; } - private function loadFromRemote() + private function loadFromRemote(): void { try { $this->client = $this->client ?: new IbericodeVatRatesClient();