
 Chris Rigg-Milner - 2012-01-31 15:00:35
Hi,
I downloaded this class to have a quick play with it and noticed the following error.
In parseGeoDate() if the result->status is != 'OK' nothing gets returned from this function.
Can I suggest this as a fix:
private function parseGeoData()
{
   $data = file_get_contents($this->url);
   $result = json_decode($data);
	
   $resultFromGl = array();
   if($result->status == "OK")
   {
      if($result->results[0]->geometry->location)
      {
         $addressFromGoogle = $result->results[0]->formatted_address;
	$lat = $result->results[0]->geometry->location->lat;
	$lng = $result->results[0]->geometry->location->lng;
	$resultFromGl['status'] = $result->status;
	$resultFromGl['address'] = $addressFromGoogle;
	$resultFromGl['lat'] = $lat;
	$resultFromGl['lng'] = $lng;
      }
      else
      {
	$resultFromGl['status'] = "Address not found";
      }
   }
   else
   {
      $resultFromGl['status'] = "Address not found";
   }
   return $resultFromGl;
}