| Conditions | 4 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 4.0039 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 93 | public function parse(InlineParserContext $inlineContext) |
|
| 38 | { |
||
| 39 | 93 | $cursor = $inlineContext->getCursor(); |
|
| 40 | 93 | if ($cursor->getCharacter() !== '\\') { |
|
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | 93 | $nextChar = $cursor->peek(); |
|
| 45 | |||
| 46 | 93 | if ($nextChar === "\n") { |
|
| 47 | 12 | $cursor->advanceBy(2); |
|
| 48 | 12 | $inlineContext->getContainer()->appendChild(new Newline(Newline::HARDBREAK)); |
|
| 49 | |||
| 50 | 12 | return true; |
|
| 51 | 81 | } elseif (RegexHelper::isEscapable($nextChar)) { |
|
| 52 | 69 | $cursor->advanceBy(2); |
|
| 53 | 69 | $inlineContext->getContainer()->appendChild(new Text($nextChar)); |
|
| 54 | |||
| 55 | 69 | return true; |
|
| 56 | } |
||
| 57 | |||
| 58 | 12 | $cursor->advance(); |
|
| 59 | 12 | $inlineContext->getContainer()->appendChild(new Text('\\')); |
|
| 60 | |||
| 61 | 12 | return true; |
|
| 62 | } |
||
| 63 | } |
||
| 64 |