Skip to content

Commit 7e5bde9

Browse files
author
Martin Brecht-Precht
committed
Updated dependencies.
1 parent 34b44d7 commit 7e5bde9

File tree

8 files changed

+35
-30
lines changed

8 files changed

+35
-30
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
},
2424
"require": {
2525
"php": ">=5.3",
26-
"markenwerk/common-exceptions": "*",
27-
"markenwerk/google-datastructures": "*"
26+
"markenwerk/common-exceptions": "~2.0",
27+
"markenwerk/google-datastructures": "~1.0"
2828
},
2929
"require-dev":{
3030
"phpunit/phpunit": "~4.8",

src/AddressLookup.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ class AddressLookup extends Base\BaseLookup
1515
/**
1616
* @param string $address
1717
* @return $this
18-
* @throws CommonException\ApiException\ApiException
19-
* @throws CommonException\ApiException\ApiLimitException
20-
* @throws CommonException\ApiException\ApiNoResultsException
21-
* @throws CommonException\ApiException\NetworkException
18+
* @throws CommonException\ApiException\AuthenticationException
19+
* @throws CommonException\ApiException\InvalidResponseException
20+
* @throws CommonException\ApiException\NoResultException
21+
* @throws CommonException\ApiException\RequestQuotaException
22+
* @throws CommonException\NetworkException\CurlException
2223
*/
2324
public function lookup($address)
2425
{

src/Base/BaseLookup.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ public function getFirstResult()
7272
*
7373
* @param string
7474
* @return string
75-
* @throws CommonException\ApiException\ApiException
76-
* @throws CommonException\ApiException\ApiLimitException
77-
* @throws CommonException\ApiException\ApiNoResultsException
78-
* @throws CommonException\ApiException\NetworkException
75+
* @throws CommonException\ApiException\AuthenticationException
76+
* @throws CommonException\ApiException\InvalidResponseException
77+
* @throws CommonException\ApiException\NoResultException
78+
* @throws CommonException\ApiException\RequestQuotaException
79+
* @throws CommonException\NetworkException\CurlException
7980
*/
8081
protected function request($url)
8182
{
@@ -85,7 +86,7 @@ protected function request($url)
8586
$response = curl_exec($curl);
8687
curl_close($curl);
8788
if (!$response) {
88-
throw new CommonException\ApiException\NetworkException('Curling the API endpoint ' . $url . ' failed.');
89+
throw new CommonException\NetworkException\CurlException('Curling the API endpoint ' . $url . ' failed.');
8990
}
9091
$responseData = @json_decode($response, true);
9192
$this->validateResponse($response, $responseData);
@@ -95,26 +96,27 @@ protected function request($url)
9596
/**
9697
* @param string $rawResponse
9798
* @param array|string $responseData
98-
* @throws CommonException\ApiException\ApiException
99-
* @throws CommonException\ApiException\ApiLimitException
100-
* @throws CommonException\ApiException\ApiNoResultsException
99+
* @throws CommonException\ApiException\AuthenticationException
100+
* @throws CommonException\ApiException\InvalidResponseException
101+
* @throws CommonException\ApiException\NoResultException
102+
* @throws CommonException\ApiException\RequestQuotaException
101103
*/
102104
private function validateResponse($rawResponse, $responseData)
103105
{
104106
if (is_null($responseData) || !is_array($responseData) || !isset($responseData['status'])) {
105-
throw new CommonException\ApiException\ApiException('Parsing the API response from body failed: ' . $rawResponse);
107+
throw new CommonException\ApiException\InvalidResponseException('Parsing the API response from body failed: ' . $rawResponse);
106108
}
107109

108110
$responseStatus = mb_strtoupper($responseData['status']);
109111
if ($responseStatus == 'OVER_QUERY_LIMIT') {
110112
$exceptionMessage = $this->buildExceptionMessage('Google Geocoder request limit reached', $responseData);
111-
throw new CommonException\ApiException\ApiLimitException($exceptionMessage);
113+
throw new CommonException\ApiException\RequestQuotaException($exceptionMessage);
112114
} else if ($responseStatus == 'REQUEST_DENIED') {
113115
$exceptionMessage = $this->buildExceptionMessage('Google Geocoder request was denied', $responseData);
114-
throw new CommonException\ApiException\ApiException($exceptionMessage);
116+
throw new CommonException\ApiException\AuthenticationException($exceptionMessage);
115117
} else if ($responseStatus != 'OK') {
116118
$exceptionMessage = $this->buildExceptionMessage('Google Geocoder no results', $responseData);
117-
throw new CommonException\ApiException\ApiNoResultsException($exceptionMessage);
119+
throw new CommonException\ApiException\NoResultException($exceptionMessage);
118120
}
119121
}
120122

src/GeoLocationLookup.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ class GeoLocationLookup extends Base\BaseLookup
1616
* @param float $latitude
1717
* @param float $longitude
1818
* @return $this
19-
* @throws CommonException\ApiException\ApiException
20-
* @throws CommonException\ApiException\ApiLimitException
21-
* @throws CommonException\ApiException\ApiNoResultsException
22-
* @throws CommonException\ApiException\NetworkException
19+
* @throws CommonException\ApiException\AuthenticationException
20+
* @throws CommonException\ApiException\InvalidResponseException
21+
* @throws CommonException\ApiException\NoResultException
22+
* @throws CommonException\ApiException\RequestQuotaException
23+
* @throws CommonException\NetworkException\CurlException
2324
*/
2425
public function lookup($latitude, $longitude)
2526
{

src/GooglePlacesLookup.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ class GooglePlacesLookup extends Base\BaseApiKeyGatedLookup
1515
/**
1616
* @param string $googlePlacesId
1717
* @return $this
18-
* @throws CommonException\ApiException\ApiException
19-
* @throws CommonException\ApiException\ApiLimitException
20-
* @throws CommonException\ApiException\ApiNoResultsException
21-
* @throws CommonException\ApiException\NetworkException
18+
* @throws CommonException\ApiException\AuthenticationException
19+
* @throws CommonException\ApiException\InvalidResponseException
20+
* @throws CommonException\ApiException\NoResultException
21+
* @throws CommonException\ApiException\RequestQuotaException
22+
* @throws CommonException\NetworkException\CurlException
2223
*/
2324
public function lookup($googlePlacesId)
2425
{

test/AddressLookupTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testLookupSuccess()
7474

7575
public function testLookupFailure()
7676
{
77-
$this->setExpectedException(get_class(new CommonException\ApiException\ApiNoResultsException()));
77+
$this->setExpectedException(get_class(new CommonException\ApiException\NoResultException()));
7878
$addressLookup = new AddressLookup();
7979
$addressLookup->lookup('China, Bejing, Lornsenstraße 43');
8080
}

test/GeoLocationLookupTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testLookupSuccess()
7474

7575
public function testLookupFailure()
7676
{
77-
$this->setExpectedException(get_class(new CommonException\ApiException\ApiNoResultsException()));
77+
$this->setExpectedException(get_class(new CommonException\ApiException\NoResultException()));
7878
$geoLocationLookup = new GeoLocationLookup();
7979
$geoLocationLookup->lookup(1000000, 1000000);
8080
}

test/GooglePlacesLookupTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testLookupSuccess()
9191

9292
public function testLookupNoResults()
9393
{
94-
$this->setExpectedException(get_class(new CommonException\ApiException\ApiNoResultsException()));
94+
$this->setExpectedException(get_class(new CommonException\ApiException\NoResultException()));
9595
$googlePlacesLookup = new GooglePlacesLookup();
9696
$googlePlacesLookup
9797
->setApiKey($this->googlePlacesApiKey)
@@ -100,7 +100,7 @@ public function testLookupNoResults()
100100

101101
public function testLookupApiKey()
102102
{
103-
$this->setExpectedException(get_class(new CommonException\ApiException\ApiException()));
103+
$this->setExpectedException(get_class(new CommonException\ApiException\AuthenticationException()));
104104
$googlePlacesLookup = new GooglePlacesLookup();
105105
$googlePlacesLookup
106106
->setApiKey('INVALID_API_KEY')

0 commit comments

Comments
 (0)