@@ -40,26 +40,26 @@ class GoogleMapsProvider extends AbstractProvider implements LocaleAwareProvider
4040 * @var bool
4141 */
4242 private $ useSsl = false ;
43-
43+
4444 /**
4545 * @var string
4646 */
47- private $ key = null ;
47+ private $ apiKey = null ;
4848
4949 /**
5050 * @param HttpAdapterInterface $adapter An HTTP adapter.
5151 * @param string $locale A locale (optional).
5252 * @param string $region Region biasing (optional).
5353 * @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)
5555 */
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 )
5757 {
5858 parent ::__construct ($ adapter , $ locale );
5959
6060 $ this ->region = $ region ;
6161 $ this ->useSsl = $ useSsl ;
62- $ this ->key = $ key ;
62+ $ this ->apiKey = $ apiKey ;
6363 }
6464
6565 /**
@@ -111,9 +111,9 @@ protected function buildQuery($query)
111111 if (null !== $ this ->getRegion ()) {
112112 $ query = sprintf ('%s®ion=%s ' , $ query , $ this ->getRegion ());
113113 }
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 );
117117 }
118118
119119 return $ query ;
@@ -141,7 +141,7 @@ protected function executeQuery($query)
141141 throw new NoResultException (sprintf ('Could not execute query %s ' , $ query ));
142142 }
143143
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 ) {
145145 throw new InvalidCredentialsException (sprintf ('API key is invalid %s ' , $ query ));
146146 }
147147
@@ -258,14 +258,4 @@ protected function getRegion()
258258 {
259259 return $ this ->region ;
260260 }
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- }
271261}
0 commit comments