1: <?php
 2: /**
 3:  * Wei Framework
 4:  *
 5:  * @copyright   Copyright (c) 2008-2015 Twin Huang
 6:  * @license     http://opensource.org/licenses/mit-license.php MIT License
 7:  */
 8: 
 9: namespace Wei\Validator;
10: 
11: /**
12:  * Check if the input is valid by all of the rules
13:  *
14:  * @author      Twin Huang <twinhuang@qq.com>
15:  */
16: class AllOf extends SomeOf
17: {
18:     protected $atLeastMessage = '%name% must be passed by all of these rules';
19: 
20:     /**
21:      * Check if the input is valid by all of the rules
22:      *
23:      * @param mixed $input The input to be validated
24:      * @param array $rules An array that the key is validator rule name and the value is validator options
25:      * @param int|null $atLeast How many rules should be validated at least
26:      * @return bool
27:      */
28:     public function __invoke($input, array $rules = array(), $atLeast = null)
29:     {
30:         $this->atLeast = count($rules ?: $this->rules);
31: 
32:         return parent::__invoke($input, $rules, $atLeast);
33:     }
34: }
35: