protected
|
|
|
public static
static
|
#
factory( )
Factory method.
Returns
static static
|
|
public
mixed
|
#
add( string $type, null|string $message = null, mixed $option = null )
Adds a validator.
Parameters
- $type
- Validator type (any static method name of this class)
- $message
- Message which is used if this validator type does not match
- $option
- Type specific option
Returns
mixed $this
Throws
InvalidArgumentException InvalidArgumentException
|
|
public
boolean
|
#
isValid( string $value )
Checks whether the given value matches all added validators.
Checks whether the given value matches all added validators.
Parameters
Returns
boolean bool
|
|
public
string[]
|
#
getMessage( )
Returns the message.
Returns
string[] string[]
|
|
public
boolean
|
#
notEmpty( string $value )
Checks whether the value is not empty.
Checks whether the value is not empty.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
type( string $value, string $type )
Checks whether the value is from the given type.
Checks whether the value is from the given type.
Parameters
Returns
boolean bool
Throws
InvalidArgumentException InvalidArgumentException
|
|
public
boolean
|
#
minLength( string $value, integer $minLength )
Checks whether the value has the given min length.
Checks whether the value has the given min length.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
maxLength( string $value, integer $maxLength )
Checks whether the value has the given max value.
Checks whether the value has the given max value.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
min( string $value, integer $min )
Checks whether the value is equal or greater than the given min value.
Checks whether the value is equal or greater than the given min value.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
max( string $value, integer $max )
Checks whether the value is equal or lower than the given max value.
Checks whether the value is equal or lower than the given max value.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
url( string $value )
Checks whether the value is an URL.
Checks whether the value is an URL.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
email( string $value )
Checks whether the value is an email address.
Checks whether the value is an email address.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
match( string $value, string $regex )
Checks whether the value matches the given regex.
Checks whether the value matches the given regex.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
notMatch( string $value, string $regex )
Checks whether the value does not match the given regex.
Checks whether the value does not match the given regex.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
values( string $value, array $validValues )
Checks whether the value is one of the given valid values.
Checks whether the value is one of the given valid values.
Parameters
Returns
boolean bool
|
|
public
boolean
|
#
custom( string $value, callable $callback )
Checks the value by using the given callable.
Checks the value by using the given callable.
Parameters
Returns
boolean bool
|
|