@@ -80,7 +80,6 @@ |
||
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Set which types of files are accepted by the file input |
| 83 | - |
|
| 84 | 83 | */ |
| 85 | 84 | public function accept() |
| 86 | 85 | { |
@@ -258,49 +258,49 @@ |
||
| 258 | 258 | return $this; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - /** |
|
| 262 | - * Apply multiple rules passed as a string. |
|
| 263 | - * |
|
| 264 | - * @param $rules |
|
| 265 | - * @return $this |
|
| 266 | - */ |
|
| 267 | - public function rules($rules) |
|
| 268 | - { |
|
| 269 | - if (!is_array($rules)) { |
|
| 270 | - $rules = explode('|', $rules); |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - foreach ($rules as $rule) { |
|
| 274 | - $parameters = null; |
|
| 275 | - |
|
| 276 | - // If we have a rule with a value |
|
| 277 | - if (($colon = strpos($rule, ':')) !== false) { |
|
| 278 | - $rulename = substr($rule, 0, $colon) ; |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * Regular expressions may contain commas and should not be divided by str_getcsv. |
|
| 282 | - * For regular expressions we are just using the complete expression as a parameter. |
|
| 283 | - */ |
|
| 284 | - if ($rulename !== 'regex') { |
|
| 285 | - $parameters = str_getcsv(substr($rule, $colon + 1)); |
|
| 286 | - } else { |
|
| 287 | - $parameters = [substr($rule, $colon + 1)]; |
|
| 288 | - } |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - // Exclude unsupported rules |
|
| 292 | - $rule = is_numeric($colon) ? substr($rule, 0, $colon) : $rule; |
|
| 293 | - |
|
| 294 | - // Store processed rule in Former's array |
|
| 295 | - if (!isset($parameters)) { |
|
| 296 | - $parameters = array(); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - call_user_func_array([$this, 'rule'], array_merge([$rule], $parameters)); |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - return $this; |
|
| 303 | - } |
|
| 261 | + /** |
|
| 262 | + * Apply multiple rules passed as a string. |
|
| 263 | + * |
|
| 264 | + * @param $rules |
|
| 265 | + * @return $this |
|
| 266 | + */ |
|
| 267 | + public function rules($rules) |
|
| 268 | + { |
|
| 269 | + if (!is_array($rules)) { |
|
| 270 | + $rules = explode('|', $rules); |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + foreach ($rules as $rule) { |
|
| 274 | + $parameters = null; |
|
| 275 | + |
|
| 276 | + // If we have a rule with a value |
|
| 277 | + if (($colon = strpos($rule, ':')) !== false) { |
|
| 278 | + $rulename = substr($rule, 0, $colon) ; |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * Regular expressions may contain commas and should not be divided by str_getcsv. |
|
| 282 | + * For regular expressions we are just using the complete expression as a parameter. |
|
| 283 | + */ |
|
| 284 | + if ($rulename !== 'regex') { |
|
| 285 | + $parameters = str_getcsv(substr($rule, $colon + 1)); |
|
| 286 | + } else { |
|
| 287 | + $parameters = [substr($rule, $colon + 1)]; |
|
| 288 | + } |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + // Exclude unsupported rules |
|
| 292 | + $rule = is_numeric($colon) ? substr($rule, 0, $colon) : $rule; |
|
| 293 | + |
|
| 294 | + // Store processed rule in Former's array |
|
| 295 | + if (!isset($parameters)) { |
|
| 296 | + $parameters = array(); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + call_user_func_array([$this, 'rule'], array_merge([$rule], $parameters)); |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + return $this; |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | 306 | * Adds a label to the group/field |