public static function generate($prefix = 'php-tmp-file', $suffix = '')
    {
        $filename = tempnam(sys_get_temp_dir(), $prefix);

        if ($suffix) {
            $i = 0;
            do {
                $newFilename = $filename . $i++ . $suffix;
            } while (file_exists($newFilename));

            rename($filename, $newFilename);
            $filename = $newFilename;
        }

        return new static($filename);
    }
public static function generate($prefix = 'php-tmp-file', $suffix = '')
    {
        $filename = tempnam(sys_get_temp_dir(), $prefix);

        if ($suffix) {
            $i = 0;
            do {
                $newFilename = $filename . $i++ . $suffix;
            } while (file_exists($newFilename));

            rename($filename, $newFilename);
            $filename = $newFilename;
        }

        return new static($filename);
    }
public static function generate ( $ prefix = 'php-tmp-file' , $ suffix = '' ) { $ filename = tempnam ( sys_get_temp_dir ( ) , $ prefix ) ; if ( $ suffix ) { $ i = 0 ; do { $ newFilename = $ filename . $ i ++ . $ suffix ; } while ( file_exists ( $ newFilename ) ) ; rename ( $ filename , $ newFilename ) ; $ filename = $ newFilename ; } return new static ( $ filename ) ; }
Creates a temp file with unique filename.

@param string $prefix

@return TempFile
Creates a temp file with unique filename .