Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
LessThanValidator.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\contents\validation\validators\comparison
;
4
5
use Ajax\semantic\components\validation\CustomRule;
6
use Ajax\semantic\components\validation\Rule;
7
use
Ubiquity\contents\validation\validators\ValidatorHasNotNull
;
8
9
class
LessThanValidator
extends
ValidatorHasNotNull
{
10
protected
$ref
;
11
12
public
function
__construct
() {
13
$this->message =
'This value should be smaller than `{ref}`'
;
14
}
15
16
public
function
validate
(
$value
) {
17
parent::validate (
$value
);
18
if
($this->notNull !==
false
) {
19
return
$value
<
$this->ref
;
20
}
21
return
true
;
22
}
23
29
public
function
getParameters
(): array {
30
return [
'ref'
,
'value'
];
31
}
32
38
public
function
asUI
(): array {
39
$rule=new CustomRule(
'lessthan'
,
"function(v,lessThan){ return v<lessThan;}"
,$this->_getMessage(),$this->ref);
40
return \array_merge_recursive(parent::asUI () , [
'rules'
=>[$rule]]);
41
}
42
}
43
Ubiquity\contents\validation\validators\ValidatorHasNotNull
Definition
ValidatorHasNotNull.php:8
Ubiquity\contents\validation\validators\Validator\$value
$value
Definition
Validator.php:15
Ubiquity\contents\validation\validators\comparison\LessThanValidator
Definition
LessThanValidator.php:9
Ubiquity\contents\validation\validators\comparison\LessThanValidator\getParameters
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}
Definition
LessThanValidator.php:29
Ubiquity\contents\validation\validators\comparison\LessThanValidator\__construct
__construct()
Definition
LessThanValidator.php:12
Ubiquity\contents\validation\validators\comparison\LessThanValidator\validate
validate($value)
Definition
LessThanValidator.php:16
Ubiquity\contents\validation\validators\comparison\LessThanValidator\asUI
asUI()
{}
Definition
LessThanValidator.php:38
Ubiquity\contents\validation\validators\comparison\LessThanValidator\$ref
$ref
Definition
LessThanValidator.php:10
Ubiquity\contents\validation\validators\comparison
Definition
EqualsValidator.php:3
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
contents
validation
validators
comparison
LessThanValidator.php
Generated on Sun Dec 10 2023 15:04:15 for
Ubiquity
by
doxygen
1.9.8