Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
GreaterThanOrEqualValidator.php
Go to the documentation of this file.
1<?php
2
4
6use Ajax\semantic\components\validation\CustomRule;
7
9 protected $ref;
10
11 public function __construct() {
12 $this->message = 'This value should be greater or equal than `{ref}`';
13 }
14
15 public function validate($value) {
16 parent::validate ( $value );
17 if ($this->notNull !== false) {
18 return $value >= $this->ref;
19 }
20 return true;
21 }
22
28 public function getParameters(): array {
29 return [ 'ref','value' ];
30 }
31
37 public function asUI(): array {
38 $rule = new CustomRule ( 'greaterthanoreq', "function(v,gThan){ return v>=gThan;}", $this->_getMessage (), $this->ref );
39 return \array_merge_recursive ( parent::asUI (), [ 'rules' => [ $rule ] ] );
40 }
41}
42
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}