Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
34 | 14 | private function findTexts(string $pattern, string $content, int $textPosition): array |
|
35 | { |
||
36 | 14 | $texts = []; |
|
37 | 14 | preg_match_all($pattern, $content, $matches); |
|
38 | 14 | $matchesCount = count($matches[0]); |
|
39 | 14 | for ($i = 0; $i < $matchesCount; ++$i) { |
|
40 | 14 | $text = trim($matches[$textPosition][$i]); |
|
41 | 14 | if ($text === '') { |
|
42 | 8 | continue; |
|
43 | } |
||
44 | 14 | $texts[trim($matches[0][$i])] = $text; |
|
45 | } |
||
46 | 14 | return $texts; |
|
47 | } |
||
49 |