Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
15 | 263 | public function parse() |
|
16 | { |
||
17 | 263 | if ($this->text->indexOf(']:') === false) |
|
18 | 263 | { |
|
19 | 237 | return; |
|
20 | } |
||
21 | |||
22 | 26 | $regexp = '/^\\x1A* {0,3}\\[([^\\x17\\]]+)\\]: *([^\\s\\x17]+ *(?:"[^\\x17]*?"|\'[^\\x17]*?\'|\\([^\\x17)]*\\))?)[^\\x17\\n]*\\n?/m'; |
|
23 | 26 | preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); |
|
24 | 26 | foreach ($matches as $m) |
|
25 | { |
||
26 | 26 | $this->parser->addIgnoreTag($m[0][1], strlen($m[0][0]), -2); |
|
27 | |||
28 | // Only add the reference if it does not already exist |
||
29 | 26 | $id = strtolower($m[1][0]); |
|
30 | 26 | if (!isset($this->text->linkReferences[$id])) |
|
31 | 26 | { |
|
32 | 26 | $this->text->hasReferences = true; |
|
33 | 26 | $this->text->linkReferences[$id] = $m[2][0]; |
|
34 | 26 | } |
|
35 | 26 | } |
|
36 | } |
||
37 | } |