docs depage-forms
Validators
Validators/Number.php
Go to the documentation of this file.
1
<?php
7
namespace
Depage\HtmlForm\Validators
;
8
12
class
Number
extends
Validator
13
{
21
public
function
validate
($value, $parameters = array())
22
{
23
$min = isset($parameters[
'min'
]) ? $parameters[
'min'
] :
null
;
24
$max = isset($parameters[
'max'
]) ? $parameters[
'max'
] :
null
;
25
26
return
is_numeric($value)
27
&& (($value >= $min) || ($min ===
null
))
28
&& (($value <= $max) || ($max ===
null
));
29
}
30
}
Depage\HtmlForm\Validators\Number
default validator for number input elements
Definition
Validators/Number.php:13
Depage\HtmlForm\Validators\Number\validate
validate($value, $parameters=array())
number validation
Definition
Validators/Number.php:21
Depage\HtmlForm\Validators\Validator
parent validator class
Definition
Validator.php:15
Depage\HtmlForm\Validators
Validators for HTML input-elements.