Index: trunk/extensions/Validator/includes/criteria/CriterionHasLength.php |
— | — | @@ -19,6 +19,9 @@ |
20 | 20 | /** |
21 | 21 | * Constructor. |
22 | 22 | * |
| 23 | + * @param integer $lowerBound |
| 24 | + * @param mixed $upperBound |
| 25 | + * |
23 | 26 | * @since 0.4 |
24 | 27 | */ |
25 | 28 | public function __construct( $lowerBound, $upperBound = false ) { |
Index: trunk/extensions/Validator/includes/criteria/CriterionInArray.php |
— | — | @@ -14,19 +14,32 @@ |
15 | 15 | class CriterionInArray extends ParameterCriterion { |
16 | 16 | |
17 | 17 | /** |
| 18 | + * List of allowed values. |
| 19 | + * |
| 20 | + * @since 0.4 |
| 21 | + * |
| 22 | + * @var array |
| 23 | + */ |
| 24 | + protected $allowedValues; |
| 25 | + |
| 26 | + /** |
18 | 27 | * Constructor. |
19 | 28 | * |
| 29 | + * @param mixed $allowedValues |
| 30 | + * |
20 | 31 | * @since 0.4 |
21 | 32 | */ |
22 | | - public function __construct( ) { |
| 33 | + public function __construct( $allowedValues ) { |
23 | 34 | parent::__construct(); |
| 35 | + |
| 36 | + $this->allowedValues = (array)$allowedValues; |
24 | 37 | } |
25 | 38 | |
26 | 39 | /** |
27 | 40 | * @see ParameterCriterion::validate |
28 | 41 | */ |
29 | 42 | public function validate( $value ) { |
30 | | - |
| 43 | + return in_array( $value, $this->allowedValues ); |
31 | 44 | } |
32 | 45 | |
33 | 46 | } |
\ No newline at end of file |