| 1 | <?php | ||
| 5 | class InKeys implements ValidateRuleInterface | ||
| 6 | { | ||
| 7 | /** @var array */ | ||
| 8 | protected $array; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @param array $array An array of key-value pairs; the value must match one of the keys in this array. | ||
| 12 | */ | ||
| 13 | 42 | public function __construct(array $array) | |
| 17 | |||
| 18 | /** | ||
| 19 | * Validates that the value is a key in a given array. | ||
| 20 | * | ||
| 21 | * @param object $subject The subject to be filtered. | ||
| 22 | * @param string $field The subject field name. | ||
| 23 | * | ||
| 24 | * @return bool True if valid, false if not. | ||
| 25 | */ | ||
| 26 | 42 | public function __invoke($subject, string $field): bool | |
| 36 | } | ||
| 37 |