@@ -40,26 +40,26 @@ class GoogleMapsProvider extends AbstractProvider implements LocaleAwareProvider
40
40
* @var bool
41
41
*/
42
42
private $ useSsl = false ;
43
-
43
+
44
44
/**
45
45
* @var string
46
46
*/
47
- private $ key = null ;
47
+ private $ apiKey = null ;
48
48
49
49
/**
50
50
* @param HttpAdapterInterface $adapter An HTTP adapter.
51
51
* @param string $locale A locale (optional).
52
52
* @param string $region Region biasing (optional).
53
53
* @param bool $useSsl Whether to use an SSL connection (optional)
54
- * @param string $key Google Geocoding API key (optional)
54
+ * @param string $apiKey Google Geocoding API key (optional)
55
55
*/
56
- public function __construct (HttpAdapterInterface $ adapter , $ locale = null , $ region = null , $ useSsl = false , $ key = null )
56
+ public function __construct (HttpAdapterInterface $ adapter , $ locale = null , $ region = null , $ useSsl = false , $ apiKey = null )
57
57
{
58
58
parent ::__construct ($ adapter , $ locale );
59
59
60
60
$ this ->region = $ region ;
61
61
$ this ->useSsl = $ useSsl ;
62
- $ this ->key = $ key ;
62
+ $ this ->apiKey = $ apiKey ;
63
63
}
64
64
65
65
/**
@@ -111,9 +111,9 @@ protected function buildQuery($query)
111
111
if (null !== $ this ->getRegion ()) {
112
112
$ query = sprintf ('%s®ion=%s ' , $ query , $ this ->getRegion ());
113
113
}
114
-
115
- if (null !== $ this ->getKey () ) {
116
- $ query = sprintf ('%s&key=%s ' , $ query , $ this ->getKey () );
114
+
115
+ if (null !== $ this ->apiKey ) {
116
+ $ query = sprintf ('%s&key=%s ' , $ query , $ this ->apiKey );
117
117
}
118
118
119
119
return $ query ;
@@ -141,7 +141,7 @@ protected function executeQuery($query)
141
141
throw new NoResultException (sprintf ('Could not execute query %s ' , $ query ));
142
142
}
143
143
144
- if ('REQUEST_DENIED ' === $ json ->status && 'The provided API key is invalid. ' == $ json ->error_message ) {
144
+ if ('REQUEST_DENIED ' === $ json ->status && 'The provided API key is invalid. ' === $ json ->error_message ) {
145
145
throw new InvalidCredentialsException (sprintf ('API key is invalid %s ' , $ query ));
146
146
}
147
147
@@ -258,14 +258,4 @@ protected function getRegion()
258
258
{
259
259
return $ this ->region ;
260
260
}
261
-
262
- /**
263
- * Returns the configured key or null.
264
- *
265
- * @return string|null
266
- */
267
- protected function getKey ()
268
- {
269
- return $ this ->key ;
270
- }
271
261
}
0 commit comments