You are here

abstract class TagProcessorBase in Extensible BBCode 4.0.x

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

Base tag processor for wrapping the output.

@package Drupal\xbbcode\Parser

Hierarchy

Expanded class hierarchy of TagProcessorBase

File

src/Parser/Processor/TagProcessorBase.php, line 14

Namespace

Drupal\xbbcode\Parser\Processor
View source
abstract class TagProcessorBase implements TagProcessorInterface {

  /**
   * {@inheritdoc}
   */
  public function process(TagElementInterface $tag) : OutputElementInterface {
    $output = $this
      ->doProcess($tag);
    if (!$output instanceof OutputElementInterface) {
      $output = new OutputElement((string) $output);
    }
    return $output;
  }

  /**
   * Override this function to return any printable value.
   *
   * @param \Drupal\xbbcode\Parser\Tree\TagElementInterface $tag
   *   Tag element in the parse tree.
   *
   * @return mixed
   *   Any value that can be cast to string.
   */
  public abstract function doProcess(TagElementInterface $tag);

}

Members

Namesort descending Modifiers Type Description Overrides
TagProcessorBase::doProcess abstract public function Override this function to return any printable value. 1
TagProcessorBase::process public function Process a tag match. Overrides TagProcessorInterface::process