Skip to content

Commit 3a2a3a6

Browse files
authored
Expect a PSR-18 client instead of a PHP-HTTP client (#1110)
* Expect a PSR-18 client instead of a PHP-HTTP client * Update integration tests
1 parent 20d89a7 commit 3a2a3a6

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
99

1010
This is the Yandex provider from the PHP Geocoder. This is a **READ ONLY** repository. See the
11-
[main repo](https://github.com/geocoder-php/Geocoder) for information and documentation.
11+
[main repo](https://github.com/geocoder-php/Geocoder) for information and documentation.
1212

1313
### Install
1414

@@ -21,7 +21,7 @@ composer require geocoder-php/yandex-provider
2121
The API now requires an API key. [See here for more information](https://yandex.ru/blog/mapsapi/novye-pravila-dostupa-k-api-kart?from=tech_pp).
2222

2323
```php
24-
$httpClient = new \Http\Adapter\Guzzle6\Client();
24+
$httpClient = new \GuzzleHttp\Client();
2525
$provider = new \Geocoder\Provider\Yandex\Yandex($httpClient, null, '<your-api-key>);
2626

2727
$result = $geocoder->geocodeQuery(GeocodeQuery::create('ул.Ленина, 19, Минск 220030, Республика Беларусь'));
@@ -31,12 +31,12 @@ $result = $geocoder->reverseQuery(ReverseQuery::fromCoordinates(...));
3131
### Note
3232

3333
The default language-locale is `ru-RU`, you can choose between `uk-UA`, `be-BY`,
34-
`en-US`, `en-BR` and `tr-TR`.
34+
`en-US`, `en-BR` and `tr-TR`.
3535

3636
It's possible to precise the toponym to get more accurate result for reverse geocoding:
3737
`house`, `street`, `metro`, `district` and `locality`.
3838

3939
### Contribute
4040

41-
Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or
41+
Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or
4242
report any issues you find on the [issue tracker](https://github.com/geocoder-php/Geocoder/issues).

Tests/IntegrationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use Geocoder\IntegrationTest\ProviderIntegrationTest;
1616
use Geocoder\Provider\Yandex\Yandex;
17-
use Http\Client\HttpClient;
17+
use Psr\Http\Client\ClientInterface;
1818

1919
/**
2020
* @author Tobias Nyholm <[email protected]>
@@ -34,7 +34,7 @@ class IntegrationTest extends ProviderIntegrationTest
3434

3535
protected $testIpv6 = false;
3636

37-
protected function createProvider(HttpClient $httpClient)
37+
protected function createProvider(ClientInterface $httpClient)
3838
{
3939
return new Yandex($httpClient);
4040
}

Yandex.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Geocoder\Provider\Yandex\Model\YandexAddress;
2222
use Geocoder\Query\GeocodeQuery;
2323
use Geocoder\Query\ReverseQuery;
24-
use Http\Client\HttpClient;
24+
use Psr\Http\Client\ClientInterface;
2525

2626
/**
2727
* @author Antoine Corcy <[email protected]>
@@ -49,11 +49,11 @@ final class Yandex extends AbstractHttpProvider implements Provider
4949
private $apiKey;
5050

5151
/**
52-
* @param HttpClient $client an HTTP adapter
53-
* @param string $toponym toponym biasing only for reverse geocoding (optional)
54-
* @param string|null $apiKey API Key
52+
* @param ClientInterface $client an HTTP adapter
53+
* @param string $toponym toponym biasing only for reverse geocoding (optional)
54+
* @param string|null $apiKey API Key
5555
*/
56-
public function __construct(HttpClient $client, string $toponym = null, string $apiKey = null)
56+
public function __construct(ClientInterface $client, string $toponym = null, string $apiKey = null)
5757
{
5858
parent::__construct($client);
5959

0 commit comments

Comments
 (0)