PHP Class Bluz\Validator\Validator

Author: Anton Shevchuk
Afficher le fichier Open project: bluzphp/framework Class Usage Examples

Protected Properties

Свойство Type Description
$error error text
$input input data
$invalid list of invalid rules
$name field name
$rules list of validation rules

Méthodes publiques

Méthode Description
__call ( string $ruleName, array $arguments ) : Validator Magic call for create new rule
__callStatic ( string $ruleName, array $arguments ) : Validator Magic static call for create instance of Validator
__invoke ( mixed $input ) : boolean Callable
__toString ( ) : string Cast to string
assert ( mixed $input ) : boolean Assert
create ( ) : Validator Create new instance if Validator
getError ( ) : false | string Get error message
getErrors ( ) : string[] Get all errors
getInput ( ) : string Get input data
getName ( ) : string Get field Title
isRequired ( ) : boolean Get required flag
setError ( string $message ) : Validator Set error template for complex rule
setName ( string $name ) : Validator Set field Title
validate ( mixed $input, boolean $all = false ) : boolean Validate chain of rules

Méthodes protégées

Méthode Description
prepareError ( string $message ) : string Prepare error message for output

Method Details

__call() public méthode

Magic call for create new rule
public __call ( string $ruleName, array $arguments ) : Validator
$ruleName string
$arguments array
Résultat Validator

__callStatic() public static méthode

Magic static call for create instance of Validator
public static __callStatic ( string $ruleName, array $arguments ) : Validator
$ruleName string
$arguments array
Résultat Validator

__invoke() public méthode

Callable
public __invoke ( mixed $input ) : boolean
$input mixed
Résultat boolean

__toString() public méthode

Cast to string
public __toString ( ) : string
Résultat string

assert() public méthode

Assert
public assert ( mixed $input ) : boolean
$input mixed
Résultat boolean

create() public static méthode

Create new instance if Validator
public static create ( ) : Validator
Résultat Validator

getError() public méthode

Get error message
public getError ( ) : false | string
Résultat false | string

getErrors() public méthode

Get all errors
public getErrors ( ) : string[]
Résultat string[]

getInput() public méthode

Get input data
public getInput ( ) : string
Résultat string

getName() public méthode

Get field Title
public getName ( ) : string
Résultat string

isRequired() public méthode

Get required flag
public isRequired ( ) : boolean
Résultat boolean

prepareError() protected méthode

Prepare error message for output
protected prepareError ( string $message ) : string
$message string
Résultat string

setError() public méthode

Set error template for complex rule
public setError ( string $message ) : Validator
$message string
Résultat Validator

setName() public méthode

Set field Title
public setName ( string $name ) : Validator
$name string
Résultat Validator

validate() public méthode

Validate chain of rules
public validate ( mixed $input, boolean $all = false ) : boolean
$input mixed
$all boolean
Résultat boolean

Property Details

$error protected_oe property

error text
protected $error

$input protected_oe property

input data
protected $input

$invalid protected_oe property

list of invalid rules
protected $invalid

$name protected_oe property

field name
protected $name

$rules protected_oe property

list of validation rules
protected $rules