ValidationRuleParser
in package
Table of Contents
- $data : array<string|int, mixed>
- The data being validated.
- $implicitAttributes : array<string|int, mixed>
- The implicit attributes.
- __construct() : void
- Create a new validation rule parser.
- explode() : stdClass
- Parse the human-friendly rules into a full rules array for the validator.
- mergeRules() : array<string|int, mixed>
- Merge additional rules into a given attribute(s).
- parse() : array<string|int, mixed>
- Extract the rule name and parameters from a rule.
- explodeExplicitRule() : array<string|int, mixed>
- Explode the explicit rule into an array if necessary.
- explodeRules() : array<string|int, mixed>
- Explode the rules into an array of explicit rules.
- explodeWildcardRules() : array<string|int, mixed>
- Define a set of rules that apply to each element in an array attribute.
- mergeRulesForAttribute() : array<string|int, mixed>
- Merge additional rules into a given attribute.
- normalizeRule() : string
- Normalizes a rule so that we can accept short types.
- parseArrayRule() : array<string|int, mixed>
- Parse an array based rule.
- parseParameters() : array<string|int, mixed>
- Parse a parameter list.
- parseStringRule() : array<string|int, mixed>
- Parse a string based rule.
- prepareRule() : mixed
- Prepare the given rule for the Validator.
Properties
$data
The data being validated.
public
array<string|int, mixed>
$data
$implicitAttributes
The implicit attributes.
public
array<string|int, mixed>
$implicitAttributes
= []
Methods
__construct()
Create a new validation rule parser.
public
__construct(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Return values
void —explode()
Parse the human-friendly rules into a full rules array for the validator.
public
explode(array<string|int, mixed> $rules) : stdClass
Parameters
- $rules : array<string|int, mixed>
Return values
stdClass —mergeRules()
Merge additional rules into a given attribute(s).
public
mergeRules(array<string|int, mixed> $results, string|array<string|int, mixed> $attribute[, string|array<string|int, mixed> $rules = [] ]) : array<string|int, mixed>
Parameters
- $results : array<string|int, mixed>
- $attribute : string|array<string|int, mixed>
- $rules : string|array<string|int, mixed> = []
Return values
array<string|int, mixed> —parse()
Extract the rule name and parameters from a rule.
public
static parse(array<string|int, mixed>|string $rules) : array<string|int, mixed>
Parameters
- $rules : array<string|int, mixed>|string
Return values
array<string|int, mixed> —explodeExplicitRule()
Explode the explicit rule into an array if necessary.
protected
explodeExplicitRule(mixed $rule) : array<string|int, mixed>
Parameters
- $rule : mixed
Return values
array<string|int, mixed> —explodeRules()
Explode the rules into an array of explicit rules.
protected
explodeRules(array<string|int, mixed> $rules) : array<string|int, mixed>
Parameters
- $rules : array<string|int, mixed>
Return values
array<string|int, mixed> —explodeWildcardRules()
Define a set of rules that apply to each element in an array attribute.
protected
explodeWildcardRules(array<string|int, mixed> $results, string $attribute, string|array<string|int, mixed> $rules) : array<string|int, mixed>
Parameters
- $results : array<string|int, mixed>
- $attribute : string
- $rules : string|array<string|int, mixed>
Return values
array<string|int, mixed> —mergeRulesForAttribute()
Merge additional rules into a given attribute.
protected
mergeRulesForAttribute(array<string|int, mixed> $results, string $attribute, string|array<string|int, mixed> $rules) : array<string|int, mixed>
Parameters
- $results : array<string|int, mixed>
- $attribute : string
- $rules : string|array<string|int, mixed>
Return values
array<string|int, mixed> —normalizeRule()
Normalizes a rule so that we can accept short types.
protected
static normalizeRule(string $rule) : string
Parameters
- $rule : string
Return values
string —parseArrayRule()
Parse an array based rule.
protected
static parseArrayRule(array<string|int, mixed> $rules) : array<string|int, mixed>
Parameters
- $rules : array<string|int, mixed>
Return values
array<string|int, mixed> —parseParameters()
Parse a parameter list.
protected
static parseParameters(string $rule, string $parameter) : array<string|int, mixed>
Parameters
- $rule : string
- $parameter : string
Return values
array<string|int, mixed> —parseStringRule()
Parse a string based rule.
protected
static parseStringRule(string $rules) : array<string|int, mixed>
Parameters
- $rules : string
Return values
array<string|int, mixed> —prepareRule()
Prepare the given rule for the Validator.
protected
prepareRule(mixed $rule) : mixed
Parameters
- $rule : mixed