Node
in package
uses
Attributes
Class representing a node / element in a graph.
Tags
Table of Contents
Properties
- $attributes : array<string|int, Attribute>
- $name : string
Methods
- __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() : void
- 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.
__toString()
Returns the node definition as is requested by GraphViz.
public
__toString() : string
Return values
stringcreate()
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
selfgetAttribute()
public
getAttribute(string $name) : Attribute
Parameters
- $name : string
Tags
Return values
AttributegetName()
Returns the name for this node.
public
getName() : string
Return values
stringsetAttribute()
public
setAttribute(string $name, string $value) : self
Parameters
- $name : string
- $value : string
Return values
selfsetLabel()
public
setLabel(string $name) : void
Sets the label for this node.
Parameters
- $name : string
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.