CollectionValidator
extends Validator
in package
Validate the collection options values. <br> Used for avoid client errors when creating or updating collections.
Tags
Table of Contents
Properties
- $canHave : array<string|int, mixed>
- Optional keys.
- $data : array<string|int, mixed>
- Data to validate.
- $required : array<string|int, mixed>
- Required keys.
Methods
- __construct() : mixed
- Validator constructor.
- rules() : array<string|int, mixed>
- Rules for validation.
- validate() : true
- Validate user data
- validateKeyOptions() : Closure
- Validate key options for collection creation
Properties
$canHave
Optional keys.
protected
array<string|int, mixed>
$canHave
= []
$data
Data to validate.
protected
array<string|int, mixed>
$data
= []
$required
Required keys.
protected
array<string|int, mixed>
$required
= ['name']
Methods
__construct()
Validator constructor.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
Attributes to validate.
rules()
Rules for validation.
public
rules() : array<string|int, mixed>
Return values
array<string|int, mixed>validate()
Validate user data
public
validate() : true
Tags
Return values
true —if validation is successful, throw an exception otherwise.
validateKeyOptions()
Validate key options for collection creation
private
static validateKeyOptions() : Closure