class Validator

Common validators.

Traits

Static class.

Properties

static array $messages

Methods

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

No description

static bool
validateEqual(IControl $control, $arg)

Is control's value equal with second parameter?

static bool
validateNotEqual(IControl $control, $arg)

Is control's value not equal with second parameter?

static bool
validateStatic(IControl $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(IControl $control, array $range)

Is a control's value number in specified range?

static bool
validateMin(IControl $control, $minimum)

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

static bool
validateMax(IControl $control, $maximum)

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

static bool
validateLength(IControl $control, $range)

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

static bool
validateMinLength(IControl $control, $length)

Has control's value minimal count/length?

static bool
validateMaxLength(IControl $control, $length)

Is control's value count/length in limit?

static bool
validateSubmitted(SubmitButton $control)

Has been button pressed?

static bool
validateEmail(IControl $control)

Is control's value valid email address?

static bool
validateUrl(IControl $control)

Is control's value valid URL?

static bool
validatePattern(IControl $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(IControl $control, string $pattern)

No description

static bool
validateNumeric(IControl $control)

Is a control's value numeric?

static bool
validateInteger(IControl $control)

Is a control's value decimal number?

static bool
validateFloat(IControl $control)

Is a control's value float number?

static bool
validateFileSize(UploadControl $control, $limit)

Is file size in limit?

static bool
validateMimeType(UploadControl $control, $mimeType)

Has file specified mime type?

static bool
validateImage(UploadControl $control)

Is file image?

Details

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

Parameters

Rule $rule
bool $withValue

at line 92
static bool validateEqual(IControl $control, $arg)

Is control's value equal with second parameter?

Parameters

IControl $control
$arg

Return Value

bool

at line 110
static bool validateNotEqual(IControl $control, $arg)

Is control's value not equal with second parameter?

Parameters

IControl $control
$arg

Return Value

bool

at line 119
static bool validateStatic(IControl $control, bool $arg)

Returns argument.

Parameters

IControl $control
bool $arg

Return Value

bool

at line 128
static bool validateFilled(BaseControl $control)

Is control filled?

Parameters

BaseControl $control

Return Value

bool

at line 137
static bool validateBlank(BaseControl $control)

Is control not filled?

Parameters

BaseControl $control

Return Value

bool

at line 146
static bool validateValid(BaseControl $control)

Is control valid?

Parameters

BaseControl $control

Return Value

bool

at line 155
static bool validateRange(IControl $control, array $range)

Is a control's value number in specified range?

Parameters

IControl $control
array $range

Return Value

bool

at line 167
static bool validateMin(IControl $control, $minimum)

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

Parameters

IControl $control
$minimum

Return Value

bool

at line 176
static bool validateMax(IControl $control, $maximum)

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

Parameters

IControl $control
$maximum

Return Value

bool

at line 186
static bool validateLength(IControl $control, $range)

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

Parameters

IControl $control
$range

Return Value

bool

at line 199
static bool validateMinLength(IControl $control, $length)

Has control's value minimal count/length?

Parameters

IControl $control
$length

Return Value

bool

at line 208
static bool validateMaxLength(IControl $control, $length)

Is control's value count/length in limit?

Parameters

IControl $control
$length

Return Value

bool

at line 217
static bool validateSubmitted(SubmitButton $control)

Has been button pressed?

Parameters

SubmitButton $control

Return Value

bool

at line 226
static bool validateEmail(IControl $control)

Is control's value valid email address?

Parameters

IControl $control

Return Value

bool

at line 235
static bool validateUrl(IControl $control)

Is control's value valid URL?

Parameters

IControl $control

Return Value

bool

at line 254
static bool validatePattern(IControl $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

IControl $control
string $pattern
bool $caseInsensitive

Return Value

bool

at line 267
static bool validatePatternCaseInsensitive(IControl $control, string $pattern)

Parameters

IControl $control
string $pattern

Return Value

bool

at line 276
static bool validateNumeric(IControl $control)

Is a control's value numeric?

Parameters

IControl $control

Return Value

bool

at line 285
static bool validateInteger(IControl $control)

Is a control's value decimal number?

Parameters

IControl $control

Return Value

bool

at line 300
static bool validateFloat(IControl $control)

Is a control's value float number?

Parameters

IControl $control

Return Value

bool

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

Is file size in limit?

Parameters

UploadControl $control
$limit

Return Value

bool

at line 329
static bool validateMimeType(UploadControl $control, $mimeType)

Has file specified mime type?

Parameters

UploadControl $control
$mimeType

Return Value

bool

at line 345
static bool validateImage(UploadControl $control)

Is file image?

Parameters

UploadControl $control

Return Value

bool