src/scenarios/validation/validator/EmailValidator.php 1 location
|
@@ 11-13 (lines=3) @@
|
| 8 |
|
|
| 9 |
|
public function validate($value, array $context = []): bool |
| 10 |
|
{ |
| 11 |
|
if ($this->skipOnEmpty and ($value === null || \trim($value) === '')) { |
| 12 |
|
return true; |
| 13 |
|
} |
| 14 |
|
if (!\is_string($value)) { |
| 15 |
|
return false; |
| 16 |
|
} |
src/scenarios/validation/validator/NumberValidator.php 1 location
|
@@ 47-49 (lines=3) @@
|
| 44 |
|
|
| 45 |
|
public function validate($value, array $context = []): bool |
| 46 |
|
{ |
| 47 |
|
if ($this->skipOnEmpty and ($value === null || \trim((string)$value) === '')) { |
| 48 |
|
return true; |
| 49 |
|
} |
| 50 |
|
if (!\preg_match($this->pattern, $this->normalizeNumber($value))) { |
| 51 |
|
return false; |
| 52 |
|
} |
src/scenarios/validation/validator/StringValidator.php 1 location
|
@@ 52-54 (lines=3) @@
|
| 49 |
|
|
| 50 |
|
public function validate($value, array $context = []): bool |
| 51 |
|
{ |
| 52 |
|
if ($this->skipOnEmpty and ($value === null || \trim($value) === '')) { |
| 53 |
|
return true; |
| 54 |
|
} |
| 55 |
|
if (!\is_string($value)) { |
| 56 |
|
return false; |
| 57 |
|
} |
src/scenarios/validation/validator/InValidator.php 1 location
|
@@ 29-31 (lines=3) @@
|
| 26 |
|
|
| 27 |
|
public function validate($value, array $context = []) : bool |
| 28 |
|
{ |
| 29 |
|
if ($this->skipOnEmpty and ($value === null || $value === [] || $value === '')) { |
| 30 |
|
return true; |
| 31 |
|
} |
| 32 |
|
if ($this->validSet instanceof \Closure) { |
| 33 |
|
$this->validSet = $this->validSet(); |
| 34 |
|
if (!\is_array($this->validSet) and !($this->validSet instanceof \Traversable)) { |