1<?php 2 3/* 4 * This file is part of the league/commonmark package. 5 * 6 * (c) Colin O'Dell <colinodell@gmail.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace League\CommonMark; 13 14use League\CommonMark\Block\Parser\BlockParserInterface; 15use League\CommonMark\Block\Renderer\BlockRendererInterface; 16use League\CommonMark\Delimiter\Processor\DelimiterProcessorCollection; 17use League\CommonMark\Event\AbstractEvent; 18use League\CommonMark\Inline\Parser\InlineParserInterface; 19use League\CommonMark\Inline\Renderer\InlineRendererInterface; 20 21interface EnvironmentInterface 22{ 23 const HTML_INPUT_STRIP = 'strip'; 24 const HTML_INPUT_ALLOW = 'allow'; 25 const HTML_INPUT_ESCAPE = 'escape'; 26 27 /** 28 * @param string|null $key 29 * @param mixed $default 30 * 31 * @return mixed 32 */ 33 public function getConfig($key = null, $default = null); 34 35 /** 36 * @return iterable<BlockParserInterface> 37 */ 38 public function getBlockParsers(): iterable; 39 40 /** 41 * @param string $character 42 * 43 * @return iterable<InlineParserInterface> 44 */ 45 public function getInlineParsersForCharacter(string $character): iterable; 46 47 /** 48 * @return DelimiterProcessorCollection 49 */ 50 public function getDelimiterProcessors(): DelimiterProcessorCollection; 51 52 /** 53 * @param string $blockClass 54 * 55 * @return iterable<BlockRendererInterface> 56 */ 57 public function getBlockRenderersForClass(string $blockClass): iterable; 58 59 /** 60 * @param string $inlineClass 61 * 62 * @return iterable<InlineRendererInterface> 63 */ 64 public function getInlineRenderersForClass(string $inlineClass): iterable; 65 66 /** 67 * Regex which matches any character which doesn't indicate an inline element 68 * 69 * This allows us to parse multiple non-special characters at once 70 * 71 * @return string 72 */ 73 public function getInlineParserCharacterRegex(): string; 74 75 /** 76 * Dispatches the given event to listeners 77 * 78 * @param AbstractEvent $event 79 * 80 * @return void 81 */ 82 public function dispatch(AbstractEvent $event): void; 83} 84