public function isExpectedType(Address $address) {
		$expected = $this->_config['expect'];
		if (!$expected) {
			return true;
		}

		$adminLevels = $address->getAdminLevels();
		$map = [
			static::TYPE_AAL1 => 1,
			static::TYPE_AAL2 => 2,
			static::TYPE_AAL3 => 3,
			static::TYPE_AAL4 => 4,
			static::TYPE_AAL5 => 5,
		];

		foreach ($expected as $expect) {
			switch ($expect) {
				case static::TYPE_COUNTRY:
					if ($address->getCountry() !== null) {
						return true;
					}
					break;
				case (static::TYPE_AAL1):
				case (static::TYPE_AAL2):
				case (static::TYPE_AAL3):
				case (static::TYPE_AAL4):
				case (static::TYPE_AAL5):
					if ($adminLevels->has($map[$expect])) {
						return true;
					}
					break;
				case static::TYPE_LOC:
					if ($address->getLocality() !== null) {
						return true;
					}
					break;
				case static::TYPE_SUBLOC:
					if ($address->getSubLocality() !== null) {
						return true;
					}
					break;
				case static::TYPE_POSTAL:
					if ($address->getPostalCode() !== null) {
						return true;
					}
					break;
				case static::TYPE_ADDRESS:
					if ($address->getStreetName() !== null) {
						return true;
					}
					break;
				case static::TYPE_NUMBER:
					if ($address->getStreetNumber() !== null) {
						return true;
					}
					break;
			}
		}
		return false;
	}
public function isExpectedType(Address $address) {
		$expected = $this->_config['expect'];
		if (!$expected) {
			return true;
		}

		$adminLevels = $address->getAdminLevels();
		$map = [
			static::TYPE_AAL1 => 1,
			static::TYPE_AAL2 => 2,
			static::TYPE_AAL3 => 3,
			static::TYPE_AAL4 => 4,
			static::TYPE_AAL5 => 5,
		];

		foreach ($expected as $expect) {
			switch ($expect) {
				case static::TYPE_COUNTRY:
					if ($address->getCountry() !== null) {
						return true;
					}
					break;
				case (static::TYPE_AAL1):
				case (static::TYPE_AAL2):
				case (static::TYPE_AAL3):
				case (static::TYPE_AAL4):
				case (static::TYPE_AAL5):
					if ($adminLevels->has($map[$expect])) {
						return true;
					}
					break;
				case static::TYPE_LOC:
					if ($address->getLocality() !== null) {
						return true;
					}
					break;
				case static::TYPE_SUBLOC:
					if ($address->getSubLocality() !== null) {
						return true;
					}
					break;
				case static::TYPE_POSTAL:
					if ($address->getPostalCode() !== null) {
						return true;
					}
					break;
				case static::TYPE_ADDRESS:
					if ($address->getStreetName() !== null) {
						return true;
					}
					break;
				case static::TYPE_NUMBER:
					if ($address->getStreetNumber() !== null) {
						return true;
					}
					break;
			}
		}
		return false;
	}
public function isExpectedType ( Address $ address ) { $ expected = $ this -> _config [ 'expect' ] ; if ( ! $ expected ) { return true ; } $ adminLevels = $ address -> getAdminLevels ( ) ; $ map = [ static :: TYPE_AAL1 => 1 , static :: TYPE_AAL2 => 2 , static :: TYPE_AAL3 => 3 , static :: TYPE_AAL4 => 4 , static :: TYPE_AAL5 => 5 , ] ; foreach ( $ expected as $ expect ) { switch ( $ expect ) { case static :: TYPE_COUNTRY : if ( $ address -> getCountry ( ) !== null ) { return true ; } break ; case ( static :: TYPE_AAL1 ) : case ( static :: TYPE_AAL2 ) : case ( static :: TYPE_AAL3 ) : case ( static :: TYPE_AAL4 ) : case ( static :: TYPE_AAL5 ) : if ( $ adminLevels -> has ( $ map [ $ expect ] ) ) { return true ; } break ; case static :: TYPE_LOC : if ( $ address -> getLocality ( ) !== null ) { return true ; } break ; case static :: TYPE_SUBLOC : if ( $ address -> getSubLocality ( ) !== null ) { return true ; } break ; case static :: TYPE_POSTAL : if ( $ address -> getPostalCode ( ) !== null ) { return true ; } break ; case static :: TYPE_ADDRESS : if ( $ address -> getStreetName ( ) !== null ) { return true ; } break ; case static :: TYPE_NUMBER : if ( $ address -> getStreetNumber ( ) !== null ) { return true ; } break ; } } return false ; }
Expects certain address types to be present in the given address.

@param \Geocoder\Model\Address $address
@return bool
Expects certain address types to be present in the given address .