Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
15 | 6 | public function parse() |
|
16 | { |
||
17 | 6 | $pos = $this->text->indexOf('>!'); |
|
18 | 6 | if ($pos === false) |
|
19 | { |
||
20 | 1 | return; |
|
21 | } |
||
22 | |||
23 | 5 | preg_match_all('/>![^\\x17]+?!</', $this->text, $matches, PREG_OFFSET_CAPTURE, $pos); |
|
24 | 5 | foreach ($matches[0] as list($match, $matchPos)) |
|
25 | { |
||
26 | 4 | $matchLen = strlen($match); |
|
27 | 4 | $endPos = $matchPos + $matchLen - 2; |
|
28 | |||
29 | 4 | $this->parser->addTagPair('ISPOILER', $matchPos, 2, $endPos, 2); |
|
30 | 4 | $this->text->overwrite($matchPos, 2); |
|
31 | 4 | $this->text->overwrite($endPos, 2); |
|
32 | } |
||
33 | } |
||
34 | } |