Skip to content
Snippets Groups Projects
Commit a79551ad authored by Stein Magne Bjorklund's avatar Stein Magne Bjorklund
Browse files

Cleanup Importer::createViews()

parent d5b50352
No related branches found
No related tags found
1 merge request!18Resolve "Remove all use of GLOBALS"
......@@ -238,7 +238,7 @@ final class Importer
}
}
private function createViews($views)
private function createViews($views): void
{
try {
foreach ($views as $k => $v) {
......@@ -247,17 +247,25 @@ final class Importer
if (file_exists($path[$i])) {
if (!is_dir($path[$i])) {
unlink($path[$i]);
mkdir($path[$i]);
if (!mkdir($concurrentDirectory = $path[$i]) && !is_dir($concurrentDirectory)) {
throw new \RuntimeException(
sprintf('Directory "%s" was not created', $concurrentDirectory)
);
}
}
} else {
mkdir($path[$i]);
} elseif (!mkdir($concurrentDirectory = $path[$i]) && !is_dir($concurrentDirectory)) {
throw new \RuntimeException(
sprintf('Directory "%s" was not created', $concurrentDirectory)
);
}
chdir($path[$i]);
}
$fh = fopen(end($path), 'w');
fwrite($fh, $v);
fclose($fh);
for ($i = 0; $i < sizeof($path) - 1; $i++) {
chdir('..');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment