PHP Class Bluz\Validator\Validator

Author: Anton Shevchuk
Show file Open project: bluzphp/framework Class Usage Examples

Protected Properties

Property Type Description
$error error text
$input input data
$invalid list of invalid rules
$name field name
$rules list of validation rules

Public Methods

Method 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

Protected Methods

Method Description
prepareError ( string $message ) : string Prepare error message for output

Method Details

__call() public method

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

__callStatic() public static method

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

__invoke() public method

Callable
public __invoke ( mixed $input ) : boolean
$input mixed
return boolean

__toString() public method

Cast to string
public __toString ( ) : string
return string

assert() public method

Assert
public assert ( mixed $input ) : boolean
$input mixed
return boolean

create() public static method

Create new instance if Validator
public static create ( ) : Validator
return Validator

getError() public method

Get error message
public getError ( ) : false | string
return false | string

getErrors() public method

Get all errors
public getErrors ( ) : string[]
return string[]

getInput() public method

Get input data
public getInput ( ) : string
return string

getName() public method

Get field Title
public getName ( ) : string
return string

isRequired() public method

Get required flag
public isRequired ( ) : boolean
return boolean

prepareError() protected method

Prepare error message for output
protected prepareError ( string $message ) : string
$message string
return string

setError() public method

Set error template for complex rule
public setError ( string $message ) : Validator
$message string
return Validator

setName() public method

Set field Title
public setName ( string $name ) : Validator
$name string
return Validator

validate() public method

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

Property Details

$error protected property

error text
protected $error

$input protected property

input data
protected $input

$invalid protected property

list of invalid rules
protected $invalid

$name protected property

field name
protected $name

$rules protected property

list of validation rules
protected $rules