Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function ensureDirectoryExists($directory) |
||
17 | { |
||
18 | if (!is_dir($directory)) { |
||
19 | if (file_exists($directory)) { |
||
20 | throw new \RuntimeException( |
||
21 | $directory.' exists and is not a directory.' |
||
22 | ); |
||
23 | } |
||
24 | if (!@mkdir($directory, 0777, true)) { |
||
25 | throw new \RuntimeException( |
||
26 | $directory.' does not exist and could not be created.' |
||
27 | ); |
||
28 | } |
||
29 | } |
||
30 | } |
||
31 | |||
52 |