Skip to content

Commit

Permalink
Merge pull request #39 from piotr-cz/patch-1
Browse files Browse the repository at this point in the history
simplified createDirectory method
  • Loading branch information
calbrecht committed Jan 14, 2016
2 parents 64114ae + 8e3dc16 commit b44cb18
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/PHPCodeBrowser/Helper/IOHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,11 @@ public function loadFile($fileName)
*/
public function createDirectory($target)
{
if (DIRECTORY_SEPARATOR == substr($target, - 1, 1)) {
$target = substr($target, 0, -1);
}
$dirs = explode(DIRECTORY_SEPARATOR, $target);
$path = '';
foreach ($dirs as $folder) {
if (!is_dir($path = $path . $folder . DIRECTORY_SEPARATOR)) {
mkdir($path);
}
$target = rtrim($target, DIRECTORY_SEPARATOR);

if (!is_dir($target))
{
mkdir($target, 0777, true);
}
}

Expand Down

0 comments on commit b44cb18

Please sign in to comment.