1 | <?php |
||
15 | class FilterResource |
||
16 | { |
||
17 | /** |
||
18 | * @var Filter |
||
19 | */ |
||
20 | protected $filter; |
||
21 | |||
22 | /** |
||
23 | * @var null|string|string[] |
||
24 | */ |
||
25 | protected $keys; |
||
26 | |||
27 | /** |
||
28 | * @param Filter $filter |
||
29 | * @param null|string|string[] $keys |
||
30 | */ |
||
31 | 144 | public function __construct(Filter $filter, $keys = null) |
|
36 | |||
37 | /** |
||
38 | * Results rule that returns alphabetic numeric characters from the value |
||
39 | * |
||
40 | * @return $this |
||
41 | */ |
||
42 | 4 | public function alnum() |
|
46 | |||
47 | /** |
||
48 | * Results rule that returns the value appended with a given value |
||
49 | * |
||
50 | * @param string $append |
||
51 | * @return Chain |
||
52 | */ |
||
53 | 4 | public function append($append) |
|
57 | |||
58 | /** |
||
59 | * Results rule that returns a casted boolean |
||
60 | * |
||
61 | * @return $this |
||
62 | */ |
||
63 | 16 | public function bool() |
|
67 | |||
68 | /** |
||
69 | * Returns rule that returns a value modified by a callable closure |
||
70 | * |
||
71 | * @param callable $callable |
||
72 | * @return $this |
||
73 | */ |
||
74 | 2 | public function callback(callable $callable) |
|
78 | |||
79 | /** |
||
80 | * Returns rule that defaults a given value if the data key was not provided |
||
81 | * |
||
82 | * @param mixed $defaultValue |
||
83 | * @return $this |
||
84 | */ |
||
85 | 11 | public function defaults($defaultValue) |
|
89 | |||
90 | /** |
||
91 | * Returns rule that returns an value in a specific encoding format |
||
92 | * |
||
93 | * @param string|null $toEncodingFormat |
||
94 | * @param string|null $fromEncodingFormat |
||
95 | * @return FilterResource |
||
96 | */ |
||
97 | 5 | public function encode($toEncodingFormat = null, $fromEncodingFormat = null) |
|
101 | |||
102 | /** |
||
103 | * Returns rule that results a casted float |
||
104 | * |
||
105 | * @return $this |
||
106 | */ |
||
107 | 12 | public function float() |
|
111 | |||
112 | /** |
||
113 | * Returns rule that results a casted int |
||
114 | * |
||
115 | * @return $this |
||
116 | */ |
||
117 | 11 | public function int() |
|
121 | |||
122 | /** |
||
123 | * Returns rule that results all letters of a value |
||
124 | * |
||
125 | * @return $this |
||
126 | */ |
||
127 | 3 | public function letters() |
|
131 | |||
132 | /** |
||
133 | * Returns rule that results a lower-cased value |
||
134 | * |
||
135 | * @return $this |
||
136 | */ |
||
137 | 16 | public function lower() |
|
141 | |||
142 | /** |
||
143 | * Returns rule that formats numbers |
||
144 | * |
||
145 | * @param int $decimals |
||
146 | * @param string $decimalPoint |
||
147 | * @param string $thousandSeperator |
||
148 | * @return $this |
||
149 | */ |
||
150 | 12 | public function numberFormat($decimals, $decimalPoint, $thousandSeperator) |
|
154 | |||
155 | /** |
||
156 | * Returns rule that results all numbers of a value |
||
157 | * |
||
158 | * @return $this |
||
159 | */ |
||
160 | 3 | public function numbers() |
|
164 | |||
165 | /** |
||
166 | * Results rule that returns the value prepended with a given value |
||
167 | * |
||
168 | * @param string $prepend |
||
169 | * @return Chain |
||
170 | */ |
||
171 | 4 | public function prepend($prepend) |
|
175 | |||
176 | /** |
||
177 | * Results rule that returns a value with replacements by a regex |
||
178 | * |
||
179 | * @param string $searchRegex |
||
180 | * @param string $replace |
||
181 | * @return $this |
||
182 | */ |
||
183 | 2 | public function regexReplace($searchRegex, $replace) |
|
187 | |||
188 | /** |
||
189 | * Results rule that returns a value with replacements |
||
190 | * |
||
191 | * @param mixed $search |
||
192 | * @param mixed $replace |
||
193 | * @return $this |
||
194 | */ |
||
195 | 5 | public function replace($search, $replace) |
|
199 | |||
200 | /** |
||
201 | * Returns rule that results a casted string |
||
202 | * |
||
203 | * @return $this |
||
204 | */ |
||
205 | 7 | public function string() |
|
209 | |||
210 | /** |
||
211 | * Results rule that results a html-stripped value |
||
212 | * |
||
213 | * @param null|string $excludeTags |
||
214 | * @return $this |
||
215 | */ |
||
216 | 4 | public function stripHtml($excludeTags = null) |
|
220 | |||
221 | /** |
||
222 | * Returns rule that results a trimmed value |
||
223 | * |
||
224 | * @param string|null $characters |
||
225 | * @return $this |
||
226 | */ |
||
227 | 21 | public function trim($characters = null) |
|
231 | |||
232 | /** |
||
233 | * Results rule that returns an upper-cased value |
||
234 | * |
||
235 | * @return $this |
||
236 | */ |
||
237 | 6 | public function upper() |
|
241 | |||
242 | /** |
||
243 | * Returns rule that results a value starting with a upper-cased character |
||
244 | * |
||
245 | * @return $this |
||
246 | */ |
||
247 | 14 | public function upperFirst() |
|
251 | |||
252 | /** |
||
253 | * Add a new rule to the chain |
||
254 | * |
||
255 | * @param FilterRule $rule |
||
256 | * @return $this |
||
257 | */ |
||
258 | 143 | protected function addRule(FilterRule $rule) |
|
274 | } |
||
275 |