abstract class Iso8601StringConstraintValidatorBase 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
Provides a base for validating ISO 8601 String constraints.
Hierarchy
- class \Drupal\duration_field\Plugin\Validation\Constraint\Iso8601StringConstraintValidatorBase extends \Symfony\Component\Validator\ConstraintValidator
Expanded class hierarchy of Iso8601StringConstraintValidatorBase
File
- src/
Plugin/ Validation/ Constraint/ Iso8601StringConstraintValidatorBase.php, line 11
Namespace
Drupal\duration_field\Plugin\Validation\ConstraintView source
abstract class Iso8601StringConstraintValidatorBase extends ConstraintValidator {
/**
* Test if a string is a valid ISO 8601 duration string.
*
* @param mixed $value
* The item to check as an ISO 8601 duration string.
*
* @return bool
* TRUE if the given value is a valid ISO 8601 duration string. FALSE if it
* is not.
*/
protected function isIso8601String($value) {
if (is_string($value)) {
return preg_match(Iso8601StringInterface::DURATION_STRING_PATTERN, $value);
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Iso8601StringConstraintValidatorBase:: |
protected | function | Test if a string is a valid ISO 8601 duration string. |