From ecf8316f5be7d830446c1a4ca2a32486a89610e0 Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Fri, 17 Apr 2020 09:34:40 +0200 Subject: [PATCH] remove JsonvatClient as jsonvat.com is discontinued, see https://github.com/adamcooke/vat-rates/commit/c4f696561b3e6a868af2c6a309afb5b2b0f4529d --- README.md | 2 +- src/Clients/JsonVatClient.php | 54 ----------------------------------- 2 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 src/Clients/JsonVatClient.php diff --git a/README.md b/README.md index dda3f47..7cd35a2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ibericode/vat This is a simple PHP library to help you deal with Europe's VAT rules. -- Fetch VAT rates for any EU member state using [ibericode/vat-rates](https://github.com/ibericode/vat-rates) or [jsonvat.com](https://jsonvat.com/) +- Fetch VAT rates for any EU member state using [ibericode/vat-rates](https://github.com/ibericode/vat-rates). - Validate VAT numbers (by format and/or [existence](http://ec.europa.eu/taxation_customs/vies/)) - Validate ISO-3316 alpha-2 country codes - Determine whether a country is part of the EU diff --git a/src/Clients/JsonVatClient.php b/src/Clients/JsonVatClient.php deleted file mode 100644 index 8d503ff..0000000 --- a/src/Clients/JsonVatClient.php +++ /dev/null @@ -1,54 +0,0 @@ -= 400) { - throw new ClientException("Error fetching rates from {$url}."); - } - - return $this->parseResponse($body); - } - - private function parseResponse(string $response_body) : array - { - $data = json_decode($response_body, false); - - $return = []; - foreach ($data->rates as $country_rates) { - $periods = []; - - foreach ($country_rates->periods as $period) { - $periods[] = new Period(new \DateTimeImmutable($period->effective_from), (array) $period->rates); - } - - $return[$country_rates->country_code] = $periods; - } - - return $return; - } -}