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