public function getAddressComponents($type = null)
    {
        if ($type === null) {
            return $this->addressComponents;
        }

        $addressComponents = array();

        foreach ($this->addressComponents as $addressComponent) {
            if (in_array($type, $addressComponent->getTypes())) {
                $addressComponents[] = $addressComponent;
            }
        }

        return $addressComponents;
    }
public function getAddressComponents($type = null)
    {
        if ($type === null) {
            return $this->addressComponents;
        }

        $addressComponents = array();

        foreach ($this->addressComponents as $addressComponent) {
            if (in_array($type, $addressComponent->getTypes())) {
                $addressComponents[] = $addressComponent;
            }
        }

        return $addressComponents;
    }
public function getAddressComponents ( $ type = null ) { if ( $ type === null ) { return $ this -> addressComponents ; } $ addressComponents = array ( ) ; foreach ( $ this -> addressComponents as $ addressComponent ) { if ( in_array ( $ type , $ addressComponent -> getTypes ( ) ) ) { $ addressComponents [ ] = $ addressComponent ; } } return $ addressComponents ; }
Gets the address components.

@param string|null The type of the address components.

@return array The address components.
Gets the address components .