| Conditions | 4 |
| Paths | 4 |
| Total Lines | 31 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 20 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 4 | public function parse() |
|
| 16 | { |
||
| 17 | 4 | $pos = $this->text->indexOf('^'); |
|
| 18 | 4 | if ($pos === false) |
|
| 19 | { |
||
| 20 | 1 | return; |
|
| 21 | } |
||
| 22 | |||
| 23 | 3 | preg_match_all( |
|
| 24 | 3 | '/\\^[^\\x17\\s]++/', |
|
| 25 | 3 | $this->text, |
|
| 26 | 3 | $matches, |
|
| 27 | 3 | PREG_OFFSET_CAPTURE, |
|
| 28 | 3 | $pos |
|
| 29 | ); |
||
| 30 | 3 | foreach ($matches[0] as list($match, $matchPos)) |
|
| 31 | { |
||
| 32 | 2 | $matchLen = strlen($match); |
|
| 33 | 2 | $startPos = $matchPos; |
|
| 34 | 2 | $endPos = $matchPos + $matchLen; |
|
| 35 | |||
| 36 | 2 | $parts = explode('^', $match); |
|
| 37 | 2 | unset($parts[0]); |
|
| 38 | |||
| 39 | 2 | foreach ($parts as $part) |
|
| 40 | { |
||
| 41 | 2 | $this->parser->addTagPair('SUP', $startPos, 1, $endPos, 0); |
|
| 42 | 2 | $startPos += 1 + strlen($part); |
|
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | } |