Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Sep 14, 2014
1 parent e09133f commit f72ba69
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Geocoder/HttpAdapter/CurlHttpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getContent($url)
if ($this->connectTimeout) {
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}

if ($this->userAgent) {
curl_setopt($c, CURLOPT_USERAGENT, $this->userAgent);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Geocoder/Provider/GeoIP2Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public function getGeocodedData($address)
$regionCode = null;
if (isset($result->subdivisions) && is_array($result->subdivisions) && !empty($result->subdivisions)) {
$lastSubdivision = array_pop($result->subdivisions);

$region = (isset($lastSubdivision->names->{$this->locale}) ? $lastSubdivision->names->{$this->locale} : null);
$regionCode = (isset($lastSubdivision->iso_code) ? $lastSubdivision->iso_code : null);
$regionCode = (isset($lastSubdivision->iso_code) ? $lastSubdivision->iso_code : null);
}

return array($this->fixEncoding(array_merge($this->getDefaults(), array(
Expand Down
8 changes: 4 additions & 4 deletions src/Geocoder/Provider/OpenCageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class OpenCageProvider extends AbstractProvider implements ProviderInterface
private $apiKey = null;

/**
* @param HttpAdapterInterface $adapter An HTTP adapter.
* @param string $apiKey An API key.
* @param bool $useSsl Whether to use an SSL connection (optional).
* @param string|null $locale A locale (optional).
* @param HttpAdapterInterface $adapter An HTTP adapter.
* @param string $apiKey An API key.
* @param bool $useSsl Whether to use an SSL connection (optional).
* @param string|null $locale A locale (optional).
*/
public function __construct(HttpAdapterInterface $adapter, $apiKey, $useSsl = false, $locale = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Geocoder/Result/AbstractResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function formatString($str)
// matches an upper case letter character immediately preceded by a numeral
mb_ereg_search_init($str, '[0-9]\p{Lu}');

while($match = mb_ereg_search_pos()) {
while ($match = mb_ereg_search_pos()) {
$charPos = $match[0] + 1;
// Only swap it back to lowercase if it was lowercase to begin with
if (mb_ereg_match('\p{Ll}', $originalStr[$charPos])) {
Expand Down
3 changes: 0 additions & 3 deletions tests/Geocoder/Tests/Provider/OpenCageProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function testGetGeocodedData()
$provider->getGeocodedData('foobar');
}


/**
* @expectedException Geocoder\Exception\NoResultException
* @expectedExceptionMessage Could not find results for given query: https://api.opencagedata.com/geocode/v1/json?key=api_key&query=foobar&limit=5
Expand All @@ -37,7 +36,6 @@ public function testSslSchema()
$provider->getGeocodedData('foobar');
}


/**
* @expectedException \Geocoder\Exception\NoResultException
* @expectedExceptionMessage Could not execute query: http://api.opencagedata.com/geocode/v1/json?key=api_key&query=10+avenue+Gambetta%2C+Paris%2C+France&limit=5
Expand Down Expand Up @@ -194,7 +192,6 @@ public function testGetGeocodedDataWithCityDistrict()
$this->assertNull($result['regionCode']);
}


public function testGetGeocodedDataWithLocale()
{
if (!isset($_SERVER['OPENCAGE_API_KEY'])) {
Expand Down

0 comments on commit f72ba69

Please sign in to comment.