Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 54c2336

Browse files
committed
chore: refactored Validator class
1 parent 1818f7e commit 54c2336

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

src/Validator.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
use ProgrammatorDev\Validator\Exception\UnexpectedValueException;
77
use ProgrammatorDev\Validator\Exception\ValidationException;
88
use ProgrammatorDev\Validator\Factory\Factory;
9+
use ProgrammatorDev\Validator\Rule\AbstractRule;
910
use ProgrammatorDev\Validator\Rule\RuleInterface;
1011

1112
/**
1213
* @mixin StaticValidatorInterface
1314
*/
14-
class Validator implements RuleInterface
15+
class Validator extends AbstractRule implements RuleInterface
1516
{
1617
/** @var RuleInterface[] */
1718
private array $rules;
@@ -59,18 +60,6 @@ public function assert(mixed $value, ?string $name = null): void
5960
}
6061
}
6162

62-
public function validate(mixed $value): bool
63-
{
64-
try {
65-
$this->assert($value);
66-
}
67-
catch (ValidationException) {
68-
return false;
69-
}
70-
71-
return true;
72-
}
73-
7463
public function getRules(): array
7564
{
7665
return $this->rules;

0 commit comments

Comments
 (0)