Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
15 | class EqualsValidator extends ValidatorHasNotNull { |
||
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 | |||
30 | /** |
||
31 | * |
||
32 | * {@inheritdoc} |
||
33 | * @see \Ubiquity\contents\validation\validators\Validator::getParameters() |
||
34 | */ |
||
35 | public function getParameters(): array { |
||
36 | return [ 'ref','value' ]; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * |
||
41 | * {@inheritdoc} |
||
42 | * @see \Ubiquity\contents\validation\validators\Validator::asUI() |
||
43 | */ |
||
44 | public function asUI(): array { |
||
46 | } |
||
47 | } |
||
48 | |||
49 |