PHP Class Jyxo\Input\Validator\Callback

Author: Ondřej Nešpor
Inheritance: extends AbstractValidator
Exibir arquivo Open project: jyxo/php

Public Methods

Method Description
__construct ( callable $callback ) Constructor.
getAdditionalParams ( ) : array Returns additional validation callback parameters.
getCallback ( ) : string | array | Closure Returns the validation callback.
isValid ( mixed $value ) : boolean Validates a value.
setAdditionalParams ( array $params = [] ) : self Sets additional validation callback parameters.
setCallback ( callable $callback ) : self Sets the validation callback.

Method Details

__construct() public method

Optinally accepts additional parameters that will be used as additional callback parameters. The validated value will allways be used as the callback's first parameter.
public __construct ( callable $callback )
$callback callable Validation callback

getAdditionalParams() public method

Returns additional validation callback parameters.
public getAdditionalParams ( ) : array
return array

getCallback() public method

Returns the validation callback.
public getCallback ( ) : string | array | Closure
return string | array | Closure

isValid() public method

Validates a value.
public isValid ( mixed $value ) : boolean
$value mixed Input value
return boolean

setAdditionalParams() public method

Sets additional validation callback parameters.
public setAdditionalParams ( array $params = [] ) : self
$params array Parameters array
return self

setCallback() public method

Sets the validation callback.
public setCallback ( callable $callback ) : self
$callback callable Validation callback
return self