Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
MediaWikiSourceUrlNormalizer | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
normalize | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace FileImporter\Services; |
4 | |
5 | use FileImporter\Data\SourceUrl; |
6 | |
7 | /** |
8 | * A normalizer for SourceUrls that are known to point to any (3rd-party) MediaWiki installation. |
9 | * |
10 | * @license GPL-2.0-or-later |
11 | * @author Thiemo Kreuz |
12 | */ |
13 | class MediaWikiSourceUrlNormalizer implements SourceUrlNormalizer { |
14 | |
15 | /** |
16 | * @return SourceUrl |
17 | */ |
18 | public function normalize( SourceUrl $sourceUrl ) { |
19 | $url = $sourceUrl->getUrl(); |
20 | $url = str_replace( ' ', '_', $url ); |
21 | |
22 | return new SourceUrl( $url ); |
23 | } |
24 | |
25 | } |