1 | <?php |
||
23 | class Enum extends AbstractRule |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Contains the rule failure message |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $message = 'The field is not one of the given value(s).'; |
||
32 | |||
33 | /** |
||
34 | * Strict check mode |
||
35 | * |
||
36 | * @var bool |
||
37 | */ |
||
38 | protected $strict = false; |
||
39 | |||
40 | /** |
||
41 | * Performs validation on the given value |
||
42 | * |
||
43 | * @param mixed $value Value to validate |
||
44 | * @param string $field Unused by this rule |
||
45 | * @param array $allFields Unused by this rule |
||
46 | * |
||
47 | * @return bool |
||
48 | * |
||
49 | * @since 2.0 |
||
50 | */ |
||
51 | 8 | public function validate($value, $field = null, $allFields = null) |
|
57 | |||
58 | /** |
||
59 | * Sets the value(s) and mode to check against |
||
60 | * |
||
61 | * @param string $params |
||
62 | * |
||
63 | * @return $this |
||
64 | * |
||
65 | * @since 2.0 |
||
66 | */ |
||
67 | 11 | public function setParameter($params) |
|
81 | |||
82 | /** |
||
83 | * Check strict mode |
||
84 | * |
||
85 | * @return bool |
||
86 | * |
||
87 | * @since 2.0 |
||
88 | */ |
||
89 | 1 | public function isStrict() |
|
93 | |||
94 | /** |
||
95 | * Set strict mode |
||
96 | * |
||
97 | * @param bool $strict |
||
98 | * |
||
99 | * @return $this |
||
100 | * |
||
101 | * @since 2.0 |
||
102 | */ |
||
103 | 1 | public function setStrict($strict) |
|
109 | |||
110 | } |
||
111 |