📄 chainedvalidator.class.php
字号:
<?php lt_include( PLOG_CLASS_PATH."class/data/validator/validator.class.php" ); /** * \ingroup Validator * * Validator class that allows to make chained validators so that we can validate for more complex * rules. The parameter for the constructor is an array of Validator objects that we are going to * chain. * * Internally, this class is not actually going to chain the validators but their rules, one after each * other using the Validator::addValidator() method. * * You can either create your own brand new custom Validator class and add the rules that you need * or if you know that some Validator classes are already doing what you need, you can always * chain them by using the ChainedValidator class. * * Example: * * <pre> * $val = new ChainedValidator( Array( new StringValidator(), * new UsernameValidator()); * $result = $val->validate( $value ); * </pre> */ class ChainedValidator extends Validator { /** * Constructor of the chained validator * * @param validators An array of Validator objects which implement the logic that * we need */ function ChainedValidator( $validators ) { $this->Validator(); foreach( $validators as $validator ) { $this->addValidator( $validator ); } } }?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -