I have got the following function in my class that I think can be further be improved but I'm lacking ideas how:...private function populateAddressVars(){    if (!$this->service_results || !$this->service_results->results[0]) {        return false;    }    foreach ($this->service_results->results[0]->address_components as $component) {        if (in_array('street_number', $component->types)) {            $this->streetNumber = $component->long_name;        }        if (in_array('locality', $component->types)) {            $this->locality = $component->long_name;        }        if (in_array('postal_town', $component->types)) {            $this->town = $component->long_name;        }        if (in_array('administrative_area_level_2', $component->types)) {            $this->country = $component->long_name;        }        if (in_array('country', $component->types)) {            $this->country = $component->long_name;        }        if (in_array('administrative_area_level_1', $component->types)) {            $this->district = $component->long_name;        }        if (in_array('postal_code', $component->types)) {            $this->postcode = $component->long_name;        }        if (in_array('route', $component->types)) {            $this->streetAddress = $component->long_name;        }    }}...Can it be further improved?
Extracting components of a street address
php;php5