class Printer (View source)

Utility class that can print to STDOUT or write to a file.

Properties

protected bool $autoFlush If true, flush output after every write.
protected resource $out
protected string $outTarget

Methods

__construct(mixed $out = null)

Constructor.

flush()

Flush buffer and close output if it's not to a PHP stream

incrementalFlush()

Performs a safe, incremental flush.

write(string $buffer)

No description

bool
getAutoFlush()

Check auto-flush mode.

setAutoFlush(bool $autoFlush)

Set auto-flushing mode.

Details

__construct(mixed $out = null)

Constructor.

Parameters

mixed $out

Exceptions

Exception

flush()

Flush buffer and close output if it's not to a PHP stream

incrementalFlush()

Performs a safe, incremental flush.

Do not confuse this function with the flush() function of this class, since the flush() function may close the file being written to, rendering the current object no longer usable.

write(string $buffer)

Parameters

string $buffer

bool getAutoFlush()

Check auto-flush mode.

Return Value

bool

setAutoFlush(bool $autoFlush)

Set auto-flushing mode.

If set, incremental flushes will be done after each write. This should not be confused with the different effects of this class' flush() method.

Parameters

bool $autoFlush