PHP Класс yii\validators\StringValidator

Note, this validator should only be used with string-typed attributes.
С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends Validator
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$encoding the encoding of the string value to be validated (e.g. 'UTF-8'). If this property is not set, [[\yii\base\Application::charset]] will be used.
$length specifies the length limit of the value to be validated. This can be specified in one of the following forms: - an integer: the exact length that the value should be of; - an array of one element: the minimum length that the value should be of. For example, [8]. This will overwrite [[min]]. - an array of two elements: the minimum and maximum lengths that the value should be of. For example, [8, 128]. This will overwrite both [[min]] and [[max]].
$max maximum length. If not set, it means no maximum length limit.
$message user-defined error message used when the value is not a string.
$min minimum length. If not set, it means no minimum length limit.
$notEqual user-defined error message used when the length of the value is not equal to [[length]].
$tooLong user-defined error message used when the length of the value is greater than [[max]].
$tooShort user-defined error message used when the length of the value is smaller than [[min]].

Открытые методы

Метод Описание
clientValidateAttribute ( $model, $attribute, $view )
init ( )
validateAttribute ( $model, $attribute )

Защищенные методы

Метод Описание
validateValue ( $value )

Описание методов

clientValidateAttribute() публичный Метод

public clientValidateAttribute ( $model, $attribute, $view )

init() публичный Метод

public init ( )

validateAttribute() публичный Метод

public validateAttribute ( $model, $attribute )

validateValue() защищенный Метод

protected validateValue ( $value )

Описание свойств

$encoding публичное свойство

the encoding of the string value to be validated (e.g. 'UTF-8'). If this property is not set, [[\yii\base\Application::charset]] will be used.
public $encoding

$length публичное свойство

specifies the length limit of the value to be validated. This can be specified in one of the following forms: - an integer: the exact length that the value should be of; - an array of one element: the minimum length that the value should be of. For example, [8]. This will overwrite [[min]]. - an array of two elements: the minimum and maximum lengths that the value should be of. For example, [8, 128]. This will overwrite both [[min]] and [[max]].
См. также: tooShort for the customized message for a too short string.
См. также: tooLong for the customized message for a too long string.
См. также: notEqual for the customized message for a string that does not match desired length.
public $length

$max публичное свойство

maximum length. If not set, it means no maximum length limit.
См. также: tooLong for the customized message for a too long string.
public $max

$message публичное свойство

user-defined error message used when the value is not a string.
public $message

$min публичное свойство

minimum length. If not set, it means no minimum length limit.
См. также: tooShort for the customized message for a too short string.
public $min

$notEqual публичное свойство

user-defined error message used when the length of the value is not equal to [[length]].
public $notEqual

$tooLong публичное свойство

user-defined error message used when the length of the value is greater than [[max]].
public $tooLong

$tooShort публичное свойство

user-defined error message used when the length of the value is smaller than [[min]].
public $tooShort