CodeExplorer extractTime example
protected string
$toTime;
private bool
$validationTurnover = false;
private \DateTimeInterface
$to;
private \DateTimeInterface
$from;
public function match(RuleScope
$scope): bool
{ $now =
$scope->
getCurrentTime();
$this->from =
$this->
extractTime($this->fromTime,
$now);
$this->to =
$this->
extractTime($this->toTime,
$now);
$this->
switchValidationIfToIsSmallerThanFrom();
return $this->
returnResultWithSightOnValidationTurnover($now);
} public function getConstraints(): array
{ return [ 'toTime' =>
[new NotBlank(),
new Regex(self::TIME_REGEX
)],