本文整理汇总了PHP中Zend\InputFilter\Input::setValidatorChain方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::setValidatorChain方法的具体用法?PHP Input::setValidatorChain怎么用?PHP Input::setValidatorChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\InputFilter\Input
的用法示例。
在下文中一共展示了Input::setValidatorChain方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCanInjectValidatorChain
public function testCanInjectValidatorChain()
{
$input = new Input('foo');
$chain = new Validator\ValidatorChain();
$input->setValidatorChain($chain);
$this->assertSame($chain, $input->getValidatorChain());
}
示例2: createInputFilter
public function createInputFilter()
{
$inputFilter = new InputFilter\InputFilter();
$email = new InputFilter\Input('email');
$email->setRequired(true);
$validatorChain = new Validator\ValidatorChain();
$validatorChain->attach(new Validator\EmailAddress());
$email->setValidatorChain($validatorChain);
$inputFilter->add($email);
return $inputFilter;
}
示例3: createInputFilter
public function createInputFilter()
{
$inputFilter = new InputFilter\InputFilter();
//username
$username = new InputFilter\Input('email');
$username->setRequired(true);
$validatorChain = new Validator\ValidatorChain();
$validatorChain->attach(new Validator\EmailAddress());
$username->setValidatorChain($validatorChain);
$inputFilter->add($username);
//password
$password = new InputFilter\Input('password');
$password->setRequired(true);
$inputFilter->add($password);
return $inputFilter;
}
示例4: createInputFilter
protected function createInputFilter()
{
$inputFilter = new InputFilter\InputFilter();
// password
$password = new InputFilter\Input('password');
$password->setRequired(true);
// Generate password validator chain
$validatorPasswordChain = new Validator\ValidatorChain();
$validatorPasswordChain->attach(new Validator\StringLength(array('min' => 6)));
$password->setValidatorChain($validatorPasswordChain);
$inputFilter->add($password);
// confirmation
$confirmation = new InputFilter\Input('confirmation');
$confirmation->setRequired(true);
$confirmation->setValidatorChain($validatorPasswordChain);
$inputFilter->add($confirmation);
return $inputFilter;
}
示例5: __construct
public function __construct()
{
$title = new Input('title');
$title->setRequired(true);
$title->setValidatorChain($this->getTitleValidatorChain());
$title->setFilterChain($this->getStringTrimFilterChain());
$slug = new Input('slug');
$slug->setRequired(true);
$slug->setValidatorChain($this->getSlugValidatorChain());
$slug->setFilterChain($this->getStringTrimFilterChain());
$content = new Input('content');
$content->setRequired(true);
$content->setValidatorChain($this->getContentValidatorChain());
$content->setFilterChain($this->getStringTrimFilterChain());
$this->add($title);
$this->add($slug);
$this->add($content);
}
示例6: createInputFilter
protected function createInputFilter()
{
$inputFilter = new InputFilter\InputFilter();
//type
$type = new InputFilter\Input('type');
$type->setRequired(true);
$inputFilter->add($type);
//subject
$subject = new InputFilter\Input('subject');
$subject->setRequired(true);
$inputFilter->add($subject);
//content
$content = new InputFilter\Input('content');
$content->setRequired(true);
$inputFilter->add($content);
//language
$language = new InputFilter\Input('content');
$language->setRequired(true);
$validatorChain = new Validator\ValidatorChain();
$validatorChain->attach(new Validator\Between(array('min' => 0, 'max' => 1)));
$language->setValidatorChain($validatorChain);
$inputFilter->add($language);
return $inputFilter;
}