Deployment\FtpServer::createDir PHP Method

createDir() public method

Creates directories on FTP server.
public createDir ( $dir ) : void
return void
    public function createDir($dir)
    {
        if (trim($dir, '/') === '' || $this->isDir($dir)) {
            return;
        }
        $parts = explode('/', $dir);
        $path = '';
        while (!empty($parts)) {
            $path .= array_shift($parts);
            try {
                if ($path !== '') {
                    $this->ftp('mkdir', $path);
                }
            } catch (FtpException $e) {
                if (!$this->isDir($path)) {
                    throw new FtpException("Cannot create directory '{$path}'.");
                }
            }
            $path .= '/';
        }
    }