| 1 | <?php |
||
| 5 | class Callback implements ValidateRuleInterface |
||
| 6 | { |
||
| 7 | /** @var callable */ |
||
| 8 | protected $callable; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param callable $callable A PHP callable/callback. |
||
| 12 | */ |
||
| 13 | 15 | public function __construct(callable $callable) |
|
| 17 | |||
| 18 | /** |
||
| 19 | * Validates the value against a callable/callback. |
||
| 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 | 15 | public function __invoke($subject, string $field): bool |
|
| 30 | } |
||
| 31 |