PHP Class Overtrue\Validation\Factory

Exibir arquivo Open project: overtrue/validation

Protected Properties

Property Type Description
$extensions array All of the custom validator extensions.
$fallbackMessages array All of the fallback messages for custom rules.
$implicitExtensions array All of the custom implicit validator extensions.
$replacers array All of the custom validator message replacers.
$resolver Closure The Validator resolver instance.
$translator Overtrue\Validation\TranslatorInterface The Translator implementation.
$verifier Overtrue\Validation\PresenceVerifierInterface The Presence Verifier implementation.

Public Methods

Method Description
__construct ( Overtrue\Validation\TranslatorInterface $translator = null ) : Factory Create a new Validator factory instance.
extend ( string $rule, Closure | string $extension, string $message = null ) Register a custom validator extension.
extendImplicit ( string $rule, Closure | string $extension, string $message = null ) Register a custom implicit validator extension.
getPresenceVerifier ( ) : Overtrue\Validation\PresenceVerifierInterface Get the Presence Verifier implementation.
getTranslator ( ) : Overtrue\Validation\TranslatorInterface Get the Translator implementation.
make ( array $data, array $rules, array $messages = [], array $customAttributes = [] ) : Validator Create a new Validator instance.
replacer ( string $rule, Closure | string $replacer ) Register a custom implicit validator message replacer.
resolver ( Closure $resolver ) Set the Validator instance resolver.
setPresenceVerifier ( Overtrue\Validation\PresenceVerifierInterface $presenceVerifier ) Set the Presence Verifier implementation.

Protected Methods

Method Description
addExtensions ( Validator $validator ) Add the extensions to a validator instance.
resolve ( array $data, array $rules, array $messages, array $customAttributes ) : Validator Resolve a new Validator instance.

Method Details

__construct() public method

Create a new Validator factory instance.
public __construct ( Overtrue\Validation\TranslatorInterface $translator = null ) : Factory
$translator Overtrue\Validation\TranslatorInterface
return Factory

addExtensions() protected method

Add the extensions to a validator instance.
protected addExtensions ( Validator $validator )
$validator Validator

extend() public method

Register a custom validator extension.
public extend ( string $rule, Closure | string $extension, string $message = null )
$rule string
$extension Closure | string
$message string

extendImplicit() public method

Register a custom implicit validator extension.
public extendImplicit ( string $rule, Closure | string $extension, string $message = null )
$rule string
$extension Closure | string
$message string

getPresenceVerifier() public method

Get the Presence Verifier implementation.
public getPresenceVerifier ( ) : Overtrue\Validation\PresenceVerifierInterface
return Overtrue\Validation\PresenceVerifierInterface

getTranslator() public method

Get the Translator implementation.
public getTranslator ( ) : Overtrue\Validation\TranslatorInterface
return Overtrue\Validation\TranslatorInterface

make() public method

Create a new Validator instance.
public make ( array $data, array $rules, array $messages = [], array $customAttributes = [] ) : Validator
$data array
$rules array
$messages array
$customAttributes array
return Validator

replacer() public method

Register a custom implicit validator message replacer.
public replacer ( string $rule, Closure | string $replacer )
$rule string
$replacer Closure | string

resolve() protected method

Resolve a new Validator instance.
protected resolve ( array $data, array $rules, array $messages, array $customAttributes ) : Validator
$data array
$rules array
$messages array
$customAttributes array
return Validator

resolver() public method

Set the Validator instance resolver.
public resolver ( Closure $resolver )
$resolver Closure

setPresenceVerifier() public method

Set the Presence Verifier implementation.
public setPresenceVerifier ( Overtrue\Validation\PresenceVerifierInterface $presenceVerifier )
$presenceVerifier Overtrue\Validation\PresenceVerifierInterface

Property Details

$extensions protected_oe property

All of the custom validator extensions.
protected array $extensions
return array

$fallbackMessages protected_oe property

All of the fallback messages for custom rules.
protected array $fallbackMessages
return array

$implicitExtensions protected_oe property

All of the custom implicit validator extensions.
protected array $implicitExtensions
return array

$replacers protected_oe property

All of the custom validator message replacers.
protected array $replacers
return array

$resolver protected_oe property

The Validator resolver instance.
protected Closure $resolver
return Closure

$translator protected_oe property

The Translator implementation.
protected TranslatorInterface,Overtrue\Validation $translator
return Overtrue\Validation\TranslatorInterface

$verifier protected_oe property

The Presence Verifier implementation.
protected PresenceVerifierInterface,Overtrue\Validation $verifier
return Overtrue\Validation\PresenceVerifierInterface