ArrayTrait
Trait to add functions for array conversion.
Classes which use this trait must implement the ArrayCopyable interface.
It is recommended that classes which use this trait declare they implement the Arrayable interface.
Tags
Table of Contents
- fromArray() : static
- Convert an array into an instance of this class.
- toArray() : array<string|int, mixed>
- Convert this object into an array.
Methods
fromArray()
Convert an array into an instance of this class.
public
static fromArray([array<string|int, mixed> $array = null ]) : static
This static function returns a new instance of this class.
If $array
is null
, null
is returned.
Parameters
- $array : array<string|int, mixed> = null
-
An array
Return values
static —An instance of this class.
toArray()
Convert this object into an array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array.