src/Dlin/Geocoder/Geocoding/BingGeocoding.php
private function _parseComponent($components)
    {

        $address = new GeoAddress();
        $address->geoCoding = $this->name;
        if(array_key_exists('address', $components)){
            $addressData = $components['address'];

            $address->addressLine1 = array_key_exists('addressLine', $addressData) ? $addressData['addressLine']: "";
            $address->state = array_key_exists('adminDistrict', $addressData) ? $addressData['adminDistrict']: "";
            $address->country = array_key_exists('countryRegion', $addressData) ? $addressData['countryRegion']: "";

            if(array_key_exists('formattedAddress', $addressData)){
                $address->formattedAddress = $addressData['formattedAddress'].', '.$address->country;
            }

            $address->suburb = array_key_exists('locality', $addressData) ? $addressData['locality']: "";
            $address->postcode = array_key_exists('postalCode', $addressData) ? $addressData['postalCode']: "";
        }
        if(array_key_exists('confidence', $components)){
            $address->partial = $components['confidence'] != 'High';
        }
        if(array_key_exists('point', $components)){
            $address->latitude = strval($components['point']['coordinates'][0]);
            $address->longitude = strval($components['point']['coordinates'][1]);
        }
        return $address;
    }
private function _parseComponent($components)
    {

        $address = new GeoAddress();
        $address->geoCoding = $this->name;
        if(array_key_exists('address', $components)){
            $addressData = $components['address'];

            $address->addressLine1 = array_key_exists('addressLine', $addressData) ? $addressData['addressLine']: "";
            $address->state = array_key_exists('adminDistrict', $addressData) ? $addressData['adminDistrict']: "";
            $address->country = array_key_exists('countryRegion', $addressData) ? $addressData['countryRegion']: "";

            if(array_key_exists('formattedAddress', $addressData)){
                $address->formattedAddress = $addressData['formattedAddress'].', '.$address->country;
            }

            $address->suburb = array_key_exists('locality', $addressData) ? $addressData['locality']: "";
            $address->postcode = array_key_exists('postalCode', $addressData) ? $addressData['postalCode']: "";
        }
        if(array_key_exists('confidence', $components)){
            $address->partial = $components['confidence'] != 'High';
        }
        if(array_key_exists('point', $components)){
            $address->latitude = strval($components['point']['coordinates'][0]);
            $address->longitude = strval($components['point']['coordinates'][1]);
        }
        return $address;
    }
private function _parseComponent ( $ components ) { $ address = new GeoAddress ( ) ; $ address -> geoCoding = $ this -> name ; if ( array_key_exists ( 'address' , $ components ) ) { $ addressData = $ components [ 'address' ] ; $ address -> addressLine1 = array_key_exists ( 'addressLine' , $ addressData ) ? $ addressData [ 'addressLine' ] : "" ; $ address -> state = array_key_exists ( 'adminDistrict' , $ addressData ) ? $ addressData [ 'adminDistrict' ] : "" ; $ address -> country = array_key_exists ( 'countryRegion' , $ addressData ) ? $ addressData [ 'countryRegion' ] : "" ; if ( array_key_exists ( 'formattedAddress' , $ addressData ) ) { $ address -> formattedAddress = $ addressData [ 'formattedAddress' ] . ', ' . $ address -> country ; } $ address -> suburb = array_key_exists ( 'locality' , $ addressData ) ? $ addressData [ 'locality' ] : "" ; $ address -> postcode = array_key_exists ( 'postalCode' , $ addressData ) ? $ addressData [ 'postalCode' ] : "" ; } if ( array_key_exists ( 'confidence' , $ components ) ) { $ address -> partial = $ components [ 'confidence' ] != 'High' ; } if ( array_key_exists ( 'point' , $ components ) ) { $ address -> latitude = strval ( $ components [ 'point' ] [ 'coordinates' ] [ 0 ] ) ; $ address -> longitude = strval ( $ components [ 'point' ] [ 'coordinates' ] [ 1 ] ) ; } return $ address ; }
This function use to parse the return components from google bing api
@param $components
@return GeoAddress
This function use to parse the return components from google bing api