/** * @return string * @throws \Astrotomic\Backuplay\Exceptions\EntityIsNoDirectoryException * @throws \Astrotomic\Backuplay\Exceptions\FileIsntWritableException */ public function getTempDir() { $dir = $this->get('temp_path.dir'); $chmod = $this->get('temp_path.chmod'); if (!(File::isDir($dir, false) === true ? true : false)) { try { $success = mkdir($dir, $chmod, true); } catch (\ErrorException $exception) { $success = false; } if (!$success) { throw new EntityIsNoDirectoryException($dir); } } File::isWritable($dir, true); return rtrim($dir, DIRECTORY_SEPARATOR); }