Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
LessThanOrEqualValidator.php
Go to the documentation of this file.
1<?php
2
4
6use Ajax\semantic\components\validation\CustomRule;
7
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\comparison$LessThanOrEqualValidator This class is part of Ubi...
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}