interface DurationInterface

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Type/DurationInterface.php \Drupal\Core\TypedData\Type\DurationInterface
  2. 8.9.x core/lib/Drupal/Core/TypedData/Type/DurationInterface.php \Drupal\Core\TypedData\Type\DurationInterface
  3. 10 core/lib/Drupal/Core/TypedData/Type/DurationInterface.php \Drupal\Core\TypedData\Type\DurationInterface

Interface for durations.

Hierarchy

Expanded class hierarchy of DurationInterface

All classes that implement DurationInterface

Related topics

4 files declare their use of DurationInterface
DurationIso8601.php in core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php
PrimitiveTypeConstraintValidator.php in core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidator.php
TimeSpan.php in core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php
TypedDataTest.php in core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php

File

core/lib/Drupal/Core/TypedData/Type/DurationInterface.php, line 10

Namespace

Drupal\Core\TypedData\Type
View source
interface DurationInterface {
  
  /**
   * Returns the duration.
   *
   * @return \DateInterval|null
   *   A DateInterval object or NULL if there is no duration.
   *
   * @throws \Exception
   */
  public function getDuration();
  
  /**
   * Returns the duration as an ISO 8601 ABNF string.
   *
   * @return string
   *   ABNF-formatted duration.
   *
   * @see https://datatracker.ietf.org/doc/html/rfc3339#appendix-A
   */
  public function getDurationAsIso8601Abnf() : string;
  
  /**
   * Sets the duration.
   *
   * @param \DateInterval $duration
   *   A duration to set.
   */
  public function setDuration(\DateInterval $duration);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
DurationInterface::getDuration public function Returns the duration. 2
DurationInterface::getDurationAsIso8601Abnf public function Returns the duration as an ISO 8601 ABNF string. 2
DurationInterface::setDuration public function Sets the duration. 2

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.