protected function Iso8601StringConstraintValidatorBase::isIso8601String in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 src/Plugin/Validation/Constraint/Iso8601StringConstraintValidatorBase.php \Drupal\duration_field\Plugin\Validation\Constraint\Iso8601StringConstraintValidatorBase::isIso8601String()
Test if a string is a valid ISO 8601 duration string.
Parameters
mixed $value: The item to check as an ISO 8601 duration string.
Return value
bool TRUE if the given value is a valid ISO 8601 duration string. FALSE if it is not.
2 calls to Iso8601StringConstraintValidatorBase::isIso8601String()
- Iso8601StringConstraintValidator::validate in src/
Plugin/ Validation/ Constraint/ Iso8601StringConstraintValidator.php - PhpDateIntervalConstraintValidator::validate in src/
Plugin/ Validation/ Constraint/ PhpDateIntervalConstraintValidator.php
File
- src/
Plugin/ Validation/ Constraint/ Iso8601StringConstraintValidatorBase.php, line 23
Class
- Iso8601StringConstraintValidatorBase
- Provides a base for validating ISO 8601 String constraints.
Namespace
Drupal\duration_field\Plugin\Validation\ConstraintCode
protected function isIso8601String($value) {
if (is_string($value)) {
return preg_match(Iso8601StringInterface::DURATION_STRING_PATTERN, $value);
}
return FALSE;
}