Пример #1
0
 protected function setConfigs($configs)
 {
     parent::setConfigs($configs);
     if (!isset($this->configs['min']) && !isset($this->configs['max'])) {
         throw new \Exception("{$this->name} rule expect 'min' or 'max' option.");
     }
 }
Пример #2
0
 /**
  * Set arguments for checking
  *
  * @param array $arguments
  *
  * @return AbstractRule
  * @throws \Magelight\Exception
  */
 public function setArguments($arguments = [])
 {
     $dateRule = DateTime::forge();
     if (!isset($arguments[0]) || !isset($arguments[1])) {
         throw new \Magelight\Exception('Arguments for DatRange rule must be passed.');
     }
     if (!$dateRule->check($arguments[0]) || !$dateRule->check($arguments[1])) {
         throw new \Magelight\Exception('Arguments for DatRange rule must be valid date strings.');
     }
     return parent::setArguments($arguments);
 }
Пример #3
0
 public function __construct()
 {
     parent::__construct();
     trigger_error("Use xdigits instead.", E_USER_DEPRECATED);
 }
Пример #4
0
 function HasElementsRule($arrElms)
 {
     parent::AbstractRule();
     $this->elements = $arrElms;
 }
Пример #5
0
 public function reportError($input, array $extraParams = array())
 {
     return parent::reportError($input, $extraParams);
 }
Пример #6
0
 /**
  * Returns true if the rule is valid for the given context
  *
  * @param mixed $context
  *
  * @return bool
  */
 public function isValid($context)
 {
     return $this->rule->run($context);
 }