You are here

interface ParsedMarkdownInterface in Markdown 8.2

Interface parsed markdown instances.

Hierarchy

Expanded class hierarchy of ParsedMarkdownInterface

All classes that implement ParsedMarkdownInterface

2 files declare their use of ParsedMarkdownInterface
Markdown.php in src/Markdown.php
MarkdownInterface.php in src/MarkdownInterface.php

File

src/Render/ParsedMarkdownInterface.php, line 14

Namespace

Drupal\markdown\Render
View source
interface ParsedMarkdownInterface extends \Countable, \Serializable, MarkupInterface, RefinableCacheableDependencyInterface {

  /**
   * Indicates the item should never be removed unless explicitly deleted.
   */
  const PERMANENT = CacheBackendInterface::CACHE_PERMANENT;

  /**
   * Creates new ParsedMarkdown object.
   *
   * @param string $markdown
   *   The raw markdown.
   * @param string $html
   *   The parsed HTML from $markdown.
   * @param \Drupal\Core\Language\LanguageInterface|null $language
   *   The language of the parsed markdown, if known.
   *
   * @return static
   */
  public static function create($markdown = '', $html = '', LanguageInterface $language = NULL);

  /**
   * Normalizes markdown.
   *
   * @param string $markdown
   *   The markdown to normalize.
   *
   * @return string
   *   The normalized markdown.
   */
  public static function normalizeMarkdown($markdown);

  /**
   * 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.
   *
   * @param 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 int
   *   The UNIX timestamp.
   */
  public function getExpire($from_time = NULL);

  /**
   * Retrieves the parsed HTML.
   *
   * @return string
   *   The parsed HTML.
   */
  public function getHtml();

  /**
   * Retrieves the identifier for this object.
   *
   * Note: if no identifier is currently set, a unique hash based on the
   * contents of the parsed HTML will be used.
   *
   * @return string
   *   The identifier for this object.
   */
  public function getId();

  /**
   * Retrieves the human-readable label for this object.
   *
   * Note: if no label is currently set, the identifier for the object is
   * returned instead.
   *
   * @return string
   *   The label for this object.
   */
  public function getLabel();

  /**
   * Retrieves the raw markdown source.
   *
   * @return string
   *   The markdown source.
   */
  public function getMarkdown();

  /**
   * Retrieves the file size of the parsed HTML.
   *
   * @param bool $formatted
   *   Flag indicating whether to retrieve the formatted, human-readable,
   *   file size.
   * @param int $decimals
   *   The number of decimal points to use if $formatted is TRUE.
   *
   * @return int|string
   *   The raw file size in bytes or the formatted human-readable file size.
   */
  public function getSize($formatted = FALSE, $decimals = 2);

  /**
   * Compares whether the provided markdown matches this object.
   *
   * @param string|\Drupal\markdown\Render\ParsedMarkdownInterface $markdown
   *   An external markdown source.
   *
   * @return bool
   *   TRUE or FALSE
   */
  public function matches($markdown);

  /**
   * Sets the object's expiration timestamp.
   *
   * @param int|string $expire
   *   A UNIX timestamp or a string indicating a relative time in the future of
   *   when this object is to expire, e.g. "1+ day".
   *
   * @return static
   */
  public function setExpire($expire = Cache::PERMANENT);

  /**
   * Sets the object's identifier.
   *
   * @param string $id
   *   An identifier.
   *
   * @return static
   */
  public function setId($id);

  /**
   * Sets the object's label.
   *
   * @param string $label
   *   A human-readable label.
   *
   * @return static
   */
  public function setLabel($label);

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyInterface::getCacheContexts public function The cache contexts associated with this object. 34
CacheableDependencyInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 34
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 27
MarkupInterface::__toString public function Returns markup. 4
ParsedMarkdownInterface::create public static function Creates new ParsedMarkdown object. 1
ParsedMarkdownInterface::getExpire public function Retrieves the UNIX timestamp for when this object should expire. 1
ParsedMarkdownInterface::getHtml public function Retrieves the parsed HTML. 1
ParsedMarkdownInterface::getId public function Retrieves the identifier for this object. 1
ParsedMarkdownInterface::getLabel public function Retrieves the human-readable label for this object. 1
ParsedMarkdownInterface::getMarkdown public function Retrieves the raw markdown source. 1
ParsedMarkdownInterface::getSize public function Retrieves the file size of the parsed HTML. 1
ParsedMarkdownInterface::matches public function Compares whether the provided markdown matches this object. 1
ParsedMarkdownInterface::normalizeMarkdown public static function Normalizes markdown. 1
ParsedMarkdownInterface::PERMANENT constant Indicates the item should never be removed unless explicitly deleted.
ParsedMarkdownInterface::setExpire public function Sets the object's expiration timestamp. 1
ParsedMarkdownInterface::setId public function Sets the object's identifier. 1
ParsedMarkdownInterface::setLabel public function Sets the object's label. 1
RefinableCacheableDependencyInterface::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. 1
RefinableCacheableDependencyInterface::addCacheContexts public function Adds cache contexts. 1
RefinableCacheableDependencyInterface::addCacheTags public function Adds cache tags. 1
RefinableCacheableDependencyInterface::mergeCacheMaxAge public function Merges the maximum age (in seconds) with the existing maximum age. 1