function DurationIso8601::getDuration

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php \Drupal\Core\TypedData\Plugin\DataType\DurationIso8601::getDuration()
  2. 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php \Drupal\Core\TypedData\Plugin\DataType\DurationIso8601::getDuration()
  3. 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php \Drupal\Core\TypedData\Plugin\DataType\DurationIso8601::getDuration()

Overrides DurationInterface::getDuration

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/DurationIso8601.php, line 23

Class

DurationIso8601
The duration ISO8601 data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getDuration() {
    if ($this->value) {
        // @todo Add support for negative intervals on top of the DateInterval
        // constructor.
        return new \DateInterval($this->value);
    }
}

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