Example #1
0
 /**
  * @param int $level
  * @return int
  * @throws CM_Class_Exception_TypeNotConfiguredException
  * @throws CM_Exception_Invalid
  */
 public static function getTypeByLevel($level)
 {
     $level = (int) $level;
     $typeList = array(self::LEVEL_COUNTRY => CM_Model_Location_Country::getTypeStatic(), self::LEVEL_STATE => CM_Model_Location_State::getTypeStatic(), self::LEVEL_CITY => CM_Model_Location_City::getTypeStatic(), self::LEVEL_ZIP => CM_Model_Location_Zip::getTypeStatic());
     if (!isset($typeList[$level])) {
         throw new CM_Exception_Invalid('Invalid location level `' . $level . '`');
     }
     return $typeList[$level];
 }