| Conditions | 4 |
| Paths | 3 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 126 | public function parse(InlineParserContext $inlineContext): bool |
|
| 38 | { |
||
| 39 | 126 | $cursor = $inlineContext->getCursor(); |
|
| 40 | 126 | $nextChar = $cursor->peek(); |
|
| 41 | |||
| 42 | 126 | if ($nextChar === "\n") { |
|
| 43 | 15 | $cursor->advanceBy(2); |
|
| 44 | 15 | $inlineContext->getContainer()->appendChild(new Newline(Newline::HARDBREAK)); |
|
| 45 | |||
| 46 | 15 | return true; |
|
| 47 | 111 | } elseif ($nextChar !== null && RegexHelper::isEscapable($nextChar)) { |
|
| 48 | 90 | $cursor->advanceBy(2); |
|
| 49 | 90 | $inlineContext->getContainer()->appendChild(new Text($nextChar)); |
|
| 50 | |||
| 51 | 90 | return true; |
|
| 52 | } |
||
| 53 | |||
| 54 | 21 | $cursor->advanceBy(1); |
|
| 55 | 21 | $inlineContext->getContainer()->appendChild(new Text('\\')); |
|
| 56 | |||
| 57 | 21 | return true; |
|
| 58 | } |
||
| 59 | } |
||
| 60 |