You are here

interface DurationServiceInterface in Duration Field 8

Same name and namespace in other branches
  1. 8.2 src/Service/DurationServiceInterface.php \Drupal\duration_field\Service\DurationServiceInterface
  2. 3.0.x src/Service/DurationServiceInterface.php \Drupal\duration_field\Service\DurationServiceInterface

Interface for classes providing services for the Duration Field module.

Hierarchy

Expanded class hierarchy of DurationServiceInterface

All classes that implement DurationServiceInterface

1 file declares its use of DurationServiceInterface
DurationWidget.php in src/Plugin/Field/FieldWidget/DurationWidget.php

File

src/Service/DurationServiceInterface.php, line 8

Namespace

Drupal\duration_field\Service
View source
interface DurationServiceInterface {

  /**
   * Checks if a given duration is a valid Iso8601 duration format.
   *
   * @input string $duration
   *   The string whose format should be checked
   *
   * @return bool
   *   - TRUE if the string is a valid format
   *   - FALSE if it's an invalid format
   *
   * @see http://en.wikipedia.org/wiki/Iso8601#Durations
   */
  public static function checkDurationInvalid($duration);

  /**
   * Convert array into PHP duration format.
   *
   * @param array $input
   *   An array containing any of the following keys:
   *   - year
   *   - month
   *   - day
   *   - hour
   *   - minute
   *   - second.
   *
   * @return string
   *   A string in Iso 8601 duration format
   *
   * @see http://en.wikipedia.org/wiki/Iso8601#Durations
   */
  public static function convertValue(array $input);

}

Members

Namesort descending Modifiers Type Description Overrides
DurationServiceInterface::checkDurationInvalid public static function Checks if a given duration is a valid Iso8601 duration format. 1
DurationServiceInterface::convertValue public static function Convert array into PHP duration format. 1