Documentation

ExportUtil
in package

This class is a modification from sebastianbergmann/exporter

Tags
see
https://github.com/sebastianbergmann/exporter

Table of Contents

export()  : string
Exports a value as a string
toArray()  : array<string|int, mixed>
Converts an object to an array containing all of its private, protected and public properties.
recursiveExport()  : string
Recursive implementation of export

Methods

export()

Exports a value as a string

public static export(mixed $value[, int $indentation = 0 ]) : string

The output of this method is similar to the output of print_r(), but improved in various aspects:

  • NULL is rendered as "null" (instead of "")
  • TRUE is rendered as "true" (instead of "1")
  • FALSE is rendered as "false" (instead of "")
  • Strings are always quoted with single quotes
  • Carriage returns and newlines are normalized to \n
  • Recursion and repeated rendering is treated properly
Parameters
$value : mixed
$indentation : int = 0

The indentation level of the 2nd+ line

Return values
string

toArray()

Converts an object to an array containing all of its private, protected and public properties.

public static toArray(mixed $value) : array<string|int, mixed>
Parameters
$value : mixed
Return values
array<string|int, mixed>

recursiveExport()

Recursive implementation of export

protected static recursiveExport(mixed &$value, int $indentation[, Context $processed = null ]) : string
Parameters
$value : mixed

The value to export

$indentation : int

The indentation level of the 2nd+ line

$processed : Context = null

Previously processed objects

Tags
see
Exporter::export
Return values
string

Search results