| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 5 | public function buildMediaInfoCommandRunner($filepath, array $configuration = array()) |
|
| 17 | { |
||
| 18 | 5 | if (filter_var($filepath, FILTER_VALIDATE_URL) === false) { |
|
| 19 | 4 | $fileSystem = new Filesystem(); |
|
| 20 | |||
| 21 | 4 | if (!$fileSystem->exists($filepath)) { |
|
| 22 | 1 | throw new \Exception(sprintf('File "%s" does not exist', $filepath)); |
|
| 23 | } |
||
| 24 | |||
| 25 | 3 | if (is_dir($filepath)) { |
|
| 26 | 1 | throw new \Exception(sprintf( |
|
| 27 | 1 | 'Expected a filename, got "%s", which is a directory', |
|
| 28 | $filepath |
||
| 29 | 1 | )); |
|
| 30 | } |
||
| 31 | 2 | } |
|
| 32 | |||
| 33 | $configuration = $configuration + array( |
||
| 34 | 3 | 'command' => null, |
|
| 35 | 3 | ); |
|
| 36 | |||
| 37 | 3 | return new MediaInfoCommandRunner($filepath, $configuration['command']); |
|
| 38 | } |
||
| 39 | } |
||
| 40 |