1 | <?php |
||
18 | class SanitizeSpec extends Spec |
||
19 | { |
||
20 | /** |
||
21 | * |
||
22 | * If the field is blank, use this as the replacement value. |
||
23 | * |
||
24 | * @param mixed |
||
25 | * |
||
26 | */ |
||
27 | protected $blank_value; |
||
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 | 7 | public function __invoke($subject) |
|
52 | |||
53 | /** |
||
54 | * |
||
55 | * Sanitize the field using this rule (blank not allowed). |
||
56 | * |
||
57 | * @param string $rule The rule name. |
||
58 | * |
||
59 | * @param ...$args Arguments for the rule. |
||
60 | * |
||
61 | * @return self |
||
62 | * |
||
63 | */ |
||
64 | 6 | public function to($rule) |
|
69 | |||
70 | /** |
||
71 | * |
||
72 | * Sanitize the using this rule (blank allowed). |
||
73 | * |
||
74 | * @param string $rule The rule name. |
||
75 | * |
||
76 | * @param ...$args Arguments for the rule. |
||
77 | * |
||
78 | * @return self |
||
79 | * |
||
80 | */ |
||
81 | 2 | public function toBlankOr($rule) |
|
86 | |||
87 | /** |
||
88 | * |
||
89 | * Use this value for blank fields. |
||
90 | * |
||
91 | * @param mixed $blank_value Replace the blank field with this value. |
||
92 | * |
||
93 | * @return self |
||
94 | * |
||
95 | */ |
||
96 | 2 | public function useBlankValue($blank_value) |
|
102 | |||
103 | /** |
||
104 | * |
||
105 | * Returns the default failure message for this rule specification. |
||
106 | * |
||
107 | * @return string |
||
108 | * |
||
109 | */ |
||
110 | 1 | protected function getDefaultMessage() |
|
115 | } |
||
116 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.