PHP Class Prophecy\Util\ExportUtil

This class is derived from the PHPUnit testing framework.
Author: Sebastian Bergmann ([email protected])
Show file Open project: phpspec/prophecy Class Usage Examples

Public Methods

Method Description
export ( mixed $value, integer $indentation ) : string Exports a value as a string
toArray ( mixed $value ) : array Converts an object to an array containing all of its private, protected and public properties.

Protected Methods

Method Description
recursiveExport ( mixed &$value, integer $indentation, SebastianBergmann\RecursionContext\Context $processed = null ) : string Recursive implementation of export

Method Details

export() public static method

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
public static export ( mixed $value, integer $indentation ) : string
$value mixed
$indentation integer The indentation level of the 2nd+ line
return string

recursiveExport() protected static method

Recursive implementation of export
See also: SebastianBergmann\Exporter\Exporter::export
protected static recursiveExport ( mixed &$value, integer $indentation, SebastianBergmann\RecursionContext\Context $processed = null ) : string
$value mixed The value to export
$indentation integer The indentation level of the 2nd+ line
$processed SebastianBergmann\RecursionContext\Context Previously processed objects
return string

toArray() public static method

Converts an object to an array containing all of its private, protected and public properties.
public static toArray ( mixed $value ) : array
$value mixed
return array