Пример #1
0
 /**
  * @throws CM_Exception_Invalid
  */
 protected function _initialize()
 {
     $enumClassName = $this->_params->get('className');
     if (!is_a($enumClassName, 'CM_Type_Enum', true)) {
         throw new CM_Exception_Invalid('Invalid "className" parameter');
     }
     /** @type CM_Type_Enum $enumClassName */
     $this->_params->set('values', $enumClassName::getConstantList());
     parent::_initialize();
 }
Пример #2
0
 /**
  * @param CM_Frontend_Environment $environment
  * @param int                     $userInput
  * @return CM_Site_Abstract
  */
 public function validate(CM_Frontend_Environment $environment, $userInput)
 {
     $userInput = parent::validate($environment, $userInput);
     return CM_Site_Abstract::factory($userInput);
 }