You are here

protected function PhpDateIntervalConstraintValidator::isPhpDateIntervalObject in Duration Field 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Validation/Constraint/PhpDateIntervalConstraintValidator.php \Drupal\duration_field\Plugin\Validation\Constraint\PhpDateIntervalConstraintValidator::isPhpDateIntervalObject()

Test if the given value 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 value is a valid ISO 8601 Duration string. Otherwise FALSE.

1 call to PhpDateIntervalConstraintValidator::isPhpDateIntervalObject()
PhpDateIntervalConstraintValidator::validate in src/Plugin/Validation/Constraint/PhpDateIntervalConstraintValidator.php

File

src/Plugin/Validation/Constraint/PhpDateIntervalConstraintValidator.php, line 44

Class

PhpDateIntervalConstraintValidator
Validates the php_date_interval constraint.

Namespace

Drupal\duration_field\Plugin\Validation\Constraint

Code

protected function isPhpDateIntervalObject($value) {
  return is_object($value) && is_a($value, 'DateInterval');
}