| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 22 | 16 | protected function parseInlineMarkup(string $str, string $regexp, string $tagName): void |
|
| 23 | { |
||
| 24 | 16 | $pos = $this->text->indexOf($str); |
|
| 25 | 16 | if ($pos === false) |
|
| 26 | { |
||
| 27 | 16 | return; |
|
| 28 | } |
||
| 29 | |||
| 30 | 14 | preg_match_all($regexp, $this->text, $matches, PREG_OFFSET_CAPTURE, $pos); |
|
| 31 | 14 | foreach ($matches[0] as [$match, $matchPos]) |
|
| 32 | { |
||
| 33 | 11 | $matchLen = strlen($match); |
|
| 34 | 11 | $endPos = $matchPos + $matchLen - 2; |
|
| 35 | |||
| 36 | 11 | $this->parser->addTagPair($tagName, $matchPos, 2, $endPos, 2); |
|
| 37 | 11 | $this->text->overwrite($matchPos, 2); |
|
| 38 | 11 | $this->text->overwrite($endPos, 2); |
|
| 39 | } |
||
| 41 | } |