Conditions | 4 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | 75 | public function parse(InlineParserContext $inlineContext): bool |
|
33 | { |
||
34 | 75 | $container = $inlineContext->getContainer(); |
|
35 | 75 | $cursor = $inlineContext->getCursor(); |
|
36 | 75 | $nextChar = $cursor->peek(); |
|
37 | 75 | if ($nextChar !== '^') { |
|
38 | 18 | return false; |
|
39 | } |
||
40 | |||
41 | 63 | $state = $cursor->saveState(); |
|
42 | |||
43 | 63 | $m = $cursor->match('#\[\^([^\s\]]+)\]#'); |
|
44 | 63 | if ($m !== null) { |
|
45 | 60 | if (\preg_match('#\[\^([^\s\]]+)\]#', $m, $matches) > 0) { |
|
46 | 60 | $container->appendChild(new FootnoteRef($this->createReference($matches[1]))); |
|
47 | |||
48 | 60 | return true; |
|
49 | } |
||
50 | } |
||
51 | |||
52 | 3 | $cursor->restoreState($state); |
|
53 | |||
54 | 3 | return false; |
|
55 | } |
||
62 |