/** * Sets validator options * * @param array The options for validator */ public function __construct($option = null) { if (!is_array($option)) { list($type, $strict) = Util\ParameterUtils::parse(func_get_args(), 'l|b'); $this->setOption('type', $type); if ($strict) { $this->setOption('strict', $strict); } } parent::__construct($option); }
/** * Sets validator options * * @param array The options for validator */ public function __construct($option = null) { if (is_callable($option)) { $this->setOption('callback', new Util\Callback($option)); } if (is_callable(@$option[0])) { list($cb, $params) = Util\ParameterUtils::parse(func_get_args(), 'f|a'); $this->setOption('callback', new Util\Callback($cb)); if ($strict) { $this->setOption('params', $params); } } parent::__construct($option); }