| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 4.25 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 10 | public function makeDirectory(FileNode $file, $visibility = null) |
|
| 24 | { |
||
| 25 | 10 | if (!($file instanceof FileNode)) { |
|
| 26 | throw new \InvalidArgumentException("Node: $file is not a FileNode"); |
||
| 27 | } |
||
| 28 | |||
| 29 | 10 | $madeDirectory = $file->getFilesystem()->createDir($file->getDirectory(), [ |
|
| 30 | 10 | 'visibility' => $visibility ?: static::VISIBILITY_PUBLIC, |
|
| 31 | ]); |
||
| 32 | 10 | if (!$madeDirectory) { |
|
| 33 | throw new MakeDirectoryFailedException($file, error_get_last()['message']); |
||
| 34 | } |
||
| 35 | |||
| 36 | 10 | return $file; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |