Node
in package
Uses
Attributes
Class representing a node / element in a graph.
Tags
Table of Contents
- $attributes : array<string|int, Attribute>
- $name : string
- __call() : Attribute|Node|null
- Magic method to provide a getter/setter to add attributes on the Node.
- __construct() : mixed
- Creates a new node with name and optional label.
- __toString() : string
- Returns the node definition as is requested by GraphViz.
- create() : self
- Factory method used to assist with fluent interface handling.
- getAttribute() : Attribute
- getName() : string
- Returns the name for this node.
- setAttribute() : self
- setLabel() :
- setName() : self
- Sets the name for this node.
Properties
$attributes
protected
array<string|int, Attribute>
$attributes
= []
$name
protected
string
$name
= ''
Name for this node
Methods
__call()
Magic method to provide a getter/setter to add attributes on the Node.
public
__call(string $name, array<string|int, mixed> $arguments) : Attribute|Node|null
Using this method we make sure that we support any attribute without too much hassle. If the name for this method does not start with get or set we return null.
Set methods return this graph (fluent interface) whilst get methods return the attribute value.
Parameters
- $name : string
-
Method name; either getX or setX is expected.
- $arguments : array<string|int, mixed>
-
List of arguments; only 1 is expected for setX.
Tags
Return values
Attribute|Node|null —__construct()
Creates a new node with name and optional label.
public
__construct(string $name[, string|null $label = null ]) : mixed
Parameters
- $name : string
-
Name of the new node.
- $label : string|null = null
-
Optional label text.
Return values
mixed —__toString()
Returns the node definition as is requested by GraphViz.
public
__toString() : string
Return values
string —create()
Factory method used to assist with fluent interface handling.
public
static create(string $name[, string|null $label = null ]) : self
See the examples for more details.
Parameters
- $name : string
-
Name of the new node.
- $label : string|null = null
-
Optional label text.
Return values
self —getAttribute()
public
getAttribute(string $name) : Attribute
Parameters
- $name : string
Tags
Return values
Attribute —getName()
Returns the name for this node.
public
getName() : string
Return values
string —setAttribute()
public
setAttribute(string $name, string $value) : self
Parameters
- $name : string
- $value : string
Return values
self —setLabel()
public
setLabel(string $name) :
Sets the label for this node.
Parameters
- $name : string
Return values
—setName()
Sets the name for this node.
public
setName(string $name) : self
Not to confuse with the label.
Parameters
- $name : string
-
Name for this node.