| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.0312 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | 10 | public function makeDirectory(LocalFile $file, $mode = 0777) |
|
| 20 | { |
||
| 21 | 10 | if (!($file instanceof LocalFile)) { |
|
| 22 | throw new \InvalidArgumentException("Node: $file is not a LocalFile"); |
||
| 23 | } |
||
| 24 | |||
| 25 | 10 | if (!file_exists($file->getDirectory())) { |
|
| 26 | 8 | if (!@mkdir($file->getDirectory(), $mode, true)) { |
|
| 27 | 1 | $lastError = error_get_last(); |
|
| 28 | 1 | throw new MakeDirectoryFailedException($file, $lastError['message']); |
|
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | 10 | return $file; |
|
| 33 | } |
||
| 34 | } |
||
| 35 |