| Conditions | 4 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 1420 | public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart |
|
| 24 | { |
||
| 25 | 1420 | if ($cursor->isIndented() || ! \in_array($cursor->getNextNonSpaceCharacter(), ['`', '~'], true)) { |
|
| 26 | 1298 | return BlockStart::none(); |
|
| 27 | } |
||
| 28 | |||
| 29 | 140 | $indent = $cursor->getIndent(); |
|
| 30 | 140 | $fence = $cursor->match('/^[ \t]*(?:`{3,}(?!.*`)|~{3,})/'); |
|
| 31 | 140 | if ($fence === null) { |
|
| 32 | 64 | return BlockStart::none(); |
|
| 33 | } |
||
| 34 | |||
| 35 | // fenced code block |
||
| 36 | 76 | $fence = \ltrim($fence, " \t"); |
|
| 37 | |||
| 38 | 76 | return BlockStart::of(new FencedCodeParser(\strlen($fence), $fence[0], $indent))->at($cursor); |
|
| 39 | } |
||
| 41 |