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