Create a new temporary directory

@param int $mode permission
@return \holyshared\peridot\temporary\TemporaryDirectory
194474
public function makeDirectory($mode = FileSystemPermission::NORMAL)
    {
        $directoryId = $this->generateId();
        $path = sys_get_temp_dir() . '/' . $directoryId;
        $directory = new TemporaryDirectory($path, $mode);

        return $directory;
    }
1369957
public static function createTmpDir() {
        $tmpDir = sys_get_temp_dir();
        $tmpDir .= $tmpDir[strlen($tmpDir) - 1] !== '/' ? '/' : '';
        $tmpDir .= uniqid() . '/';
        if (mkdir($tmpDir)) {
            return $tmpDir;
        } else {
            throw new Exception('Could not create directory ' . $tmpDir);
        }
    }
1088427
public static function createWorkingDirectory()
    {
        $workdir = sys_get_temp_dir() . '/tmp-' . session_id() . '/';

        self::recursiveMkdir($workdir, 0777);
        //@chmod($workdir,0777);

        if (!is_dir($workdir)) {
            throw new Exception("cannot create directory: " . $workdir);
        }

        return $workdir;
    }
1310281
public static function setNewDirectoryMode(string $mode = '740'): void
    {
        static::init();
        static::$newDirectoryMode = \preg_match('/^[0-7]{3}$/', $mode) ? \intval($mode, 8) : 0740;
    }
1132384
protected function prepareDefaultDirectory() : Directory {
        $path = $this->finder->setWorkingDirectory('/');

        return new Directory($this->factory, $this->finder, $path);
    }
1026052
public function mkdir($mode = 0755)
    {
        $fs = FileSystem::getFileSystem();

        if ($fs->checkAccess(new PhingFile($this->path), true) !== true) {
            throw new IOException("No write access to " . $this->getPath());
        }

        return $fs->createDirectory($this, $mode);
    }
1260379
public function setMode($mode)
    {
        $fs = FileSystem::getFileSystem();

        $fs->chmod($this->getPath(), $mode);
    }
468231
private function create($mode, $url, $lastMod = null):void
    {
        $lastMod = $lastMod ?: $this->lastMod;
        $raw = str_replace([':url', ':lastmod'], [$url, $lastMod], $this->raw);
        if ($mode === 'create') {
            $fileH = new SitemapWriter($this->file, 'writeOnly');
            $fileH->write(self::START.PHP_EOL);
            $fileH->write($raw);
            $fileH->write(PHP_EOL.self::END);
        } elseif ($mode === 'append') {
            $fileH = new SitemapWriter($this->file, 'readOnly');
            $sitemapData = $fileH->read();
            $fileH = new SitemapWriter($this->file, 'writeOverride');
            $sitemapData = str_replace('</sitemapindex>', '', $sitemapData);
            $sitemapData = $sitemapData.$raw;
            $fileH->write($sitemapData);
            $fileH->write(PHP_EOL.self::END);
        }
        $fileH->close();
    }
753998
public static function setCacheMode($mode = 1)
    {
        $instance = self::getInstance();
        if ($mode == 1) {
            $instance->_options['mode'] = 1;
        } else {
            $instance->_options['mode'] = 2;
        }

        return $instance;
    }
1228762
public function _dirCreate($dir, $mode = 0755)
    {
        /** @noinspection NotOptimalIfConditionsInspection */
        if (!is_dir($dir) && !@mkdir($dir, $mode, true) && !is_dir($dir)) {
            throw new CreateDirectoryFailedException(['create `:dir` directory failed: :last_error_message', 'dir' => $dir]);
        }
    }
336104
protected function getRecursiveDirectoryIterator($path, $mode = RecursiveIteratorIterator::SELF_FIRST)
    {
        return new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
            $mode
        );
    }
816954
protected function openFileHandle($mode = 'w+') {

        if($this->fileHandle !== null) {

            throw new TempFileException();
        }

        if(!($fileHandle = fopen($this->filePath, $mode))) {

            throw new TempFileException('Could not open file handle to temporary file.');
        }

        $this->fileHandle = $fileHandle;
    }
1175420
protected function createDirectory($directory)
    {
        $isCreated = file_exists($directory) || is_dir($directory) || mkdir($directory, 0777, true);
        
        if (!$isCreated)
            throw new RuntimeException('Cannot create directory ":dir" for generated classed', ['dir' => $directory]);
        
        return $this;
    }
441289
public function make($mode = 0777) {
		if (!$this->exists() && !@mkdir($this->pathname, $mode, true)) {
			throw new FileException(sprintf('Failed to create directory "%s"', $this->pathname));
		}
	}
235873
protected static function createDirectory( $dir )
	{
		$perm = 0755;

		if( !is_dir( $dir ) && !mkdir( $dir, $perm, true ) )
		{
			$msg = 'Unable to create directory "%1$s" with permission "%2$s"';
			throw new \RuntimeException( sprintf( $msg, $dir, $perm ) );
		}
	}
886574
public function setMode($mode)
    {
        Assertion::choice($mode, $this->availableModes, "Mode '{$mode}' does not exist.");
        $this->mode = $mode;

        return $this;
    }
523218
protected function createDir($dir)
    {
        if (!is_dir($dir) && !mkdir($dir, 0755, true)) {
            throw new \RuntimeException(
                sprintf('Unable to create cache directory %s, check permissions', $dir)
            );
        }

        if (!is_writable($dir)) {
            throw new BadPermissionException(
                sprintf('Cache directory %s is not writable, check permissions', $dir)
            );
        }
    }