Bitrix API

LengthValidator extends Validator

Table of Contents

Methods

__construct()  : mixed
getMax()  : int|null
Returns maximum allowed length.
getMin()  : int|null
Returns minimum allowed length.
validate()  : bool|string
Checks minimum and/or maximum length (as string) of the value.

Methods

__construct()

public __construct([int|null $min = 1 ][, int|null $max = null ][, array<string|int, mixed> $errorPhrase = array('MIN' => null, 'MAX' => null) ]) : mixed
Parameters
$min : int|null = 1
$max : int|null = null
$errorPhrase : array<string|int, mixed> = array('MIN' => null, 'MAX' => null)
Tags
throws
ArgumentTypeException

getMax()

Returns maximum allowed length.

public getMax() : int|null

null if not set.

Return values
int|null

getMin()

Returns minimum allowed length.

public getMin() : int|null

null if not set.

Return values
int|null

validate()

Checks minimum and/or maximum length (as string) of the value.

public validate(mixed $value, array<string|int, mixed> $primary, array<string|int, mixed> $row, Field $field) : bool|string

Returns true if check was successful or string with error text otherwise.

Parameters
$value : mixed

Value to check.

$primary : array<string|int, mixed>

Has no use in this function.

$row : array<string|int, mixed>

Has no use in this function.

$field : Field

Field metadata.

Return values
bool|string

        
On this page

Search results