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 | * Applies the rule specification to a subject. |
||
32 | * |
||
33 | * @param mixed $subject The filter subject. |
||
34 | * |
||
35 | * @return bool True on success, false on failure. |
||
36 | * |
||
37 | */ |
||
38 | 13 | public function __invoke($subject) |
|
54 | |||
55 | /** |
||
56 | * |
||
57 | * Validate the field matches this rule (blank not allowed). |
||
58 | * |
||
59 | * @param string $rule The rule name. |
||
60 | * |
||
61 | * @param ...$args Arguments for the rule. |
||
62 | * |
||
63 | * @return self |
||
64 | * |
||
65 | */ |
||
66 | 9 | public function is($rule) |
|
72 | |||
73 | /** |
||
74 | * |
||
75 | * Validate the field is blank. |
||
76 | * |
||
77 | * @return self |
||
78 | * |
||
79 | */ |
||
80 | 1 | public function isBlank() |
|
86 | |||
87 | /** |
||
88 | * |
||
89 | * Validate the field matches this rule (blank allowed). |
||
90 | * |
||
91 | * @param string $rule The rule name. |
||
92 | * |
||
93 | * @param ...$args Arguments for the rule. |
||
94 | * |
||
95 | * @return self |
||
96 | * |
||
97 | */ |
||
98 | 1 | public function isBlankOr($rule) |
|
104 | |||
105 | /** |
||
106 | * |
||
107 | * Validate the field does not match this rule (blank not allowed). |
||
108 | * |
||
109 | * @param string $rule The rule name. |
||
110 | * |
||
111 | * @param ...$args Arguments for the rule. |
||
112 | * |
||
113 | * @return self |
||
114 | * |
||
115 | */ |
||
116 | 2 | public function isNot($rule) |
|
122 | |||
123 | /** |
||
124 | * |
||
125 | * Validate the field is not blank. |
||
126 | * |
||
127 | * @return self |
||
128 | * |
||
129 | */ |
||
130 | 2 | public function isNotBlank() |
|
136 | |||
137 | /** |
||
138 | * |
||
139 | * Validate the field does not match this rule (blank allowed). |
||
140 | * |
||
141 | * @param string $rule The rule name. |
||
142 | * |
||
143 | * @param ...$args Arguments for the rule. |
||
144 | * |
||
145 | * @return self |
||
146 | * |
||
147 | */ |
||
148 | 1 | public function isBlankOrNot($rule) |
|
154 | |||
155 | /** |
||
156 | * |
||
157 | * Returns the default failure message for this rule specification. |
||
158 | * |
||
159 | * @return string |
||
160 | * |
||
161 | */ |
||
162 | 13 | protected function getDefaultMessage() |
|
182 | } |
||
183 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.