Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php |
||
26 | 3 | public function parse(ContextInterface $context, Cursor $cursor): bool |
|
27 | { |
||
28 | 3 | $placeholder = $this->config->get('table_of_contents/placeholder'); |
|
29 | 3 | if ($placeholder === null) { |
|
30 | return false; |
||
31 | } |
||
32 | |||
33 | // The placeholder must be the only thing on the line |
||
34 | 3 | if ($cursor->match('/^' . \preg_quote($placeholder, '/') . '$/') === null) { |
|
35 | 3 | return false; |
|
36 | } |
||
37 | |||
38 | 3 | $context->addBlock(new TableOfContentsPlaceholder()); |
|
39 | |||
40 | 3 | return true; |
|
41 | } |
||
42 | |||
48 |