diff --git a/src/Provider/CentralBankOfRepublicTurkeyProvider.php b/src/Provider/CentralBankOfRepublicTurkeyProvider.php index 92e3fa7..e1fc018 100644 --- a/src/Provider/CentralBankOfRepublicTurkeyProvider.php +++ b/src/Provider/CentralBankOfRepublicTurkeyProvider.php @@ -20,7 +20,7 @@ /** * Central Bank of Republic of Turkey (CBRT) provider. * - * @link http://tcmb.gov.tr + * @see http://tcmb.gov.tr * * @author Uğur Erkan */ diff --git a/src/Provider/GoogleFinanceProvider.php b/src/Provider/GoogleFinanceProvider.php index cd4a778..820d682 100644 --- a/src/Provider/GoogleFinanceProvider.php +++ b/src/Provider/GoogleFinanceProvider.php @@ -22,7 +22,7 @@ */ class GoogleFinanceProvider extends AbstractProvider { - const URL = 'http://www.google.com/finance/converter?a=1&from=%s&to=%s'; + const URL = 'https://finance.google.com/finance/converter?a=1&from=%s&to=%s'; /** * {@inheritdoc} diff --git a/src/Util/StringUtil.php b/src/Util/StringUtil.php index 06420a4..e50f9b3 100644 --- a/src/Util/StringUtil.php +++ b/src/Util/StringUtil.php @@ -71,6 +71,7 @@ public static function jsonToArray($string) if (JSON_ERROR_NONE !== json_last_error()) { $last = json_last_error(); + throw new \RuntimeException( 'Unable to parse JSON data: ' .(isset($jsonErrors[$last]) ? $jsonErrors[$last] : 'Unknown error') diff --git a/tests/Tests/Provider/CurrencyLayerProviderTest.php b/tests/Tests/Provider/CurrencyLayerProviderTest.php index a3240a1..03c309f 100644 --- a/tests/Tests/Provider/CurrencyLayerProviderTest.php +++ b/tests/Tests/Provider/CurrencyLayerProviderTest.php @@ -7,6 +7,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ + namespace Swap\Tests\Provider; use Swap\Model\CurrencyPair; diff --git a/tests/Tests/Provider/GoogleFinanceProviderTest.php b/tests/Tests/Provider/GoogleFinanceProviderTest.php index 6b50244..1658cb5 100644 --- a/tests/Tests/Provider/GoogleFinanceProviderTest.php +++ b/tests/Tests/Provider/GoogleFinanceProviderTest.php @@ -22,7 +22,7 @@ class GoogleFinanceProviderTest extends AbstractProviderTestCase */ public function it_throws_an_exception_when_rate_not_supported() { - $uri = 'http://www.google.com/finance/converter?a=1&from=EUR&to=XXL'; + $uri = 'https://finance.google.com/finance/converter?a=1&from=EUR&to=XXL'; $content = file_get_contents(__DIR__.'/../../Fixtures/Provider/GoogleFinance/unsupported.html'); $provider = new GoogleFinanceProvider($this->getHttpAdapterMock($uri, $content)); @@ -34,7 +34,7 @@ public function it_throws_an_exception_when_rate_not_supported() */ public function it_fetches_a_rate() { - $url = 'http://www.google.com/finance/converter?a=1&from=EUR&to=USD'; + $url = 'https://finance.google.com/finance/converter?a=1&from=EUR&to=USD'; $content = file_get_contents(__DIR__.'/../../Fixtures/Provider/GoogleFinance/success.html'); $provider = new GoogleFinanceProvider($this->getHttpAdapterMock($url, $content)); @@ -49,7 +49,7 @@ public function it_fetches_a_rate() */ public function it_has_no_php_errors() { - $url = 'http://www.google.com/finance/converter?a=1&from=EUR&to=USD'; + $url = 'https://finance.google.com/finance/converter?a=1&from=EUR&to=USD'; $content = file_get_contents(__DIR__.'/../../Fixtures/Provider/GoogleFinance/success.html'); $provider = new GoogleFinanceProvider($this->getHttpAdapterMock($url, $content));