class Tree implements ArrayAccess, JsonSerializable

Class Tree

Properties

protected Collection $rawNodes
protected Collection $treeNodes

Methods

__construct(NodeInterface[] $rawNodes = array())

No description

static Tree
make(NodeInterface[] $rawNodes = array())

Make Tree instance

Collection
getNodes()

getRawNodes

Collection
getTreeNodes()

getTree

$this
add(NodeInterface $node)

Adds a node to this node

void
arrange()

Arrange From Raw nodes to Menu Tree nodes

array
fullSort(array $items = array())

sort all nodes

array
sort(NodeInterface[] $items = array())

sort node tree

int
size()

size of Tree Collection nodes

boolean
offsetExists(mixed $offset)

Implementation of ArrayAccess offsetExists() Whether a offset exists

mixed
offsetGet(mixed $offset)

Implementation of ArrayAccess offsetGet() Offset to retrieve

void
offsetSet(mixed $offset, mixed $value)

Implementation of ArrayAccess offsetSet() Offset to set

void
offsetUnset(mixed $offset)

Implementation of ArrayAccess offsetUnset() Offset to unset

mixed
jsonSerialize()

(PHP 5 >= 5.4.0)
Specify data which should be serialized to JSON

Details

at line 45
__construct(NodeInterface[] $rawNodes = array())

Parameters

NodeInterface[] $rawNodes nodes

at line 64
static Tree make(NodeInterface[] $rawNodes = array())

Make Tree instance

Parameters

NodeInterface[] $rawNodes nodes

Return Value

Tree

at line 74
Collection getNodes()

getRawNodes

Return Value

Collection NodeInterface[]

at line 84
Collection getTreeNodes()

getTree

Return Value

Collection

at line 96
$this add(NodeInterface $node)

Adds a node to this node

Parameters

NodeInterface $node nodes

Return Value

$this

at line 117
protected void arrange()

Arrange From Raw nodes to Menu Tree nodes

Return Value

void

at line 141
protected array fullSort(array $items = array())

sort all nodes

Parameters

array $items nodes

Return Value

array

at line 160
protected array sort(NodeInterface[] $items = array())

sort node tree

Parameters

NodeInterface[] $items nodes

Return Value

array

at line 179
int size()

size of Tree Collection nodes

Return Value

int

at line 192
boolean offsetExists(mixed $offset)

Implementation of ArrayAccess offsetExists() Whether a offset exists

Parameters

mixed $offset array access offset

Return Value

boolean true on success or false on failure.

at line 205
mixed offsetGet(mixed $offset)

Implementation of ArrayAccess offsetGet() Offset to retrieve

Parameters

mixed $offset array access offset

Return Value

mixed Can return all value types.

at line 223
void offsetSet(mixed $offset, mixed $value)

Implementation of ArrayAccess offsetSet() Offset to set

Parameters

mixed $offset array access offset
mixed $value array access value

Return Value

void

at line 236
void offsetUnset(mixed $offset)

Implementation of ArrayAccess offsetUnset() Offset to unset

Parameters

mixed $offset array access offset

Return Value

void

at line 249
mixed jsonSerialize()

(PHP 5 >= 5.4.0)
Specify data which should be serialized to JSON

Return Value

mixed data which can be serialized by json_encode, which is a value of any type other than a resource.