Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
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 | } |
||
40 | } |
||
41 | } |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.