Oihana PHP System

ReflectionTrait

Table of Contents

Properties

$__className  : string|null
$__reflection  : Reflection|null

Methods

getClassName()  : string
Returns the short class name of the given object/class.
getConstants()  : array<string|int, mixed>
Returns the list of all constants of the given object/class.
getPublicProperties()  : array<string|int, mixed>
Internal methods to get the public
getShortName()  : string
Returns the class short name.
hydrate()  : object
Populates an object of the given class with data from the provided array.
jsonSerializeFromPublicProperties()  : array<string|int, mixed>
Invoked to generates the json array serializer array representation from the public properties of the object.

Properties

Methods

getClassName()

Returns the short class name of the given object/class.

public getClassName(object|string $class) : string
Parameters
$class : object|string

The object or the classname reference.

Return values
string

getConstants()

Returns the list of all constants of the given object/class.

public getConstants(object|string $class) : array<string|int, mixed>
Parameters
$class : object|string

The object or the classname reference.

Tags
throws
ReflectionException
Return values
array<string|int, mixed>

getPublicProperties()

Internal methods to get the public

public getPublicProperties(object|string $class) : array<string|int, mixed>
Parameters
$class : object|string

The object or the classname reference.

Tags
throws
ReflectionException
Return values
array<string|int, mixed>

getShortName()

Returns the class short name.

public getShortName(object|string $class) : string
Parameters
$class : object|string

The object or the classname reference.

Tags
throws
ReflectionException
Return values
string

hydrate()

Populates an object of the given class with data from the provided array.

public hydrate(array<string|int, mixed> $thing, string $class) : object
Parameters
$thing : array<string|int, mixed>

The data array used to hydrate the object.

$class : string

The classname of the object to be hydrated.

Tags
throws
ReflectionException
Return values
object

The hydrated object of the given class.

jsonSerializeFromPublicProperties()

Invoked to generates the json array serializer array representation from the public properties of the object.

public jsonSerializeFromPublicProperties(object|string $class[, bool $reduce = false ]) : array<string|int, mixed>
Parameters
$class : object|string

The classname of the object to be serialized.

$reduce : bool = false

Indicates if the returned associative array is compressed, the null properties are removed.

Tags
throws
ReflectionException
Return values
array<string|int, mixed>

        
On this page

Search results