src/Build/AddressBuild.php
private function updateAddressFromComponent(Address $address, $component) : Address
    {
        foreach ($component->types as $type) {
            switch ($type) {
                case 'postal_code':
                    $address->setPostalCode($component->long_name);
                    break;
                case 'locality':
                case 'postal_town':
                    $address->setLocality($component->long_name);
                    break;
                case 'country':
                    $address->setCountry($component->long_name);
                    $address->setCountryCode($component->short_name);
                    break;
                case 'street_number':
                    $address->setStreetNumber($component->long_name);
                    break;
                case 'route':
                    $address->setStreetName($component->long_name);
                    break;
                case 'administrative_area_level_1':
                case 'administrative_area_level_2':
                case 'administrative_area_level_3':
                case 'administrative_area_level_4':
                case 'administrative_area_level_5':
                case 'sublocality':
                case 'sublocality_level_1':
                case 'sublocality_level_2':
                case 'sublocality_level_3':
                case 'sublocality_level_4':
                case 'sublocality_level_5':
                case 'street_address':
                case 'intersection':
                case 'political':
                case 'colloquial_area':
                case 'ward':
                case 'neighborhood':
                case 'premise':
                case 'subpremise':
                case 'natural_feature':
                case 'airport':
                case 'park':
                case 'point_of_interest':
                case 'establishment':
                    // TODO implements method
                    break;
                default:
            }
        }

        return $address;
    }
private function updateAddressFromComponent(Address $address, $component) : Address
    {
        foreach ($component->types as $type) {
            switch ($type) {
                case 'postal_code':
                    $address->setPostalCode($component->long_name);
                    break;
                case 'locality':
                case 'postal_town':
                    $address->setLocality($component->long_name);
                    break;
                case 'country':
                    $address->setCountry($component->long_name);
                    $address->setCountryCode($component->short_name);
                    break;
                case 'street_number':
                    $address->setStreetNumber($component->long_name);
                    break;
                case 'route':
                    $address->setStreetName($component->long_name);
                    break;
                case 'administrative_area_level_1':
                case 'administrative_area_level_2':
                case 'administrative_area_level_3':
                case 'administrative_area_level_4':
                case 'administrative_area_level_5':
                case 'sublocality':
                case 'sublocality_level_1':
                case 'sublocality_level_2':
                case 'sublocality_level_3':
                case 'sublocality_level_4':
                case 'sublocality_level_5':
                case 'street_address':
                case 'intersection':
                case 'political':
                case 'colloquial_area':
                case 'ward':
                case 'neighborhood':
                case 'premise':
                case 'subpremise':
                case 'natural_feature':
                case 'airport':
                case 'park':
                case 'point_of_interest':
                case 'establishment':
                    // TODO implements method
                    break;
                default:
            }
        }

        return $address;
    }
private function updateAddressFromComponent ( Address $ address , $ component ) : Address { foreach ( $ component -> types as $ type ) { switch ( $ type ) { case 'postal_code' : $ address -> setPostalCode ( $ component -> long_name ) ; break ; case 'locality' : case 'postal_town' : $ address -> setLocality ( $ component -> long_name ) ; break ; case 'country' : $ address -> setCountry ( $ component -> long_name ) ; $ address -> setCountryCode ( $ component -> short_name ) ; break ; case 'street_number' : $ address -> setStreetNumber ( $ component -> long_name ) ; break ; case 'route' : $ address -> setStreetName ( $ component -> long_name ) ; break ; case 'administrative_area_level_1' : case 'administrative_area_level_2' : case 'administrative_area_level_3' : case 'administrative_area_level_4' : case 'administrative_area_level_5' : case 'sublocality' : case 'sublocality_level_1' : case 'sublocality_level_2' : case 'sublocality_level_3' : case 'sublocality_level_4' : case 'sublocality_level_5' : case 'street_address' : case 'intersection' : case 'political' : case 'colloquial_area' : case 'ward' : case 'neighborhood' : case 'premise' : case 'subpremise' : case 'natural_feature' : case 'airport' : case 'park' : case 'point_of_interest' : case 'establishment' : // TODO implements method break ; default : } } return $ address ; }
update address from google address component

@param Address   $address
@param object    $component  Google address component object
@return Address
update address from google address component