final class Validator

Common validators.

Properties

static $messages

Methods

static HtmlStringable
formatMessage(Rule $rule, bool $withValue = true)

No description

static bool
validateEqual(Control $control, $arg)

Is control's value equal with second parameter?

static bool
validateNotEqual(Control $control, $arg)

Is control's value not equal with second parameter?

static bool
validateStatic(Control $control, bool $arg)

Returns argument.

static bool
validateFilled(BaseControl $control)

Is control filled?

static bool
validateBlank(BaseControl $control)

Is control not filled?

static bool
validateValid(BaseControl $control)

Is control valid?

static bool
validateRange(Control $control, array $range)

Is a control's value number in specified range?

static bool
validateMin(Control $control, $minimum)

Is a control's value number greater than or equal to the specified minimum?

static bool
validateMax(Control $control, $maximum)

Is a control's value number less than or equal to the specified maximum?

static bool
validateLength(Control $control, array|int $range)

Count/length validator. Range is array, min and max length pair.

static bool
validateMinLength(Control $control, $length)

Has control's value minimal count/length?

static bool
validateMaxLength(Control $control, $length)

Is control's value count/length in limit?

static bool
validateSubmitted(SubmitButton $control)

Has been button pressed?

static bool
validateEmail(Control $control)

Is control's value valid email address?

static bool
validateUrl(Control $control)

Is control's value valid URL?

static bool
validatePattern(Control $control, string $pattern, bool $caseInsensitive = false)

Does the control's value match the regular expression? Case-sensitive to comply with the HTML5 pattern attribute behaviour

static bool
validatePatternCaseInsensitive(Control $control, string $pattern)

No description

static bool
validateNumeric(Control $control)

Is a control's value numeric?

static bool
validateInteger(Control $control)

Is a control's value decimal number?

static bool
validateFloat(Control $control)

Is a control's value float number?

static bool
validateFileSize(UploadControl $control, $limit)

Is file size in limit?

static bool
validateMimeType(UploadControl $control, string|string[] $mimeType)

Has file specified mime type?

static bool
validateImage(UploadControl $control)

Is file image?

Details

at line 52
static HtmlStringable formatMessage(Rule $rule, bool $withValue = true)

internal  
 

No description

Parameters

Rule $rule
bool $withValue

Return Value

HtmlStringable

at line 108
static bool validateEqual(Control $control, $arg)

Is control's value equal with second parameter?

Parameters

Control $control
$arg

Return Value

bool

at line 135
static bool validateNotEqual(Control $control, $arg)

Is control's value not equal with second parameter?

Parameters

Control $control
$arg

Return Value

bool

at line 144
static bool validateStatic(Control $control, bool $arg)

Returns argument.

Parameters

Control $control
bool $arg

Return Value

bool

at line 153
static bool validateFilled(BaseControl $control)

Is control filled?

Parameters

BaseControl $control

Return Value

bool

at line 162
static bool validateBlank(BaseControl $control)

Is control not filled?

Parameters

BaseControl $control

Return Value

bool

at line 171
static bool validateValid(BaseControl $control)

Is control valid?

Parameters

BaseControl $control

Return Value

bool

at line 180
static bool validateRange(Control $control, array $range)

Is a control's value number in specified range?

Parameters

Control $control
array $range

Return Value

bool

at line 190
static bool validateMin(Control $control, $minimum)

Is a control's value number greater than or equal to the specified minimum?

Parameters

Control $control
$minimum

Return Value

bool

at line 199
static bool validateMax(Control $control, $maximum)

Is a control's value number less than or equal to the specified maximum?

Parameters

Control $control
$maximum

Return Value

bool

at line 208
static bool validateLength(Control $control, array|int $range)

Count/length validator. Range is array, min and max length pair.

Parameters

Control $control
array|int $range

Return Value

bool

at line 222
static bool validateMinLength(Control $control, $length)

Has control's value minimal count/length?

Parameters

Control $control
$length

Return Value

bool

at line 231
static bool validateMaxLength(Control $control, $length)

Is control's value count/length in limit?

Parameters

Control $control
$length

Return Value

bool

at line 240
static bool validateSubmitted(SubmitButton $control)

Has been button pressed?

Parameters

SubmitButton $control

Return Value

bool

at line 249
static bool validateEmail(Control $control)

Is control's value valid email address?

Parameters

Control $control

Return Value

bool

at line 258
static bool validateUrl(Control $control)

Is control's value valid URL?

Parameters

Control $control

Return Value

bool

at line 279
static bool validatePattern(Control $control, string $pattern, bool $caseInsensitive = false)

Does the control's value match the regular expression? Case-sensitive to comply with the HTML5 pattern attribute behaviour

Parameters

Control $control
string $pattern
bool $caseInsensitive

Return Value

bool

at line 293
static bool validatePatternCaseInsensitive(Control $control, string $pattern)

No description

Parameters

Control $control
string $pattern

Return Value

bool

at line 302
static bool validateNumeric(Control $control)

Is a control's value numeric?

Parameters

Control $control

Return Value

bool

at line 313
static bool validateInteger(Control $control)

Is a control's value decimal number?

Parameters

Control $control

Return Value

bool

at line 330
static bool validateFloat(Control $control)

Is a control's value float number?

Parameters

Control $control

Return Value

bool

at line 349
static bool validateFileSize(UploadControl $control, $limit)

Is file size in limit?

Parameters

UploadControl $control
$limit

Return Value

bool

at line 365
static bool validateMimeType(UploadControl $control, string|string[] $mimeType)

Has file specified mime type?

Parameters

UploadControl $control
string|string[] $mimeType

Return Value

bool

at line 382
static bool validateImage(UploadControl $control)

Is file image?

Parameters

UploadControl $control

Return Value

bool

Traits

StaticClass