Create a new temporary file

@param int $mode permission
@return \holyshared\peridot\temporary\TemporaryFile
553830
public function makeFile($mode = FileSystemPermission::NORMAL)
    {
        $file = $this->factory->makeFile($mode);
        $this->container->add($file);

        return $file;
    }
721363
public static function createStreamFromFile($filename, $mode = 'r')
    {
        if (! static::$streamFactory) {
            static::$streamFactory = new StreamFactory();
        }

        return static::$streamFactory->createStreamFromFile($filename, $mode);
    }
308901
public static function createTemporary() {
    $file = File::createTemporary();
    $tempname = $file->getName();
    $file->delete();
    
    $dir = $file->getDirectory()->sub($tempname.'/');
    $dir->make();
    return $dir;
  }
1033991
static public function createTempDir($rootName = 'root')
    {
        self::$root = vfsStream::setup($rootName);

        return vfsStream::url($rootName) . DIRECTORY_SEPARATOR;
    }
993022
private function setHandle($mode)
    {
        $this->closeExistingHandle();

        $this->handle = fopen($this->file, $mode);

        return $this->handle;
    }
233061
public function snapshotCreate($mode = Teamspeak::SNAPSHOT_STRING)
    {
        $snapshot = $this->request("serversnapshotcreate")->toString(false);

        switch ($mode) {
            case Teamspeak::SNAPSHOT_BASE64:
                return $snapshot->toBase64();
                break;

            case Teamspeak::SNAPSHOT_HEXDEC:
                return $snapshot->toHex();
                break;

            default:
                return (string)$snapshot;
                break;
        }
    }
700012
protected function writeAtomic($filename, $content, $mode) {
        $temp = tempnam(dirname($filename), 'atomic');

        if (!($fp = @fopen($temp, 'wb'))) {
            $temp = dirname($filename) . '/' . uniqid('atomic');
            if (!($fp = @fopen($temp, 'wb'))) {
                trigger_error(__METHOD__." : error writing temporary file '{$temp}'", E_USER_WARNING);
                return false;
            }
        }

        $br = fwrite($fp, $content);
        fclose($fp);
        if (!$br || $br != strlen($content)) {
            unlink($temp);
            return false;
        }

        chmod($temp, $mode);

        if (!rename($temp, $filename)) {
            unlink($filename);
            rename($temp, $filename);
        }
        return true;
    }
744449
public function createDir($mode = 0777)
    {
        return is_dir($this->absoluteFileName) || mkdir($this->absoluteFileName, $mode, true);
    }
1249195
public static function setNewFileMode(string $mode = '740'): void
    {
        static::init();
        static::$newFileMode = \preg_match('/^[0-7]{3}$/', $mode) ? \intval($mode, 8) : 0740;
    }
987615
public function create($filepath, $mode = "w")
    {
        //@1 Fopen cannot create directories,
        //so if trying to create a file in subfolders that don't exist will throw a warning
        //wewill first create these directories;
        $dirname = dirname($filepath);

        if (!is_dir($dirname)) {
            if (mkdir($dirname, 0755, true)) {
                return $dirname;
            } else {
                return false;
            }
        }

        //@2 Attempt to create the file
        if (!($file = $this->getFileStream($filepath, $mode))) {
            return false;
        }

        return $file;
    }
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);
        }
    }
948093
public function open($id, $mode = self::READ_MOD, $permission = self::DEFAULT_PERMISSIONS, $size = self::DEFAULT_SIZE)
    {
        return new Entry($id, $mode, $permission, $size);
    }
17804
public function create($filePath = null, $mode = 'wb')
    {
        $filePath = isset($filePath) ? $filePath : $this->filePath;
        $dir = dirname($filePath);

        if ( ! is_writable($dir)) {
            if ( ! file_exists($dir)) {
                mkdir($dir, 0777, true);
            }
        }

        if ( ! $fp = @fopen($filePath, $mode)) {
            return false;
        }

        parent::__construct($filePath);

        return $fp;
    }
285804
public static function tempfile($prefix)
    {
        global $settings;
        $folder = '/tmp';
        if (isset($settings['temporary_folder'])) {
            $folder = $settings['temporary_folder'];
        }
        return tempnam($folder, $prefix);
    }
314304
public function setDefaultMode(string $mode = null) : RauthInterface
    {
        if (!in_array($mode, self::MODES)) {
            throw new \InvalidArgumentException(
                'Mode ' . $mode . ' not accepted!'
            );
        }
        $this->defaultMode = $mode;

        return $this;
    }
950254
public function setCreateMode(int $createMode): self
    {
        $this->createModeOctal       = $createMode;
        $this->createModeOctalString = decoct($createMode);

        return $this;
    }
523129
static function CreateIfNotExists($dir, $mode = 0777)
    {
        if (!self::Exists($dir))
        {
            self::Create($dir, $mode);
        }
    }