| Conditions | 4 |
| Paths | 4 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.3398 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 2 | public function buildMediaInfoCommandRunner($filePath, array $configuration = []) |
|
| 19 | { |
||
| 20 | 2 | if (filter_var($filePath, FILTER_VALIDATE_URL) === false) { |
|
| 21 | 2 | $fileSystem = new Filesystem(); |
|
| 22 | |||
| 23 | 2 | if (!$fileSystem->exists($filePath)) { |
|
| 24 | 1 | throw new \Exception(sprintf('File "%s" does not exist', $filePath)); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | if (is_dir($filePath)) { |
|
| 28 | 1 | throw new \Exception(sprintf( |
|
| 29 | 1 | 'Expected a filename, got "%s", which is a directory', |
|
| 30 | 1 | $filePath |
|
| 31 | )); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | $configuration = $configuration + [ |
||
| 36 | 'command' => null, |
||
| 37 | 'use_oldxml_mediainfo_output_format' => false, |
||
| 38 | ]; |
||
| 39 | |||
| 40 | return new MediaInfoCommandRunner( |
||
| 41 | $filePath, |
||
| 42 | $configuration['command'], |
||
| 43 | null, |
||
| 44 | null, |
||
| 45 | $configuration['use_oldxml_mediainfo_output_format'] |
||
| 46 | ); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |