Documentation

AbstractDumper
in package
implements DataDumperInterface, DumperInterface

Abstract mechanism for dumping a Data object.

Tags
author

Nicolas Grekas p@tchwork.com

Interfaces, Classes and Traits

DataDumperInterface
DataDumperInterface for dumping Data objects.
DumperInterface
DumperInterface used by Data objects.

Table of Contents

DUMP_COMMA_SEPARATOR  = 4
DUMP_LIGHT_ARRAY  = 1
DUMP_STRING_LENGTH  = 2
DUMP_TRAILING_COMMA  = 8
$defaultOutput  : mixed
$decimalPoint  : mixed
$flags  : mixed
$indentPad  : mixed
$line  : mixed
$lineDumper  : mixed
$outputStream  : mixed
$charset  : mixed
__construct()  : mixed
dump()  : string|null
Dumps a Data object.
setCharset()  : string
Sets the default character encoding to use for non-UTF8 strings.
setIndentPad()  : string
Sets the indentation pad string.
setOutput()  : callable|resource|string
Sets the output destination of the dumps.
dumpLine()  : mixed
Dumps the current line.
echoLine()  : mixed
Generic line dumper callback.
utf8Encode()  : string|null
Converts a non-UTF-8 string to UTF-8.

Constants

Properties

$defaultOutput

public static mixed $defaultOutput = 'php://output'

Methods

__construct()

public __construct([callable|resource|string|null $output = null ][, string|null $charset = null ], int $flags) : mixed
Parameters
$output : callable|resource|string|null = null

A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput

$charset : string|null = null

The default character encoding to use for non-UTF8 strings

$flags : int

A bit field of static::DUMP_* constants to fine tune dumps representation

Return values
mixed

dump()

Dumps a Data object.

public dump(Data $data[, callable|resource|string|true|null $output = null ]) : string|null
Parameters
$data : Data
$output : callable|resource|string|true|null = null

A line dumper callable, an opened stream, an output path or true to return the dump

Return values
string|null

The dump as string when $output is true

setCharset()

Sets the default character encoding to use for non-UTF8 strings.

public setCharset(string $charset) : string
Parameters
$charset : string
Return values
string

The previous charset

setIndentPad()

Sets the indentation pad string.

public setIndentPad(string $pad) : string
Parameters
$pad : string

A string that will be prepended to dumped lines, repeated by nesting level

Return values
string

The previous indent pad

setOutput()

Sets the output destination of the dumps.

public setOutput(callable|resource|string $output) : callable|resource|string
Parameters
$output : callable|resource|string

A line dumper callable, an opened stream or an output path

Return values
callable|resource|string

The previous output destination

dumpLine()

Dumps the current line.

protected dumpLine(int $depth) : mixed
Parameters
$depth : int

The recursive depth in the dumped structure for the line being dumped, or -1 to signal the end-of-dump to the line dumper callable

Return values
mixed

echoLine()

Generic line dumper callback.

protected echoLine(string $line, int $depth, string $indentPad) : mixed
Parameters
$line : string
$depth : int
$indentPad : string
Return values
mixed

utf8Encode()

Converts a non-UTF-8 string to UTF-8.

protected utf8Encode(string|null $s) : string|null
Parameters
$s : string|null
Return values
string|null

Search results