Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
EqualsValidator.php
Go to the documentation of this file.
1<?php
2
4
6
16 protected $ref;
17
18 public function __construct() {
19 $this->message = 'This value should be equals to `{ref}`';
20 }
21
22 public function validate($value) {
23 parent::validate ( $value );
24 if ($this->notNull !== false) {
25 return $value == $this->ref;
26 }
27 return true;
28 }
29
35 public function getParameters(): array {
36 return [ 'ref','value' ];
37 }
38
44 public function asUI(): array {
45 return \array_merge_recursive ( parent::asUI (), [ 'rules' => [ [ 'type' => 'is','prompt' => $this->_getMessage (),'value' => $this->ref ] ] ] );
46 }
47}
48
Ubiquity\contents\validation\validators\comparison$EqualsValidator This class is part of Ubiquity.
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}