EqualId.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ListScreenRepository\Rule; |
| 6 | |
| 7 | use AC\ListScreenRepository\Rule; |
| 8 | use AC\Type\ListScreenId; |
| 9 | |
| 10 | class EqualId implements Rule |
| 11 | { |
| 12 | private ListScreenId $id; |
| 13 | |
| 14 | public function __construct(ListScreenId $id) |
| 15 | { |
| 16 | $this->id = $id; |
| 17 | } |
| 18 | |
| 19 | public function match(array $args): bool |
| 20 | { |
| 21 | if (! isset($args[self::ID])) { |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | return $this->id->equals($args[self::ID]); |
| 26 | } |
| 27 | |
| 28 | } |
| 29 |