PHP Class Debug_Bar_Pretty_Output, vip-mu-plugins-public

Show file Open project: Automattic/vip-mu-plugins-public Class Usage Examples

Protected Properties

Property Type Description
$limit_recursion Whether to limit how deep the variable printing will recurse into an array/object.

Public Methods

Method Description
get_ooutput ( object $obj, boolean $is_sub = false ) Helper Function specific to the Debug bar plugin.
get_output ( mixed $var, string $title = '', boolean $escape = true, string $space = '', boolean $short = false, integer $depth ) : string A not-so-pretty method to show pretty output ;-).
get_table ( array $array, string $col1, string $col2, string | array $class = null ) : string Retrieve the table output.
limit_recursion ( integer $depth ) Set the recursion limit.
ooutput ( object $obj, string $deprecated = null, boolean $is_sub = false ) : void Helper Function specific to the Debug bar plugin.
output ( mixed $var, string $title = '', boolean $escape = false, string $space = '', boolean $short = false, string $deprecated = null ) Print pretty output.
render_table ( array $array, string $col1, string $col2, string | array $class = null, string $deprecated = null ) : void Render the table output.
unset_recursion_limit ( ) Reset the recusion limit to it's default (unlimited).

Private Methods

Method Description
get_object_info ( object $obj, boolean $escape, string $space, boolean $short, integer $depth ) : string Retrieve pretty output about objects.
get_pretty_bool ( boolean $bool, boolean $short = false ) : string Convert a boolean to pretty output.
get_pretty_float ( float $float, boolean $short = false ) : string Convert a float to pretty output.
get_pretty_int ( integer $int, boolean $short = false ) : string Convert an integer to pretty output.
get_pretty_null ( null $null, boolean $short = false ) : string Convert a null value to pretty output.
get_pretty_resource ( resource $resource, boolean $short = false ) : string Convert a resource to pretty output.
get_pretty_string ( string $string, boolean $short = false, boolean $escape = true ) : string Convert a string to pretty output.
get_table_end ( ) : string Generate table closing.
get_table_row ( mixed $key, mixed $value ) : string Generate individual table row.
get_table_rows ( array $array ) : string Generate table rows.
get_table_start ( string $col1, string $col2, string | array $class = null, boolean $double_it = false ) Generate the table header.
object_info ( object $obj, boolean $escape, string $space, boolean $short, string $deprecated = null ) : void Print pretty output about objects.

Method Details

get_ooutput() public static method

Retrieves html string of properties in a table and methods in an unordered list.
Since: 1.3
public static get_ooutput ( object $obj, boolean $is_sub = false )
$obj object Object for which to show the properties and methods.
$is_sub boolean (internal) Top level or nested object.

get_output() public static method

A not-so-pretty method to show pretty output ;-).
Since: 1.3
public static get_output ( mixed $var, string $title = '', boolean $escape = true, string $space = '', boolean $short = false, integer $depth ) : string
$var mixed Variable to show.
$title string (optional) Variable title.
$escape boolean (optional) Whether to character escape the textual output.
$space string (internal) Indentation spacing.
$short boolean (internal) Short or normal annotation.
$depth integer (internal) The depth of the current recursion.
return string

get_table() public static method

Retrieve the table output.
Since: 1.3
public static get_table ( array $array, string $col1, string $col2, string | array $class = null ) : string
$array array Array to be shown in the table.
$col1 string Label for the first table column.
$col2 string Label for the second table column.
$class string | array One or more CSS classes to add to the table.
return string

limit_recursion() public static method

Always make sure you also unset the limit after you're done with this class so as not to impact other plugins which may be using this printing class.
Since: 1.4
public static limit_recursion ( integer $depth )
$depth integer Maximum recursion depth.

ooutput() public static method

Outputs properties in a table and methods in an unordered list.
Deprecation: since v1.3 in favour of get_ooutput().
public static ooutput ( object $obj, string $deprecated = null, boolean $is_sub = false ) : void
$obj object Object for which to show the properties and methods.
$deprecated string ==Deprecated argument.
$is_sub boolean (internal) Top level or nested object.
return void

output() public static method

Print pretty output.
Deprecation: since v1.3 in favour of get_output().
public static output ( mixed $var, string $title = '', boolean $escape = false, string $space = '', boolean $short = false, string $deprecated = null )
$var mixed Variable to show.
$title string (optional) Variable title.
$escape boolean (optional) Whether to character escape the textual output.
$space string (internal) Indentation spacing.
$short boolean (internal) Short or normal annotation.
$deprecated string ==Deprecated argument.

render_table() public static method

Render the table output.
Deprecation: since v1.3 in favour of get_table().
public static render_table ( array $array, string $col1, string $col2, string | array $class = null, string $deprecated = null ) : void
$array array Array to be shown in the table.
$col1 string Label for the first table column.
$col2 string Label for the second table column.
$class string | array One or more CSS classes to add to the table.
$deprecated string ==Deprecated argument.
return void

unset_recursion_limit() public static method

Reset the recusion limit to it's default (unlimited).
Since: 1.4
public static unset_recursion_limit ( )

Property Details

$limit_recursion protected static property

Whether to limit how deep the variable printing will recurse into an array/object.
Since: 1.4
protected static $limit_recursion