Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
GreaterThanValidator.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\contents\validation\validators\comparison
;
4
5
use
Ubiquity\contents\validation\validators\ValidatorHasNotNull
;
6
use Ajax\semantic\components\validation\CustomRule;
7
16
class
GreaterThanValidator
extends
ValidatorHasNotNull
{
17
protected
$ref
;
18
19
public
function
__construct
() {
20
$this->message =
'This value should be greater than `{ref}`'
;
21
}
22
23
public
function
validate
(
$value
) {
24
parent::validate (
$value
);
25
if
($this->notNull !==
false
) {
26
return
$value
>
$this->ref
;
27
}
28
return
true
;
29
}
30
36
public
function
getParameters
(): array {
37
return [
'ref'
,
'value'
];
38
}
39
45
public
function
asUI
(): array {
46
$rule = new CustomRule (
'greaterthan'
,
"function(v,greaterThan){ return v>greaterThan;}"
, $this->_getMessage (), $this->ref );
47
return \array_merge_recursive ( parent::asUI (), [
'rules'
=> [ $rule ] ] );
48
}
49
}
50
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\GreaterThanValidator
Ubiquity\contents\validation\validators\comparison$GreaterThanValidator This class is part of Ubiquit...
Definition
GreaterThanValidator.php:16
Ubiquity\contents\validation\validators\comparison\GreaterThanValidator\getParameters
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}
Definition
GreaterThanValidator.php:36
Ubiquity\contents\validation\validators\comparison\GreaterThanValidator\__construct
__construct()
Definition
GreaterThanValidator.php:19
Ubiquity\contents\validation\validators\comparison\GreaterThanValidator\validate
validate($value)
Definition
GreaterThanValidator.php:23
Ubiquity\contents\validation\validators\comparison\GreaterThanValidator\asUI
asUI()
{}
Definition
GreaterThanValidator.php:45
Ubiquity\contents\validation\validators\comparison\GreaterThanValidator\$ref
$ref
Definition
GreaterThanValidator.php:17
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
GreaterThanValidator.php
Generated on Sun Dec 10 2023 15:04:15 for
Ubiquity
by
doxygen
1.9.8