You are here

class TagProcessResult in Extensible BBCode 4.0.x

Same name and namespace in other branches
  1. 8.3 src/TagProcessResult.php \Drupal\xbbcode\TagProcessResult

Represents the output of a tag processor in a tree.

Hierarchy

Expanded class hierarchy of TagProcessResult

8 files declare their use of TagProcessResult
CodeTagPlugin.php in standard/src/Plugin/XBBCode/CodeTagPlugin.php
EntityTagPlugin.php in src/Plugin/XBBCode/EntityTagPlugin.php
NullTagPlugin.php in src/Plugin/XBBCode/NullTagPlugin.php
RenderTagPlugin.php in src/Plugin/RenderTagPlugin.php
TagPluginBase.php in src/Plugin/TagPluginBase.php

... See full list

File

src/TagProcessResult.php, line 11

Namespace

Drupal\xbbcode
View source
class TagProcessResult extends BubbleableMetadata implements OutputElementInterface {

  /**
   * Processed content.
   *
   * @var string
   */
  protected $processedText;

  /**
   * TagProcessResult constructor.
   *
   * @param string|null $processedText
   *   Processed content.
   */
  public function __construct(string $processedText = NULL) {
    $this->processedText = $processedText;
  }

  /**
   * Get processed content.
   *
   * @return string
   *   Processed content.
   */
  public function getProcessedText() : string {
    return $this->processedText;
  }

  /**
   * Set processed content.
   *
   * @param string $processedText
   *   Processed content.
   */
  public function setProcessedText(string $processedText) : void {
    $this->processedText = $processedText;
  }

  /**
   * Concatenate a sequence of results into one.
   *
   * @param \Drupal\xbbcode\TagProcessResult[] $children
   *   Sequence of tag process results.
   *
   * @return \Drupal\xbbcode\TagProcessResult
   *   The concatenated result with merged metadata.
   */
  public static function create(array $children) : TagProcessResult {
    $result = new TagProcessResult(implode('', $children));
    foreach ($children as $child) {
      $result = $result
        ->merge($child);
    }
    return $result;
  }

  /**
   * {@inheritdoc}
   */
  public function __toString() : string {
    return (string) $this->processedText;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AttachmentsTrait::$attachments protected property The attachments for this response.
AttachmentsTrait::addAttachments public function
AttachmentsTrait::getAttachments public function
AttachmentsTrait::setAttachments public function
BubbleableMetadata::addCacheableDependency public function Overrides RefinableCacheableDependencyTrait::addCacheableDependency
BubbleableMetadata::applyTo public function Applies the values of this bubbleable metadata object to a render array. Overrides CacheableMetadata::applyTo
BubbleableMetadata::createFromObject public static function Creates a bubbleable metadata object from a depended object. Overrides CacheableMetadata::createFromObject
BubbleableMetadata::createFromRenderArray public static function Creates a bubbleable metadata object with values taken from a render array. Overrides CacheableMetadata::createFromRenderArray
BubbleableMetadata::merge public function Creates a new bubbleable metadata object by merging this one with another. Overrides CacheableMetadata::merge
BubbleableMetadata::mergeAttachments public static function Merges two attachments arrays (which live under the '#attached' key).
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
CacheableMetadata::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
CacheableMetadata::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
CacheableMetadata::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
CacheableMetadata::setCacheContexts public function Sets cache contexts.
CacheableMetadata::setCacheMaxAge public function Sets the maximum age (in seconds).
CacheableMetadata::setCacheTags public function Sets cache tags.
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
TagProcessResult::$processedText protected property Processed content.
TagProcessResult::create public static function Concatenate a sequence of results into one.
TagProcessResult::getProcessedText public function Get processed content.
TagProcessResult::setProcessedText public function Set processed content.
TagProcessResult::__construct public function TagProcessResult constructor.
TagProcessResult::__toString public function Convert to string. Overrides OutputElementInterface::__toString