PHP Class Ouzo\Utilities\Objects

Exibir arquivo Open project: letsdrink/ouzo Class Usage Examples

Public Methods

Method Description
booleanToString ( boolean $var ) : string Convert boolean to string 'true' or 'false'.
callMethod ( mixed $object, string $methodName, mixed $default ) : mixed
getValue ( mixed $object, string $field, null | mixed $default = null, boolean $accessPrivate = false ) : mixed | null
getValueOrCallMethod ( mixed $object, string $field, mixed $default, boolean $accessPrivate = false ) : mixed | null
getValueRecursively ( mixed $object, string $names, null | mixed $default = null, boolean $accessPrivate = false ) : mixed | null
setValueRecursively ( mixed $object, string $names, mixed $value )
toString ( mixed $var ) : string Returns a string representation of the given object.

Private Methods

Method Description
arrayToString ( array $array )
objectToString ( $object )
stringifyArrayElements ( $array )

Method Details

booleanToString() public static method

Convert boolean to string 'true' or 'false'.
public static booleanToString ( boolean $var ) : string
$var boolean
return string

callMethod() public static method

public static callMethod ( mixed $object, string $methodName, mixed $default ) : mixed
$object mixed
$methodName string
$default mixed
return mixed

getValue() public static method

public static getValue ( mixed $object, string $field, null | mixed $default = null, boolean $accessPrivate = false ) : mixed | null
$object mixed
$field string
$default null | mixed
$accessPrivate boolean
return mixed | null

getValueOrCallMethod() public static method

public static getValueOrCallMethod ( mixed $object, string $field, mixed $default, boolean $accessPrivate = false ) : mixed | null
$object mixed
$field string
$default mixed
$accessPrivate boolean
return mixed | null

getValueRecursively() public static method

public static getValueRecursively ( mixed $object, string $names, null | mixed $default = null, boolean $accessPrivate = false ) : mixed | null
$object mixed
$names string
$default null | mixed
$accessPrivate boolean
return mixed | null

setValueRecursively() public static method

public static setValueRecursively ( mixed $object, string $names, mixed $value )
$object mixed
$names string
$value mixed

toString() public static method

Returns a string representation of the given object.
public static toString ( mixed $var ) : string
$var mixed
return string