HumHub Documentation (unofficial)

BaseVarDumper
in package

BaseVarDumper provides concrete implementation for [[VarDumper]].

Do not use BaseVarDumper. Use [[VarDumper]] instead.

Tags
author

Qiang Xue qiang.xue@gmail.com

since
2.0

Table of Contents

Properties

$_depth  : mixed
$_objects  : mixed
$_output  : mixed

Methods

dump()  : mixed
Displays a variable.
dumpAsString()  : string
Dumps a variable in terms of a string.
export()  : string
Exports a variable as a string representation.
dumpInternal()  : mixed
exportClosure()  : string
Exports a [[Closure]] instance.
exportInternal()  : mixed

Properties

Methods

dump()

Displays a variable.

public static dump(mixed $var[, int $depth = 10 ][, bool $highlight = false ]) : mixed

This method achieves the similar functionality as var_dump and print_r but is more robust when handling complex objects such as Yii controllers.

Parameters
$var : mixed

variable to be dumped

$depth : int = 10

maximum depth that the dumper should go into the variable. Defaults to 10.

$highlight : bool = false

whether the result should be syntax-highlighted

dumpAsString()

Dumps a variable in terms of a string.

public static dumpAsString(mixed $var[, int $depth = 10 ][, bool $highlight = false ]) : string

This method achieves the similar functionality as var_dump and print_r but is more robust when handling complex objects such as Yii controllers.

Parameters
$var : mixed

variable to be dumped

$depth : int = 10

maximum depth that the dumper should go into the variable. Defaults to 10.

$highlight : bool = false

whether the result should be syntax-highlighted

Return values
string

the string representation of the variable

export()

Exports a variable as a string representation.

public static export(mixed $var) : string

The string is a valid PHP expression that can be evaluated by PHP parser and the evaluation result will give back the variable value.

This method is similar to var_export(). The main difference is that it generates more compact string representation using short array syntax.

It also handles objects by using the PHP functions serialize() and unserialize().

PHP 5.4 or above is required to parse the exported value.

Parameters
$var : mixed

the variable to be exported.

Return values
string

a string representation of the variable

dumpInternal()

private static dumpInternal(mixed $var, int $level) : mixed
Parameters
$var : mixed

variable to be dumped

$level : int

depth level

exportClosure()

Exports a [[Closure]] instance.

private static exportClosure(Closure $closure) : string
Parameters
$closure : Closure

closure instance.

Return values
string

exportInternal()

private static exportInternal(mixed $var, int $level) : mixed
Parameters
$var : mixed

variable to be exported

$level : int

depth level


        
On this page

Search results