| 1 | <?php |
||
| 15 | class InMemoryFileFetcher implements FileFetcher { |
||
| 16 | |||
| 17 | private $files; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string[] $files |
||
| 21 | * @throws InvalidArgumentException |
||
| 22 | */ |
||
| 23 | 3 | public function __construct( array $files ) { |
|
| 24 | 3 | foreach ( $files as $url => $fileContents ) { |
|
| 25 | 2 | if ( !is_string( $url ) || !is_string( $fileContents ) ) { |
|
| 26 | throw new InvalidArgumentException( 'Both file url and file contents need to be of type string' ); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | 3 | $this->files = $files; |
|
| 31 | 3 | } |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @see FileFetcher::fetchFile |
||
| 35 | * @throws FileFetchingException |
||
| 36 | */ |
||
| 37 | 3 | public function fetchFile( string $fileUrl ): string { |
|
| 44 | |||
| 45 | } |
||
| 46 |