Skip to content

Commit fc94e9d

Browse files
committed
Use FileSystem for temp
1 parent 96419c5 commit fc94e9d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/MandelbrotSet.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace Mathematicator\MandelbrotSet;
66

7+
8+
use Nette\Utils\FileSystem;
9+
710
/**
811
* Calculate and render Mandelbrot set as image to file.
912
* Implementation is inspired by Pavol Hejny, https://www.pavolhejny.com/.
@@ -17,19 +20,11 @@ final class MandelbrotSet
1720

1821
/**
1922
* @param string $tempDir
20-
* @throws \Exception
2123
*/
2224
public function __construct(string $tempDir)
2325
{
2426
ini_set('max_execution_time', '100000');
25-
26-
if (!is_dir($tempDir) && !@mkdir($tempDir, 0777, true) && !is_dir($tempDir)) { // @ - dir may already exist
27-
throw new \Exception(
28-
'Unable to create directory "' . $tempDir . '". '
29-
. preg_replace('#^\w+\(.*?\): #', '', error_get_last()['message'])
30-
);
31-
}
32-
27+
FileSystem::createDir($tempDir);
3328
$this->tempDir = $tempDir;
3429
}
3530

0 commit comments

Comments
 (0)