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 | 7 | public function is($rule) |
|
46 | |||
47 | /** |
||
48 | * |
||
49 | * Validate the field is blank. |
||
50 | * |
||
51 | * @return self |
||
52 | * |
||
53 | */ |
||
54 | public function isBlank() |
||
60 | 1 | ||
61 | 1 | /** |
|
62 | 1 | * |
|
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 | public function isBlankOr($rule) |
||
78 | 3 | ||
79 | 3 | /** |
|
80 | 3 | * |
|
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 | public function isNot($rule) |
||
96 | 1 | ||
97 | 1 | /** |
|
98 | 1 | * |
|
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 | 9 | public function isBlankOrNot($rule) |
|
114 | 9 | ||
115 | 3 | /** |
|
116 | 3 | * |
|
117 | 9 | * Returns the default failure message for this rule specification. |
|
118 | * |
||
119 | * @return string |
||
120 | * |
||
121 | */ |
||
122 | 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 | protected function applyRule($subject) |
||
167 | } |
||
168 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.