PHP Class SimpleDumper, simpletest

@package SimpleTest
Datei anzeigen Open project: simpletest/simpletest Class Usage Examples

Public Methods

Method Description
clipString ( string $value, integer $size, integer $position ) : string Clips a string to a maximum length.
describeDifference ( mixed $first, mixed $second, boolean $identical = false ) : string Creates a human readable description of the difference between two variables.
describeValue ( mixed $value ) : string Renders a variable in a shorter form than print_r().
dump ( mixed $variable ) : string Sends a formatted dump of a variable to a string.
getType ( mixed $value ) : string Gets the string representation of a type.
unmangle ( string $mangled ) : string Removes crud from property name after it's been converted to an array.

Protected Methods

Method Description
describeArrayDifference ( array $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between two arrays.
describeBooleanDifference ( boolean $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between a boolean and another variable.
describeFloatDifference ( float $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between two floating point numbers.
describeGenericDifference ( null $first, mixed $second ) : string Creates a human readable description of the difference between two variables.
describeIntegerDifference ( integer $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between an integer and another variable.
describeNullDifference ( null $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between a null and another variable.
describeObjectDifference ( object $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between two objects.
describeResourceDifference ( resource $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between a resource and another variable.
describeStringDifference ( string $first, mixed $second, boolean $identical ) : string Creates a human readable description of the difference between a string and another variable.
getMembers ( object $object ) : array Get all members of an object including private and protected ones.
isMatchingKeys ( array $first, array $second, boolean $identical ) : boolean Compares two arrays to see if their key lists match.
isTypeMatch ( mixed $first, mixed $second ) : boolean Tests to see if types match.
stringDiffersAt ( string $first, string $second ) : integer Find the first character position that differs in two strings by binary chop.

Private Methods

Method Description
getPrivatePropertyNoMatterWhat ( string $name, object $object ) : mixed Extracts a private member's value when reflection won't play ball.

Method Details

clipString() public method

Clips a string to a maximum length.
public clipString ( string $value, integer $size, integer $position ) : string
$value string String to truncate.
$size integer Minimum string size to show.
$position integer Centre of string section.
return string Shortened version.

describeArrayDifference() protected method

Creates a human readable description of the difference between two arrays.
protected describeArrayDifference ( array $first, mixed $second, boolean $identical ) : string
$first array First array.
$second mixed Array to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeBooleanDifference() protected method

Creates a human readable description of the difference between a boolean and another variable.
protected describeBooleanDifference ( boolean $first, mixed $second, boolean $identical ) : string
$first boolean First boolean.
$second mixed Boolean to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeDifference() public method

Uses a dynamic call.
public describeDifference ( mixed $first, mixed $second, boolean $identical = false ) : string
$first mixed First variable.
$second mixed Value to compare with.
$identical boolean If true then type anomolies count.
return string Description of difference.

describeFloatDifference() protected method

Creates a human readable description of the difference between two floating point numbers.
protected describeFloatDifference ( float $first, mixed $second, boolean $identical ) : string
$first float First float.
$second mixed Float to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeGenericDifference() protected method

The minimal version.
protected describeGenericDifference ( null $first, mixed $second ) : string
$first null First value.
$second mixed Value to compare with.
return string Human readable description.

describeIntegerDifference() protected method

Creates a human readable description of the difference between an integer and another variable.
protected describeIntegerDifference ( integer $first, mixed $second, boolean $identical ) : string
$first integer First number.
$second mixed Number to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeNullDifference() protected method

Creates a human readable description of the difference between a null and another variable.
protected describeNullDifference ( null $first, mixed $second, boolean $identical ) : string
$first null First null.
$second mixed Null to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeObjectDifference() protected method

Creates a human readable description of the difference between two objects.
protected describeObjectDifference ( object $first, mixed $second, boolean $identical ) : string
$first object First object.
$second mixed Object to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeResourceDifference() protected method

Creates a human readable description of the difference between a resource and another variable.
protected describeResourceDifference ( resource $first, mixed $second, boolean $identical ) : string
$first resource First resource.
$second mixed Resource to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeStringDifference() protected method

Creates a human readable description of the difference between a string and another variable.
protected describeStringDifference ( string $first, mixed $second, boolean $identical ) : string
$first string First string.
$second mixed String to compare with.
$identical boolean If true then type anomolies count.
return string Human readable description.

describeValue() public method

Renders a variable in a shorter form than print_r().
public describeValue ( mixed $value ) : string
$value mixed Variable to render as a string.
return string Human readable string form.

dump() public method

Sends a formatted dump of a variable to a string.
public dump ( mixed $variable ) : string
$variable mixed Variable to display.
return string Output from print_r().

getMembers() protected method

A safer form of casting to an array.
protected getMembers ( object $object ) : array
$object object Object to list members of, including private ones.
return array Names and values in the object.

getType() public method

Gets the string representation of a type.
public getType ( mixed $value ) : string
$value mixed Variable to check against.
return string Type.

isMatchingKeys() protected method

For an identical match, the ordering and types of the keys is significant.
protected isMatchingKeys ( array $first, array $second, boolean $identical ) : boolean
$first array First array.
$second array Array to compare with.
$identical boolean If true then type anomolies count.
return boolean True if matching.

isTypeMatch() protected method

Tests to see if types match.
protected isTypeMatch ( mixed $first, mixed $second ) : boolean
$first mixed First variable.
$second mixed Value to compare with.
return boolean True if matches.

stringDiffersAt() protected method

Find the first character position that differs in two strings by binary chop.
protected stringDiffersAt ( string $first, string $second ) : integer
$first string First string.
$second string String to compare with.
return integer Position of first differing character.

unmangle() public method

Removes crud from property name after it's been converted to an array.
public unmangle ( string $mangled ) : string
$mangled string Name from array cast.
return string Cleaned up name.