Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4.0119 |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | 4 | public function buildMediaInfoCommandRunner($filepath, array $configuration = array()) |
|
17 | { |
||
18 | 4 | if (filter_var($filepath, FILTER_VALIDATE_URL) === false) { |
|
19 | 3 | $fileSystem = new Filesystem(); |
|
20 | |||
21 | 3 | if (!$fileSystem->exists($filepath)) { |
|
22 | 1 | throw new \Exception('File doesn\'t exist'); |
|
23 | } |
||
24 | |||
25 | 2 | if (is_dir($filepath)) { |
|
26 | throw new \Exception('You must specify a filename, not a directory name'); |
||
27 | } |
||
28 | 2 | } |
|
29 | |||
30 | $configuration = $configuration + array( |
||
31 | 3 | 'command' => null, |
|
32 | 3 | ); |
|
33 | |||
34 | 3 | return new MediaInfoCommandRunner($filepath, $configuration['command']); |
|
35 | } |
||
36 | } |
||
37 |