ValidationRuleParser
Properties
$data array
The data being validated.
$implicitAttributes array
The implicit attributes.
Methods
__construct ( array $data ) : void
Create a new validation rule parser.
Parameters
- $data array
explode ( $rules ) : stdClass
Parse the human-friendly rules into a full rules array for the validator.
Parameters
- $rules array
explodeRules ( $rules ) : array
Explode the rules into an array of explicit rules.
Parameters
- $rules array
explodeExplicitRule ( $rule , $attribute ) : array
Explode the explicit rule into an array if necessary.
Parameters
- $rule mixed
- $attribute string
prepareRule ( $rule , $attribute ) : mixed
Prepare the given rule for the Validator.
Parameters
- $rule mixed
- $attribute string
explodeWildcardRules ( $results , $attribute , $rules ) : array
Define a set of rules that apply to each element in an array attribute.
Parameters
- $results array
- $attribute string
- $rules string|array
mergeRules ( $results , $attribute , $rules ) : array
Merge additional rules into a given attribute(s).
Parameters
- $results array
- $attribute string|array
- $rules string|array
mergeRulesForAttribute ( $results , $attribute , $rules ) : array
Merge additional rules into a given attribute.
Parameters
- $results array
- $attribute string
- $rules string|array
parse ( $rule ) : array
Extract the rule name and parameters from a rule.
Parameters
- $rule array|string
parseArrayRule ( array $rule ) : array
Parse an array based rule.
Parameters
- $rule array
parseStringRule ( $rule ) : array
Parse a string based rule.
Parameters
- $rule string
parseParameters ( $rule , $parameter ) : array
Parse a parameter list.
Parameters
- $rule string
- $parameter string
ruleIsRegex ( $rule ) : bool
Determine if the rule is a regular expression.
Parameters
- $rule string
normalizeRule ( $rule ) : string
Normalizes a rule so that we can accept short types.
Parameters
- $rule string
filterConditionalRules ( $rules , array $data ) : array
Expand the conditional rules in the given array of rules.
Parameters
- $rules array
- $data array