[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/data/validator/validator.class.php" ); 4 5 /** 6 * \ingroup Validator 7 * 8 * Validator class that allows to make chained validators so that we can validate for more complex 9 * rules. The parameter for the constructor is an array of Validator objects that we are going to 10 * chain. 11 * 12 * Internally, this class is not actually going to chain the validators but their rules, one after each 13 * other using the Validator::addValidator() method. 14 * 15 * You can either create your own brand new custom Validator class and add the rules that you need 16 * or if you know that some Validator classes are already doing what you need, you can always 17 * chain them by using the ChainedValidator class. 18 * 19 * Example: 20 * 21 * <pre> 22 * $val = new ChainedValidator( Array( new StringValidator(), 23 * new UsernameValidator()); 24 * $result = $val->validate( $value ); 25 * </pre> 26 */ 27 class ChainedValidator extends Validator 28 { 29 /** 30 * Constructor of the chained validator 31 * 32 * @param validators An array of Validator objects which implement the logic that 33 * we need 34 */ 35 function ChainedValidator( $validators ) 36 { 37 $this->Validator(); 38 39 foreach( $validators as $validator ) { 40 $this->addValidator( $validator ); 41 } 42 } 43 } 44 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |