Snaju Inception Docs

Validator
in package
implements ValidatorInterface

Interfaces, Classes and Traits

ValidatorInterface

Table of Contents

$data  : array<string|int, mixed>
$defaultRules  : Collection
$errors  : array<string|int, mixed>
$request  : WebRequest
$rules  : array<string|int, mixed>
$usesRequestData  : bool
__construct()  : mixed
addRule()  : mixed
Adds a ValidatorRule to use with the created Validator.
getErrors()  : array<string|int, mixed>
Returns all the errors in a multidimensional array with each error nested under the data field's name.
hasErrors()  : bool
validate()  : mixed
Validates a field's value using the provided ValidatorRule's map name.
addError()  : mixed
createRulesObjectFromString()  : object
expandDotSyntaxArrayKeys()  : array<string|int, mixed>
sendErrorResponse()  : mixed

Properties

$data

protected array<string|int, mixed> $data = []

$errors

protected array<string|int, mixed> $errors = []

$rules

protected array<string|int, mixed> $rules = []

$usesRequestData

protected bool $usesRequestData = true

Methods

__construct()

public __construct([array<string|int, mixed> $rules = [] ][, array<string|int, mixed> $data = [] ][, bool $sendErrorResponses = true ]) : mixed
Parameters
$rules : array<string|int, mixed> = []
$data : array<string|int, mixed> = []
$sendErrorResponses : bool = true
Return values
mixed

addRule()

Adds a ValidatorRule to use with the created Validator.

public addRule(string $identifier, mixed $rule) : mixed
Parameters
$identifier : string

The "map name" or name to reference this rule by.

$rule : mixed

The ValidatorRule's namespace (FQPN).

Return values
mixed

getErrors()

Returns all the errors in a multidimensional array with each error nested under the data field's name.

public getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasErrors()

public hasErrors() : bool
Return values
bool

validate()

Validates a field's value using the provided ValidatorRule's map name.

public validate([array<string|int, mixed> $data = [] ][, bool $sendErrorResponses = false ]) : mixed
Parameters
$data : array<string|int, mixed> = []
$sendErrorResponses : bool = false
Return values
mixed

addError()

protected addError(string $key, string $error) : mixed
Parameters
$key : string
$error : string
Return values
mixed

createRulesObjectFromString()

private createRulesObjectFromString(string $rulesString) : object
Parameters
$rulesString : string
Return values
object

expandDotSyntaxArrayKeys()

private expandDotSyntaxArrayKeys(array<string|int, mixed> $arr) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>
Tags
todo
Return values
array<string|int, mixed>

sendErrorResponse()

private sendErrorResponse() : mixed
Return values
mixed

Search results