Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
25.00% |
1 / 4 |
|
25.00% |
1 / 4 |
CRAP | |
0.00% |
0 / 1 |
| BelgaHomepageParserAdapter | |
25.00% |
1 / 4 |
|
25.00% |
1 / 4 |
10.75 | |
0.00% |
0 / 1 |
| canParse | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| extractArticleUrls | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getHomepageUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getSourceName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Services\Parsers; |
| 4 | |
| 5 | use App\Contracts\HomepageParserInterface; |
| 6 | |
| 7 | class BelgaHomepageParserAdapter implements HomepageParserInterface |
| 8 | { |
| 9 | public function canParse(string $url): bool |
| 10 | { |
| 11 | return str_contains($url, 'belganewsagency.eu'); |
| 12 | } |
| 13 | |
| 14 | public function extractArticleUrls(string $html): array |
| 15 | { |
| 16 | return BelgaHomepageParser::extractArticleUrls($html); |
| 17 | } |
| 18 | |
| 19 | public function getHomepageUrl(): string |
| 20 | { |
| 21 | return 'https://www.belganewsagency.eu/'; |
| 22 | } |
| 23 | |
| 24 | public function getSourceName(): string |
| 25 | { |
| 26 | return 'Belga News Agency'; |
| 27 | } |
| 28 | } |