2declare(strict_types=1);
19 if (!preg_match(
'#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i',
$test, $matches)) {
20 throw new \InvalidArgumentException(sprintf(
'Don\'t understand "%s" as a date test.',
$test));
24 $date = new \DateTime($matches[2]);
26 }
catch (\Exception
$e) {
27 throw new \InvalidArgumentException(sprintf(
'"%s" is not a valid date.', $matches[2]));
An exception for terminatinating execution or to throw for unit testing.
setOperator(string $operator)
setTarget(string $target)
__construct(string $test)
DateComparator constructor.