PHP Class Thunder\Shortcode\Processor\Processor

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

Méthodes publiques

Méthode 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

Méthode 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 méthode

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 méthode

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
Résultat string

withAutoProcessContent() public méthode

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
Résultat self

withEventContainer() public méthode

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

withMaxIterations() public méthode

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
Résultat self

withRecursionDepth() public méthode

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
Résultat self