You are here

interface TagsHeaderInterface in Purge 8.3

Describes a plugin that adds and formats a cache tags header on responses.

Hierarchy

Expanded class hierarchy of TagsHeaderInterface

All classes that implement TagsHeaderInterface

3 files declare their use of TagsHeaderInterface
ATagsHeader.php in tests/modules/purge_tagsheader_test/src/Plugin/Purge/TagsHeader/ATagsHeader.php
BTagsHeader.php in tests/modules/purge_tagsheader_test/src/Plugin/Purge/TagsHeader/BTagsHeader.php
CTagsHeader.php in tests/modules/purge_tagsheader_test/src/Plugin/Purge/TagsHeader/CTagsHeader.php

File

src/Plugin/Purge/TagsHeader/TagsHeaderInterface.php, line 11

Namespace

Drupal\purge\Plugin\Purge\TagsHeader
View source
interface TagsHeaderInterface extends PluginInspectionInterface, ContainerFactoryPluginInterface {

  /**
   * Fetch the HTTP response header name.
   *
   * @warning
   *   In RFC #6648 the use of 'X-' as header prefixes has been deprecated
   *   for "application protocols", this naturally includes Drupal. Therefore
   *   if this is possible, consider header names without this prefix.
   *
   * @throws \LogicException
   *   Thrown when the returned value isn't a string.
   *
   * @see \Drupal\purge\Annotation\PurgeTagsHeader::$header_name
   * @see http://tools.ietf.org/html/rfc6648
   *
   * @return string
   *   Name of the HTTP header to send out on responses.
   */
  public function getHeaderName();

  /**
   * Format the given cache tags for the header value representation.
   *
   * @param string[] $tags
   *   A set of cache tags.
   *
   * @throws \LogicException
   *   Thrown when the returned value isn't a string.
   *
   * @see \Drupal\Core\Cache\CacheableDependencyInterface::getCacheTags()
   *
   * @return string
   *   String representing the given headers.
   */
  public function getValue(array $tags);

  /**
   * Determine if this header should be added to the response.
   *
   * @return bool
   *   TRUE when the header should be added to responses, FALSE when not.
   */
  public function isEnabled();

}

Members

Namesort descending Modifiers Type Description Overrides
ContainerFactoryPluginInterface::create public static function Creates an instance of the plugin. 112
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
TagsHeaderInterface::getHeaderName public function Fetch the HTTP response header name. 1
TagsHeaderInterface::getValue public function Format the given cache tags for the header value representation. 1
TagsHeaderInterface::isEnabled public function Determine if this header should be added to the response. 1