private static function writeTempFile($data)
    {
        $file = tempnam(sys_get_temp_dir(), self::$temp_file_prefix);
        file_put_contents($file, $data);

        register_shutdown_function(function () use ($file) {
            if (file_exists($file)) {
                unlink($file);
            }
        });

        return $file;
    }
private static function writeTempFile($data)
    {
        $file = tempnam(sys_get_temp_dir(), self::$temp_file_prefix);
        file_put_contents($file, $data);

        register_shutdown_function(function () use ($file) {
            if (file_exists($file)) {
                unlink($file);
            }
        });

        return $file;
    }
private static function writeTempFile ( $ data ) { $ file = tempnam ( sys_get_temp_dir ( ) , self :: $ temp_file_prefix ) ; file_put_contents ( $ file , $ data ) ; register_shutdown_function ( function ( ) use ( $ file ) { if ( file_exists ( $ file ) ) { unlink ( $ file ) ; } } ) ; return $ file ; }
Create a temporary file to be used and destroyed at shutdown

@param $data
@return bool|string
Create a temporary file to be used and destroyed at shutdown