Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
MatchWithValidator.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
16
class
MatchWithValidator
extends
ValidatorHasNotNull
{
17
protected
$field
;
18
public
static
?array
$values
;
19
20
public
function
__construct
() {
21
$this->message =
'This value should be equals to `{field}` content.'
;
22
}
23
24
public
function
validate
(
$value
) {
25
parent::validate (
$value
);
26
$values
= self::$values ?? $_POST;
27
if
($this->notNull !==
false
) {
28
return
$value
==
$values
[
$this->field
] ??
null
;
29
}
30
return
true
;
31
}
32
38
public
function
getParameters
(): array {
39
return [
'field'
,
'value'
];
40
}
41
47
public
function
asUI
(): array {
48
return \array_merge_recursive ( parent::asUI (), [
'rules'
=> [ [
'type'
=>
'match'
,
'prompt'
=> $this->_getMessage (),
'value'
=> $this->field ] ] ] );
49
}
50
}
51
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\MatchWithValidator
Ubiquity\contents\validation\validators\comparison$MatchWithValidator This class is part of Ubiquity.
Definition
MatchWithValidator.php:16
Ubiquity\contents\validation\validators\comparison\MatchWithValidator\getParameters
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}
Definition
MatchWithValidator.php:38
Ubiquity\contents\validation\validators\comparison\MatchWithValidator\__construct
__construct()
Definition
MatchWithValidator.php:20
Ubiquity\contents\validation\validators\comparison\MatchWithValidator\validate
validate($value)
Definition
MatchWithValidator.php:24
Ubiquity\contents\validation\validators\comparison\MatchWithValidator\$field
$field
Definition
MatchWithValidator.php:17
Ubiquity\contents\validation\validators\comparison\MatchWithValidator\asUI
asUI()
{}
Definition
MatchWithValidator.php:47
Ubiquity\contents\validation\validators\comparison\MatchWithValidator\$values
static array $values
Definition
MatchWithValidator.php:18
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
MatchWithValidator.php
Generated on Sun Dec 10 2023 15:04:15 for
Ubiquity
by
doxygen
1.9.8