Factory
in package
implements
Factory
Interfaces, Classes and Traits
Table of Contents
- $container : Container
- The IoC container instance.
- $dependentExtensions : array<string|int, mixed>
- All of the custom dependent validator extensions.
- $extensions : array<string|int, mixed>
- All of the custom validator extensions.
- $fallbackMessages : array<string|int, mixed>
- All of the fallback messages for custom rules.
- $implicitExtensions : array<string|int, mixed>
- All of the custom implicit validator extensions.
- $replacers : array<string|int, mixed>
- All of the custom validator message replacers.
- $resolver : Closure
- The Validator resolver instance.
- $translator : Translator
- The Translator implementation.
- $verifier : PresenceVerifierInterface
- The Presence Verifier implementation.
- __construct() : void
- Create a new Validator factory instance.
- extend() : void
- Register a custom validator extension.
- extendDependent() : void
- Register a custom dependent validator extension.
- extendImplicit() : void
- Register a custom implicit validator extension.
- getPresenceVerifier() : PresenceVerifierInterface
- Get the Presence Verifier implementation.
- getTranslator() : Translator
- Get the Translator implementation.
- make() : Validator
- Create a new Validator instance.
- replacer() : void
- Register a custom validator message replacer.
- resolver() : void
- Set the Validator instance resolver.
- setPresenceVerifier() : void
- Set the Presence Verifier implementation.
- validate() : void
- Validate the given data against the provided rules.
- addExtensions() : void
- Add the extensions to a validator instance.
- resolve() : Validator
- Resolve a new Validator instance.
Properties
$container
The IoC container instance.
protected
Container
$container
$dependentExtensions
All of the custom dependent validator extensions.
protected
array<string|int, mixed>
$dependentExtensions
= []
$extensions
All of the custom validator extensions.
protected
array<string|int, mixed>
$extensions
= []
$fallbackMessages
All of the fallback messages for custom rules.
protected
array<string|int, mixed>
$fallbackMessages
= []
$implicitExtensions
All of the custom implicit validator extensions.
protected
array<string|int, mixed>
$implicitExtensions
= []
$replacers
All of the custom validator message replacers.
protected
array<string|int, mixed>
$replacers
= []
$resolver
The Validator resolver instance.
protected
Closure
$resolver
$translator
The Translator implementation.
protected
Translator
$translator
$verifier
The Presence Verifier implementation.
protected
PresenceVerifierInterface
$verifier
Methods
__construct()
Create a new Validator factory instance.
public
__construct(Translator $translator[, Container $container = null ]) : void
Parameters
- $translator : Translator
- $container : Container = null
Return values
void —extend()
Register a custom validator extension.
public
extend(string $rule, Closure|string $extension[, string $message = null ]) : void
Parameters
- $rule : string
- $extension : Closure|string
- $message : string = null
Return values
void —extendDependent()
Register a custom dependent validator extension.
public
extendDependent(string $rule, Closure|string $extension[, string $message = null ]) : void
Parameters
- $rule : string
- $extension : Closure|string
- $message : string = null
Return values
void —extendImplicit()
Register a custom implicit validator extension.
public
extendImplicit(string $rule, Closure|string $extension[, string $message = null ]) : void
Parameters
- $rule : string
- $extension : Closure|string
- $message : string = null
Return values
void —getPresenceVerifier()
Get the Presence Verifier implementation.
public
getPresenceVerifier() : PresenceVerifierInterface
Return values
PresenceVerifierInterface —getTranslator()
Get the Translator implementation.
public
getTranslator() : Translator
Return values
Translator —make()
Create a new Validator instance.
public
make(array<string|int, mixed> $data, array<string|int, mixed> $rules[, array<string|int, mixed> $messages = [] ][, array<string|int, mixed> $customAttributes = [] ]) : Validator
Parameters
- $data : array<string|int, mixed>
- $rules : array<string|int, mixed>
- $messages : array<string|int, mixed> = []
- $customAttributes : array<string|int, mixed> = []
Return values
Validator —replacer()
Register a custom validator message replacer.
public
replacer(string $rule, Closure|string $replacer) : void
Parameters
- $rule : string
- $replacer : Closure|string
Return values
void —resolver()
Set the Validator instance resolver.
public
resolver(Closure $resolver) : void
Parameters
- $resolver : Closure
Return values
void —setPresenceVerifier()
Set the Presence Verifier implementation.
public
setPresenceVerifier(PresenceVerifierInterface $presenceVerifier) : void
Parameters
- $presenceVerifier : PresenceVerifierInterface
Return values
void —validate()
Validate the given data against the provided rules.
public
validate(array<string|int, mixed> $data, array<string|int, mixed> $rules[, array<string|int, mixed> $messages = [] ][, array<string|int, mixed> $customAttributes = [] ]) : void
Parameters
- $data : array<string|int, mixed>
- $rules : array<string|int, mixed>
- $messages : array<string|int, mixed> = []
- $customAttributes : array<string|int, mixed> = []
Tags
Return values
void —addExtensions()
Add the extensions to a validator instance.
protected
addExtensions(Validator $validator) : void
Parameters
- $validator : Validator
Return values
void —resolve()
Resolve a new Validator instance.
protected
resolve(array<string|int, mixed> $data, array<string|int, mixed> $rules, array<string|int, mixed> $messages, array<string|int, mixed> $customAttributes) : Validator
Parameters
- $data : array<string|int, mixed>
- $rules : array<string|int, mixed>
- $messages : array<string|int, mixed>
- $customAttributes : array<string|int, mixed>