*/ abstract class AbstractDateTimeValidator extends BasedValidator { /** * Create a validator */ public function __construct () { parent::__construct(new RegexValidator($this->getPattern())); } /** * @inheritDoc */ public function validate (mixed $value): bool { $this->getInternalValidator()->setPattern($this->getPattern()); return parent::validate($value); } /** * The date and/or time regex pattern * * @return string The date and/or time regex pattern */ protected abstract function getPattern (): string; /** * @inheritDoc */ public abstract function getValue (): DateTimeInterface; }