setasign\SetaPDF2\Core\Writer

TempFileWriter A writer class for temporary files

File: /SetaPDF v2/Core/Writer/TempFileWriter.php
Old class name (alias): \SetaPDF_Core_Writer_TempFile

Class hierarchy

Implements

Summary

Static Properties

$_filePrefix

static protected string TempFileWriter::$_filePrefix = '.htSetaPDF'

The file prefix for the temporary files

$_keepFile

static protected bool TempFileWriter::$_keepFile = false

Defines if the temporary file should be deleted in the destruct method or not

$_tempDir

static protected ?string TempFileWriter::$_tempDir

A temporary directory path

$tempWriters

static public array TempFileWriter::$tempWriters = array()

Temporary file writers.


Properties

$_writer

The internal file writer instance.


Static Methods

createTempFile()

public static TempFileWriter::createTempFile (
string $content
): string

Creates a temporary file and returns the temporary path to it.

Parameters
$content : string
 

createTempPath()

public static TempFileWriter::createTempPath (
null $tempDir = null,
null $filePrefix = null
): string

Creates a temporary path.

If a parameters is left, the static class method (getTempDir() or getFilePrefix()) will be used to resolve the desired data.

Parameters
$tempDir : null
 
$filePrefix : null
 
Exceptions

Throws \InvalidArgumentException

getFilePrefix()

public static TempFileWriter::getFilePrefix (
void
): string

Get the file prefix for temporary files.

getKeepFile()

public static TempFileWriter::getKeepFile (
void
): bool

Get whether files should be kept or deleted automatically when an instance is destructed.

getTempDir()

public static TempFileWriter::getTempDir (
void
): ?string

Get the current temporary directory path.

setFilePrefix()

public static TempFileWriter::setFilePrefix (
string $filePrefix
): void

Set the file prefix for temporary files.

Parameters
$filePrefix : string
 

setKeepFile()

public static TempFileWriter::setKeepFile (
bool $keepFile
): void

Set whether files should be kept or deleted automatically when an instance is destructed.

Parameters
$keepFile : bool
 

setTempDir()

public static TempFileWriter::setTempDir (
?string $tempDir
): void

Set the temporary directory path.

Parameters
$tempDir : ?string
 
Exceptions

Throws \InvalidArgumentException


Methods

__construct()

public TempFileWriter::__construct (
null $tempDir = null,
null $filePrefix = null
)

The constructor.

Parameters
$tempDir : null
 
$filePrefix : null
 

__destruct()

public TempFileWriter::__destruct (
void
): void

The destructor.

This method deletes the temporary file. This behavior could be controlled by the setKeepFile()-method.

cleanUp()

public TempFileWriter::cleanUp (
void
): void

Proxy method.

See

copyStream()

public TempFileWriter::copyStream (
resource|\SetaPDF_Core_Writer_Stream $source
): void

Copies an existing stream into the target stream.

Parameters
$source : resource|\SetaPDF_Core_Writer_Stream
 

finish()

public TempFileWriter::finish (
void
): void

Proxy method.

See

getPath()

public TempFileWriter::getPath (
void
): string

Get the path of the temporary file.

getPos()

public TempFileWriter::getPos (
void
): int

Proxy method.

See

getStatus()

public TempFileWriter::getStatus (
void
): int|string

Proxy method.

See

start()

public TempFileWriter::start (
void
): void

Proxy method.

See

write()

public TempFileWriter::write (
string $s
): void

Proxy method.

Parameters
$s : string
 
See