Total Complexity | 3 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | #[Attribute(Attribute::TARGET_PROPERTY)] |
||
12 | class Compare extends AbstractRule |
||
13 | { |
||
14 | const MESSAGE = 'Value should be %s `%s`'; |
||
15 | |||
16 | use Comparator; |
||
17 | |||
18 | public function __construct( |
||
19 | protected string $operator, |
||
20 | protected mixed $value, |
||
21 | ?string $message = null, |
||
22 | ?int $stopOnFailure = null, |
||
23 | ?int $priority = null |
||
24 | ) { |
||
25 | parent::__construct($message, $stopOnFailure, $priority); |
||
26 | } |
||
27 | |||
28 | public function isValid($input, array $context = []): bool |
||
29 | { |
||
30 | return $this->compare($input, $this->operator, $this->value); |
||
31 | } |
||
32 | |||
33 | public function translatedMessage(): ?string |
||
37 | } |
||
38 | } |
||
39 |