CodeExplorer switchValidationIfToIsSmallerThanFrom example
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
)],
'fromTime' =>
[new NotBlank(),
new Regex(self::TIME_REGEX
)],
];
}