TreeNodeCollection extends ArrayObject

Tree Node Collection

Table of Contents

Methods

__construct()  : mixed
Constructor
__serialize()  : mixed
Returns class state to be serialized.
__unserialize()  : mixed
Fills the current node with the given serialized information
asort()  : mixed
Sorts the internal nodes array
dataFromArray()  : mixed
Sets the data of the node collection by a given array
nodeCompare()  : int
Compares a node with another one
serialize()  : string
Returns the serialized instance
toArray()  : array<string|int, mixed>
Returns the collection in an array representation for e.g. serialization
unserialize()  : mixed
Create class state from serialized array.

Methods

__construct()

Constructor

public __construct([array<string|int, mixed> $data = [] ]) : mixed

You can move an initial data array to initialize the instance and further objects. This is useful for the deserialization.

Parameters
$data : array<string|int, mixed> = []

__serialize()

Returns class state to be serialized.

public __serialize() : mixed
Tags
todo:

Change signature to __serialize(): array in v12

Attributes
#[ReturnTypeWillChange]

__unserialize()

Fills the current node with the given serialized information

public __unserialize(mixed $arrayRepresentation) : mixed
Parameters
$arrayRepresentation : mixed
Tags
throws
Exception

if the deserialized object type is not identical to the current one

todo:

Change signature to __unserialize(array $arrayRepresentation): void in v12

Attributes
#[ReturnTypeWillChange]

asort()

Sorts the internal nodes array

public asort([int $flags = SORT_REGULAR ]) : mixed
Parameters
$flags : int = SORT_REGULAR

Optional parameter, ignored. Added to be compatible with asort method signature in PHP 8.

Tags
todo:

Set return type to void in v12 as breaking patch and drop #[\ReturnTypeWillChange]

Attributes
#[ReturnTypeWillChange]

dataFromArray()

Sets the data of the node collection by a given array

public dataFromArray(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

nodeCompare()

Compares a node with another one

public nodeCompare(TreeNode $node, TreeNode $otherNode) : int
Parameters
$node : TreeNode
$otherNode : TreeNode
Internal
Tags
see
TreeNode::compareTo
Return values
int

serialize()

Returns the serialized instance

public serialize() : string
Tags
todo:

Drop method and \Serializable class interface in v12.

Attributes
#[ReturnTypeWillChange]
Return values
string

toArray()

Returns the collection in an array representation for e.g. serialization

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

unserialize()

Create class state from serialized array.

public unserialize(string $serializedString) : mixed
Parameters
$serializedString : string
Tags
throws
Exception

if the deserialized object type is not identical to the current one

todo:

Drop method and \Serializable class interface in v12.

Attributes
#[ReturnTypeWillChange]

        
On this page

Search results