// - That it is well formed (parse_url() returns FALSE if not).
// - That it contains a scheme (parse_url(, PHP_URL_SCHEME) returns NULL if
// not).
if ($typed_data instanceof UriInterface &&
in_array(parse_url($value, PHP_URL_SCHEME
),
[NULL, FALSE
], TRUE
)) { $valid = FALSE;
} // @todo: Move those to separate constraint validators.
try { if ($typed_data instanceof DateTimeInterface &&
$typed_data->
getDateTime() &&
$typed_data->
getDateTime()->
hasErrors()) { $valid = FALSE;
} if ($typed_data instanceof DurationInterface &&
$typed_data->
getDuration() && !
($typed_data->
getDuration() instanceof \DateInterval
)) { $valid = FALSE;
} } catch (\Exception
$e) { // Invalid durations or dates might throw exceptions.
$valid = FALSE;
} if (!
$valid) { // @todo: Provide a good violation message for each problem.
$this->context->
addViolation($constraint->message,
[