You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One suggestion to this would be to also allow the retrieval of responses from the providers, rather than just extracting the information in the executeQuery method.
Then a user would be able to extend a Provider object and instead of being forced to override the executeQuery method they could parse the response as desired with their own method.
For example:
$adapter = new \Http\Adapter\Guzzle6\Client();
$geocoder = new \Geocoder\Provider\GoogleMaps($adapter);
$geocoder->geocode(...);
$jsonResponse = $geocoder->getRepsonse(); //formatted address is available here
publicfunctiongeocode($address)
{
$query = $address;
//...return$this->parseData($this->executeQuery($query));
}
publicfunctiongetResponse()
{
return$this->response;
}
privatefunctionparseData($content)
{
//...return$this->resultResults($results);
}
protectedfunctionexecuteQuery($query)
{
$query = $this->buildQuery($query);
if (!$this->response = json_encode((string) $this->getAdapter()->get($query)->getBody())) {
thrownewNoResult(sprintf('Could not execute query "%s".', $query));
}
//... move parsing of data out of executeQueryreturn$this->response;
}
Activity
fyrye commentedon Feb 6, 2017
One suggestion to this would be to also allow the retrieval of responses from the providers, rather than just extracting the information in the
executeQuerymethod.Then a user would be able to extend a Provider object and instead of being forced to override the
executeQuerymethod they could parse the response as desired with their own method.For example:
Nyholm commentedon May 30, 2017
Closed by #655