Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| BelgaHomepageParser | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| extractArticleUrls | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Services\Parsers; |
| 4 | |
| 5 | class BelgaHomepageParser |
| 6 | { |
| 7 | /** |
| 8 | * @return array<int, string> |
| 9 | */ |
| 10 | public static function extractArticleUrls(string $html): array |
| 11 | { |
| 12 | preg_match_all('/href="(https:\/\/www\.belganewsagency\.eu\/[a-z0-9-]+)"/', $html, $matches); |
| 13 | |
| 14 | $urls = collect($matches[1]) |
| 15 | ->unique() |
| 16 | ->toArray(); |
| 17 | |
| 18 | return $urls; |
| 19 | } |
| 20 | } |