MapsFileFetcher::fetchFile()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 5
cp 0.8
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.032
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\DataAccess;
6
7
use FileFetcher\FileFetcher;
8
use FileFetcher\FileFetchingException;
9
10
/**
11
 * @licence GNU GPL v2+
12
 * @author Jeroen De Dauw < [email protected] >
13
 */
14
class MapsFileFetcher implements FileFetcher {
15
16 2
	public function fetchFile( string $fileUrl ): string {
17 2
		$result = \Http::get( $fileUrl );
18
19 2
		if ( !is_string( $result ) ) {
20
			throw new FileFetchingException( $fileUrl );
21
		}
22
23 2
		return $result;
24
	}
25
26
}
27