Conditions | 7 |
Paths | 4 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
23 | 1812 | public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart |
|
24 | { |
||
25 | 1812 | if ($cursor->isIndented() || $cursor->getNextNonSpaceCharacter() !== '<') { |
|
26 | 1569 | return BlockStart::none(); |
|
27 | } |
||
28 | |||
29 | 300 | $tmpCursor = clone $cursor; |
|
30 | 300 | $tmpCursor->advanceToNextNonSpaceOrTab(); |
|
31 | 300 | $line = $tmpCursor->getRemainder(); |
|
32 | |||
33 | 300 | for ($blockType = 1; $blockType <= 7; $blockType++) { |
|
34 | 300 | $match = RegexHelper::matchAt( |
|
35 | 300 | RegexHelper::getHtmlBlockOpenRegex($blockType), |
|
36 | 100 | $line |
|
37 | ); |
||
38 | |||
39 | 300 | if ($match !== null && ($blockType < 7 || !($parserState->getLastMatchedBlockParser()->getBlock() instanceof Paragraph))) { |
|
40 | 168 | return BlockStart::of(new HtmlBlockParser($blockType))->at($cursor); |
|
41 | } |
||
42 | } |
||
43 | |||
44 | 144 | return BlockStart::none(); |
|
45 | } |
||
46 | } |
||
47 |