Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
LessThanOrEqualValidator.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
LessThanOrEqualValidator
extends
ValidatorHasNotNull
{
17
protected
$ref
;
18
19
public
function
__construct
() {
20
$this->message =
'This value should be less or equal 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 (
'lessthanoreq'
,
"function(v,lessThan){ return v<=lessThan;}"
, $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\LessThanOrEqualValidator
Ubiquity\contents\validation\validators\comparison$LessThanOrEqualValidator This class is part of Ubi...
Definition
LessThanOrEqualValidator.php:16
Ubiquity\contents\validation\validators\comparison\LessThanOrEqualValidator\getParameters
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}
Definition
LessThanOrEqualValidator.php:36
Ubiquity\contents\validation\validators\comparison\LessThanOrEqualValidator\__construct
__construct()
Definition
LessThanOrEqualValidator.php:19
Ubiquity\contents\validation\validators\comparison\LessThanOrEqualValidator\validate
validate($value)
Definition
LessThanOrEqualValidator.php:23
Ubiquity\contents\validation\validators\comparison\LessThanOrEqualValidator\asUI
asUI()
{}
Definition
LessThanOrEqualValidator.php:45
Ubiquity\contents\validation\validators\comparison\LessThanOrEqualValidator\$ref
$ref
Definition
LessThanOrEqualValidator.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
LessThanOrEqualValidator.php
Generated on Sun Dec 10 2023 15:04:15 for
Ubiquity
by
doxygen
1.9.8