Parser
in package
This parser allows a developer to configure the application to validate the incoming data using expressions inside the docblocks (or any similar mechanism)
Tags
Table of Contents
- $rules : array<string|int, Closure>
- Contains a list of callable items that allow your application to instance ValidationRules from the expressions provided.
- __construct() : mixed
- Creates a new parser for validation expressions. These expressions allow to quickly provide the application with validation for input.
- parse() : ParseTree
- Parses the expression, extracting the Validator used to ensure that the data provided by the app's user is correct.
- rule() : mixed
- Sets a rule. If the rule already existed, it will be overwritten.
Properties
$rules
Contains a list of callable items that allow your application to instance ValidationRules from the expressions provided.
private
array<string|int, Closure>
$rules
= []
Methods
__construct()
Creates a new parser for validation expressions. These expressions allow to quickly provide the application with validation for input.
public
__construct() : mixed
Return values
mixed —parse()
Parses the expression, extracting the Validator used to ensure that the data provided by the app's user is correct.
public
parse(string $string) : ParseTree
Parameters
- $string : string
Return values
ParseTree —rule()
Sets a rule. If the rule already existed, it will be overwritten.
public
rule(string $name, Closure $callable) : mixed
Parameters
- $name : string
- $callable : Closure