1 | <?php |
||
18 | class ValidateSpec extends Spec |
||
19 | { |
||
20 | /** |
||
21 | * |
||
22 | * Reverse the rule, so that a "pass" is treated as a "fail". |
||
23 | * |
||
24 | * @var bool |
||
25 | * |
||
26 | */ |
||
27 | protected $reverse = false; |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | * Validate the field matches this rule (blank not allowed). |
||
32 | * |
||
33 | * @param string $rule The rule name. |
||
34 | * |
||
35 | * @param ...$args Arguments for the rule. |
||
36 | * |
||
37 | * @return self |
||
38 | * |
||
39 | */ |
||
40 | 9 | public function is($rule) |
|
46 | |||
47 | /** |
||
48 | * |
||
49 | * Validate the field is blank. |
||
50 | * |
||
51 | * @return self |
||
52 | * |
||
53 | */ |
||
54 | 1 | public function isBlank() |
|
60 | |||
61 | /** |
||
62 | * |
||
63 | * Validate the field matches this rule (blank allowed). |
||
64 | * |
||
65 | * @param string $rule The rule name. |
||
66 | * |
||
67 | * @param ...$args Arguments for the rule. |
||
68 | * |
||
69 | * @return self |
||
70 | * |
||
71 | */ |
||
72 | 1 | public function isBlankOr($rule) |
|
78 | |||
79 | /** |
||
80 | * |
||
81 | * Validate the field does not match this rule (blank not allowed). |
||
82 | * |
||
83 | * @param string $rule The rule name. |
||
84 | * |
||
85 | * @param ...$args Arguments for the rule. |
||
86 | * |
||
87 | * @return self |
||
88 | * |
||
89 | */ |
||
90 | 2 | public function isNot($rule) |
|
96 | |||
97 | /** |
||
98 | * |
||
99 | * Validate the field does not match this rule (blank allowed). |
||
100 | * |
||
101 | * @param string $rule The rule name. |
||
102 | * |
||
103 | * @param ...$args Arguments for the rule. |
||
104 | * |
||
105 | * @return self |
||
106 | * |
||
107 | */ |
||
108 | 1 | public function isBlankOrNot($rule) |
|
114 | |||
115 | /** |
||
116 | * |
||
117 | * Returns the default failure message for this rule specification. |
||
118 | * |
||
119 | * @return string |
||
120 | * |
||
121 | */ |
||
122 | 12 | protected function getDefaultMessage() |
|
140 | |||
141 | /** |
||
142 | * |
||
143 | * Check if the subject field passes the rule specification. |
||
144 | * |
||
145 | * @param mixed $subject The filter subject. |
||
146 | * |
||
147 | * @return bool |
||
148 | * |
||
149 | */ |
||
150 | 12 | protected function applyRule($subject) |
|
166 | |||
167 | /** |
||
168 | * |
||
169 | * Does the field exist in the subject, even if it is null? |
||
170 | * |
||
171 | * @param mixed $subject The filter subject. |
||
172 | * |
||
173 | * @return bool |
||
174 | * |
||
175 | */ |
||
176 | 11 | protected function fieldExists($subject) |
|
204 | } |
||
205 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.