| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 36 | public function register(ConfigurableEnvironmentInterface $environment): void |
|
| 22 | { |
||
| 23 | 36 | $environment->addEventListener(DocumentParsedEvent::class, [new TableOfContentsBuilder(), 'onDocumentParsed'], -150); |
|
| 24 | |||
| 25 | 36 | if ($environment->getConfig('table_of_contents/position') === TableOfContentsBuilder::POSITION_PLACEHOLDER) { |
|
| 26 | 3 | $environment->addBlockStartParser(TableOfContentsPlaceholderParser::blockStartParser(), 200); |
|
| 27 | // If a placeholder cannot be replaced with a TOC element this renderer will ensure the parser won't error out |
||
| 28 | 3 | $environment->addRenderer(TableOfContentsPlaceholder::class, new TableOfContentsPlaceholderRenderer()); |
|
| 29 | } |
||
| 30 | 36 | } |
|
| 31 | } |
||
| 32 |