Edge
in package
Uses
Attributes
Class representing an edge (arrow, line).
Tags
Table of Contents
- $attributes : array<string|int, Attribute>
- $from : Node
- $to : Node
- __call() : Attribute|Edge|null
- Magic method to provide a getter/setter to add attributes on the edge.
- __construct() : mixed
- Creates a new Edge / Link between the given nodes.
- __toString() : string
- Returns the edge definition as is requested by GraphViz.
- create() : self
- Factory method used to assist with fluent interface handling.
- getAttribute() : Attribute
- getFrom() : Node
- Returns the source Node for this Edge.
- getTo() : Node
- Returns the destination Node for this Edge.
- setAttribute() : self
Properties
$attributes
protected
array<string|int, Attribute>
$attributes
= []
$from
private
Node
$from
Node from where to link
$to
private
Node
$to
Node where to to link
Methods
__call()
Magic method to provide a getter/setter to add attributes on the edge.
public
__call(string $name, array<string|int, mixed> $arguments) : Attribute|Edge|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
-
name of the invoked method, expect it to be setX or getX.
- $arguments : array<string|int, mixed>
-
Arguments for the setter, only 1 is expected: value
Tags
Return values
Attribute|Edge|null —__construct()
Creates a new Edge / Link between the given nodes.
public
__construct(Node $from, Node $to) : mixed
Parameters
- $from : Node
-
Starting node to create an Edge from.
- $to : Node
-
Destination node where to create and edge to.
Return values
mixed —__toString()
Returns the edge 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(Node $from, Node $to) : self
See the examples for more details.
Parameters
- $from : Node
-
Starting node to create an Edge from.
- $to : Node
-
Destination node where to create and edge to.
Return values
self —getAttribute()
public
getAttribute(string $name) : Attribute
Parameters
- $name : string
Tags
Return values
Attribute —getFrom()
Returns the source Node for this Edge.
public
getFrom() : Node
Return values
Node —getTo()
Returns the destination Node for this Edge.
public
getTo() : Node
Return values
Node —setAttribute()
public
setAttribute(string $name, string $value) : self
Parameters
- $name : string
- $value : string