public function buildOffice(AddressInfo $address_info) { $office = new OfficeDraft(); list($address1, $address2) = $address_info->getAddress(); $office->setAddress($address1); $office->setAddress1($address2); $office->setZipCode($address_info->getZipCode()); $office->setCity($address_info->getCity()); $office->setState($address_info->getState()); $office->setCountry($address_info->getCountry()); return $office; }
/** * given an address info * return GPS coordinates array($lat,$lng) * @param AddressInfo $address_info * @throws EntityValidationException * @return array */ public function getAddressCoordinates(AddressInfo $address_info) { list($address1, $address2) = $address_info->getAddress(); $address = $address1 . ' ' . $address2; $city = $address_info->getCity(); $state = $address_info->getState(); if (!empty($city)) { $address .= ", {$city}"; } if (!empty($state)) { $address .= ", {$state}"; } $zip_code = $address_info->getZipCode(); $country = $address_info->getCountry(); return $this->doGeoQuery($city, $country, $state, $address, $zip_code); }