| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 6 | public function find(string $content): array |
|
| 16 | { |
||
| 17 | 6 | $texts = []; |
|
| 18 | 6 | foreach ($this->patterns as $pattern => $textPosition) { |
|
| 19 | 6 | preg_match_all($pattern, $content, $matches); |
|
| 20 | 6 | $matchesCount = count($matches[0]); |
|
| 21 | 6 | for ($i = 0; $i < $matchesCount; ++$i) { |
|
| 22 | 6 | $text = trim($matches[$textPosition][$i]); |
|
| 23 | 6 | if ($text === '') { |
|
| 24 | 4 | continue; |
|
| 25 | } |
||
| 26 | 6 | $texts[trim($matches[0][$i])] = $text; |
|
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | 6 | return $texts; |
|
| 31 | } |
||
| 33 |