PHP Class Thunder\Shortcode\Processor\Processor

Author: Tomasz Kowalczyk ([email protected])
Inheritance: implements Thunder\Shortcode\Processor\ProcessorInterface
Show file Open project: thunderer/shortcode Class Usage Examples

Public Methods

Method Description
__construct ( Thunder\Shortcode\Parser\ParserInterface $parser, Thunder\Shortcode\HandlerContainer\HandlerContainerInterface $handlers ) automatically process shortcode content
process ( string $text ) : string Entry point for shortcode processing. Implements iterative algorithm for both limited and unlimited number of iterations.
withAutoProcessContent ( boolean $flag ) : self Whether shortcode content will be automatically processed and handler already receives shortcode with processed content. If false, every shortcode handler needs to process content on its own. Default true.
withEventContainer ( Thunder\Shortcode\EventContainer\EventContainerInterface $eventContainer ) : self Container for event handlers used in this processor.
withMaxIterations ( integer | null $iterations ) : self Maximum number of iterations, null means infinite, any integer greater than zero sets value. Zero is invalid because there must be at least one iteration. Defaults to 1. Loop breaks if result of two consequent iterations shows no change in processed text.
withRecursionDepth ( integer | null $depth ) : self Recursion depth level, null means infinite, any integer greater than or equal to zero sets value (number of recursion levels). Zero disables recursion. Defaults to null.

Private Methods

Method Description
applyReplaces ( $text, array $replaces )
dispatchEvent ( $name, $event )
processHandler ( Thunder\Shortcode\Shortcode\ParsedShortcodeInterface $parsed, Thunder\Shortcode\Processor\ProcessorContext $context, $handler )
processIteration ( $text, Thunder\Shortcode\Processor\ProcessorContext $context, Thunder\Shortcode\Shortcode\ProcessedShortcode $parent = null )
processRecursion ( Thunder\Shortcode\Shortcode\ParsedShortcodeInterface $shortcode, Thunder\Shortcode\Processor\ProcessorContext $context )

Method Details

__construct() public method

automatically process shortcode content
public __construct ( Thunder\Shortcode\Parser\ParserInterface $parser, Thunder\Shortcode\HandlerContainer\HandlerContainerInterface $handlers )
$parser Thunder\Shortcode\Parser\ParserInterface
$handlers Thunder\Shortcode\HandlerContainer\HandlerContainerInterface

process() public method

Entry point for shortcode processing. Implements iterative algorithm for both limited and unlimited number of iterations.
public process ( string $text ) : string
$text string Text to process
return string

withAutoProcessContent() public method

Whether shortcode content will be automatically processed and handler already receives shortcode with processed content. If false, every shortcode handler needs to process content on its own. Default true.
public withAutoProcessContent ( boolean $flag ) : self
$flag boolean True if enabled (default), false otherwise
return self

withEventContainer() public method

Container for event handlers used in this processor.
public withEventContainer ( Thunder\Shortcode\EventContainer\EventContainerInterface $eventContainer ) : self
$eventContainer Thunder\Shortcode\EventContainer\EventContainerInterface
return self

withMaxIterations() public method

Maximum number of iterations, null means infinite, any integer greater than zero sets value. Zero is invalid because there must be at least one iteration. Defaults to 1. Loop breaks if result of two consequent iterations shows no change in processed text.
public withMaxIterations ( integer | null $iterations ) : self
$iterations integer | null
return self

withRecursionDepth() public method

Recursion depth level, null means infinite, any integer greater than or equal to zero sets value (number of recursion levels). Zero disables recursion. Defaults to null.
public withRecursionDepth ( integer | null $depth ) : self
$depth integer | null
return self