You are here

public function ParsedMarkdown::getExpire in Markdown 3.0.x

Retrieves the UNIX timestamp for when this object should expire.

Note: this method should handle the use case of a string being set to indicate a relative future time.

Parameters

int $from_time: A UNIX timestamp used to expire from. This will only be used when the expire value has been set to a relative time in the future, e.g. day, week, month, etc. If not set, this current request time will be used.

Return value

int The UNIX timestamp.

Overrides ParsedMarkdownInterface::getExpire

1 call to ParsedMarkdown::getExpire()
ParsedMarkdown::save in src/ParsedMarkdown.php
Caches a ParsedMarkdown object.

File

src/ParsedMarkdown.php, line 122

Class

ParsedMarkdown

Namespace

Drupal\markdown

Code

public function getExpire($from_time = NULL) {
  $expire = $this->expire;

  // Handle relative time.
  if (is_string($expire)) {
    $expire = strtotime($expire, $from_time ?: \Drupal::time()
      ->getRequestTime());
  }
  return $expire;
}