function __construct($sw, $ne) { if (!($sw instanceof LatLng && $ne instanceof LatLng)) { $msg = 'The parameters to a Bounds class object must be LatLng. '; $msg .= 'The first parameter is a ' . get_class($sw) . '. The second '; $msg .= 'is a ' . get_class($ne) . '.'; Geocoder::logger('error', $msg); return null; } $this->sw = $sw; $this->ne = $ne; }
protected function do_geocode($address) { foreach ($this->geocoders->provider_order as $provider) { $msg = "MultiGeocoder using " . $provider; Geocoder::logger('debug', $msg); switch ($provider) { case 'google': $geocoder = new GoogleGeocoder(); break; case 'yahoo': $geocoder = new YahooGeocoder(); break; case 'us': $geocoder = new UsGeocoder(); break; case 'ca': $geocoder = new CaGeocoder(); break; default: $msg = '"' . $provider . '" is an invalid Geocode provider.'; Geocoder::logger('error', $msg); $geoloc = new GeoLoc(); $geoloc->success = false; $geoloc->street_address = $msg; return $geoloc; } $result = $geocoder->geocode($address); # This statement is for use by multi_geocoder_test only if (isset($this->geocoders->force_failure)) { foreach ($this->geocoders->force_failure as $prov) { if ($provider == $prov) { $result->success = false; } } } if ($result->success) { return $result; } } $address_str = $address instanceof GeoLoc ? $address->to_geocodeable_s() : $address; $msg = "Something has gone very wrong during the geocoding of this address: " . $address_str; Geocoder::logger('error', $msg); $geoloc = new GeoLoc(); $geoloc->success = false; $geoloc->street_address = $msg; return $geoloc; }