Skip to content

Commit b44cb18

Browse files
committed
Merge pull request #39 from piotr-cz/patch-1
simplified createDirectory method
2 parents 64114ae + 8e3dc16 commit b44cb18

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/PHPCodeBrowser/Helper/IOHelper.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,11 @@ public function loadFile($fileName)
155155
*/
156156
public function createDirectory($target)
157157
{
158-
if (DIRECTORY_SEPARATOR == substr($target, - 1, 1)) {
159-
$target = substr($target, 0, -1);
160-
}
161-
$dirs = explode(DIRECTORY_SEPARATOR, $target);
162-
$path = '';
163-
foreach ($dirs as $folder) {
164-
if (!is_dir($path = $path . $folder . DIRECTORY_SEPARATOR)) {
165-
mkdir($path);
166-
}
158+
$target = rtrim($target, DIRECTORY_SEPARATOR);
159+
160+
if (!is_dir($target))
161+
{
162+
mkdir($target, 0777, true);
167163
}
168164
}
169165

0 commit comments

Comments
 (0)