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