Exporter
in package
Read onlyYes
FinalYes
Table of Contents
Properties
- $maxLengthForStrings : positive-int
- $shortenArraysLongerThan : int
Methods
- __construct() : mixed
- countProperties() : int
- export() : string
- Exports a value as a string.
- shortenedExport() : string
- Exports a value into a single-line string.
- shortenedRecursiveExport() : string
- toArray() : array<string|int, mixed>
- Converts an object to an array containing all of its private, protected and public properties.
- canBeReflected() : bool
- exportArray() : string
- exportFloat() : string
- exportObject() : string
- exportString() : string
- recursiveExport() : string
- shortenedCountedRecursiveExport() : string
Properties
$maxLengthForStrings
private
positive-int
$maxLengthForStrings
$shortenArraysLongerThan
private
int
$shortenArraysLongerThan
non-negative-int
Methods
__construct()
public
__construct([int $shortenArraysLongerThan = 0 ][, positive-int $maxLengthForStrings = 40 ]) : mixed
Parameters
- $shortenArraysLongerThan : int = 0
- $maxLengthForStrings : positive-int = 40
countProperties()
public
countProperties(object $value) : int
Parameters
- $value : object
Return values
intexport()
Exports a value as a string.
public
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
Return values
stringshortenedExport()
Exports a value into a single-line string.
public
shortenedExport(mixed $value[, positive-int $maxLengthForStrings = 40 ]) : string
The output of this method is similar to the output of SebastianBergmann\Exporter\Exporter::export().
Newlines are replaced by the visible string '\n'. Contents of arrays and objects (if any) are replaced by '...'.
Parameters
- $value : mixed
- $maxLengthForStrings : positive-int = 40
Return values
stringshortenedRecursiveExport()
public
shortenedRecursiveExport(array<string|int, mixed> &$data[, positive-int $maxLengthForStrings = 40 ][, Context|null $processed = null ]) : string
Parameters
- $data : array<string|int, mixed>
- $maxLengthForStrings : positive-int = 40
- $processed : Context|null = null
Return values
stringtoArray()
Converts an object to an array containing all of its private, protected and public properties.
public
toArray(mixed $value) : array<string|int, mixed>
Parameters
- $value : mixed
Return values
array<string|int, mixed>canBeReflected()
private
canBeReflected(object $object) : bool
Parameters
- $object : object
Return values
boolexportArray()
private
exportArray(array<string|int, mixed> &$value, Context $processed, int $indentation) : string
Parameters
- $value : array<string|int, mixed>
- $processed : Context
- $indentation : int
Return values
stringexportFloat()
private
exportFloat(float $value) : string
Parameters
- $value : float
Return values
stringexportObject()
private
exportObject(object $value, Context $processed, int $indentation) : string
Parameters
- $value : object
- $processed : Context
- $indentation : int
Return values
stringexportString()
private
exportString(string $value) : string
Parameters
- $value : string
Return values
stringrecursiveExport()
private
recursiveExport(mixed &$value[, int $indentation = 0 ][, Context|null $processed = null ]) : string
Parameters
- $value : mixed
- $indentation : int = 0
- $processed : Context|null = null
Return values
stringshortenedCountedRecursiveExport()
private
shortenedCountedRecursiveExport(array<string|int, mixed> &$data, Context $processed, int &$counter, positive-int $maxLengthForStrings) : string
Parameters
- $data : array<string|int, mixed>
- $processed : Context
- $counter : int
- $maxLengthForStrings : positive-int