Class rex_validator

Validator class.

rex_validator uses rex_factory_trait
Package: redaxo\core
Author: gharlan
Located at redaxo/src/core/lib/util/validator.php

Methods summary

protected
# __construct( )

Constructor.

public static static
# factory( )

Factory method.

public mixed
# add( string $type, null|string $message = null, mixed $option = null )

Adds a validator.

public boolean
# isValid( string $value )

Checks whether the given value matches all added validators.

public string[]
# getMessage( )

Returns the message.

public boolean
# notEmpty( string $value )

Checks whether the value is not empty.

public boolean
# type( string $value, string $type )

Checks whether the value is from the given type.

public boolean
# minLength( string $value, integer $minLength )

Checks whether the value has the given min length.

public boolean
# maxLength( string $value, integer $maxLength )

Checks whether the value has the given max value.

public boolean
# min( string $value, integer $min )

Checks whether the value is equal or greater than the given min value.

public boolean
# max( string $value, integer $max )

Checks whether the value is equal or lower than the given max value.

public boolean
# url( string $value )

Checks whether the value is an URL.

public boolean
# email( string $value )

Checks whether the value is an email address.

public boolean
# match( string $value, string $regex )

Checks whether the value matches the given regex.

public boolean
# notMatch( string $value, string $regex )

Checks whether the value does not match the given regex.

public boolean
# values( string $value, array $validValues )

Checks whether the value is one of the given valid values.

public boolean
# custom( string $value, callable $callback )

Checks the value by using the given callable.

Methods used from rex_factory_trait

callFactoryClass(), getFactoryClass(), hasFactoryClass(), setFactoryClass()