SetaPDF_Core_Writer_TempFile A writer class for temporary files

File: /SetaPDF v2/Core/Writer/TempFile.php

Class hierarchy

Implements

Summary

Static Properties

$_filePrefix

static public string SetaPDF_Core_Writer_TempFile::$_filePrefix = '.htSetaPDF'

The file prefix for the temporary files

$_keepFile

static protected bool SetaPDF_Core_Writer_TempFile::$_keepFile = false

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

$_tempDir

static public string|null SetaPDF_Core_Writer_TempFile::$_tempDir

A temporary directory path

$tempWriters

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

Temporary file writers.


Properties

$_writer

protected SetaPDF_Core_Writer_File SetaPDF_Core_Writer_TempFile::$_writer

The internal file writer instance.


Static Methods

createTempFile()

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

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

Parameters
$content : string
 

createTempPath()

public static SetaPDF_Core_Writer_TempFile::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 SetaPDF_Core_Writer_TempFile::getFilePrefix (
void
): string

Get the file prefix for temporary files.

getKeepFile()

public static SetaPDF_Core_Writer_TempFile::getKeepFile (
void
): bool

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

getTempDir()

public static SetaPDF_Core_Writer_TempFile::getTempDir (
void
): null|string

Get the current temporary directory path.

setFilePrefix()

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

Set the file prefix for temporary files.

Parameters
$filePrefix : string
 

setKeepFile()

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

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

Parameters
$keepFile : bool
 

setTempDir()

public static SetaPDF_Core_Writer_TempFile::setTempDir (
null|string $tempDir
): void

Set the temporary directory path.

Parameters
$tempDir : null|string
 
Exceptions

Throws InvalidArgumentException


Methods

__construct()

public SetaPDF_Core_Writer_TempFile::__construct (
[ null $tempDir = null [, null $filePrefix = null ]]
)

The constructor.

Parameters
$tempDir : null
 
$filePrefix : null
 

__destruct()

The destructor.

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

getPath()

public SetaPDF_Core_Writer_TempFile::getPath (
void
): string

Get the path of the temporary file.

getStatus()

write()

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

Proxy method.

Parameters
$s : string
 
See