Documentation

Node
in package
implements ArrayAccess, IteratorAggregate

Class \Hoa\Protocol\Node\Node.

Abstract class for all hoa://'s nodes.

Tags
copyright

Copyright © 2007-2017 Hoa community

license

New BSD License

Table of Contents

Interfaces

ArrayAccess
IteratorAggregate

Properties

$_name  : string
Node's name.
$_reach  : string
Path for the `reach` method.
$_children  : array<string|int, mixed>
Children of the node.

Methods

__construct()  : mixed
Construct a protocol's node.
__toString()  : string
Print a tree of component.
getIterator()  : ArrayIterator
Get an iterator.
getName()  : string
Get node's name.
getRoot()  : Protocol
Get root the protocol.
offsetExists()  : bool
Check if a node exists.
offsetGet()  : Protocol
Get a specific node.
offsetSet()  : Protocol
Add a node.
offsetUnset()  : void
Remove a node.
reach()  : mixed
Queue of the node.
reachId()  : mixed
ID of the component.
setReach()  : string
Set a new reach value.
_resolve()  : mixed
Resolve a path, i.e. iterate the nodes tree and reach the queue of the path.
_resolveChoice()  : void
Resolve choices, i.e. a reach value has a “;”.
getReach()  : string
Get reach's root.

Properties

$_name

Node's name.

protected string $_name = null

$_reach

Path for the `reach` method.

protected string $_reach = null

$_children

Children of the node.

private array<string|int, mixed> $_children = []

Methods

__construct()

Construct a protocol's node.

public __construct([string $name = null ][, string $reach = null ][, array<string|int, mixed> $children = [] ]) : mixed

If it is not a data object (i.e. if it does not extend this class to overload the $_name attribute), we can set the $_name attribute dynamically. This is useful to create a node on-the-fly.

Parameters
$name : string = null

Node's name.

$reach : string = null

Path for the reach method.

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

Node's children.

__toString()

Print a tree of component.

public __toString() : string
Return values
string

getIterator()

Get an iterator.

public getIterator() : ArrayIterator
Return values
ArrayIterator

getName()

Get node's name.

public getName() : string
Return values
string

offsetExists()

Check if a node exists.

public offsetExists(string $name) : bool
Parameters
$name : string

Node's name.

Return values
bool

offsetGet()

Get a specific node.

public offsetGet(string $name) : Protocol
Parameters
$name : string

Node's name.

Tags
throws
Exception
Return values
Protocol

offsetSet()

Add a node.

public offsetSet(string $name, Protocol $node) : Protocol
Parameters
$name : string

Node's name. If null, will be set to name of $node.

$node : Protocol

Node to add.

Tags
throws
Exception
Return values
Protocol

offsetUnset()

Remove a node.

public offsetUnset(string $name) : void
Parameters
$name : string

Node's name to remove.

reach()

Queue of the node.

public reach([string $queue = null ]) : mixed

Generic one. Must be overrided in children classes.

Parameters
$queue : string = null

Queue of the node (generally a filename, with probably a query).

reachId()

ID of the component.

public reachId(string $id) : mixed

Generic one. Should be overrided in children classes.

Parameters
$id : string

ID of the component.

Tags
throws
Exception

setReach()

Set a new reach value.

public setReach(string $reach) : string
Parameters
$reach : string

Reach value.

Return values
string

_resolve()

Resolve a path, i.e. iterate the nodes tree and reach the queue of the path.

protected _resolve(string $path, array<string|int, mixed> &$accumulator[, string $id = null ]) : mixed
Parameters
$path : string

Path to resolve.

$accumulator : array<string|int, mixed>

Combination of all possibles paths.

$id : string = null

ID.

_resolveChoice()

Resolve choices, i.e. a reach value has a “;”.

protected _resolveChoice(string $reach, array<string|int, mixed> &$accumulator) : void
Parameters
$reach : string

Reach value.

$accumulator : array<string|int, mixed>

Combination of all possibles paths.

getReach()

Get reach's root.

protected getReach() : string
Return values
string

        
On this page

Search results