1 | <?php |
||
23 | class Edge |
||
24 | { |
||
25 | /** @var \phpDocumentor\GraphViz\Node Node from where to link */ |
||
26 | protected $from = null; |
||
27 | |||
28 | /** @var \phpDocumentor\GraphViz\Node Node where to to link */ |
||
29 | protected $to = null; |
||
30 | |||
31 | /** @var \phpDocumentor\GraphViz\Attribute[] List of attributes for this edge */ |
||
32 | protected $attributes = []; |
||
33 | |||
34 | /** |
||
35 | * Creates a new Edge / Link between the given nodes. |
||
36 | * |
||
37 | * @param \phpDocumentor\GraphViz\Node $from Starting node to create an Edge from. |
||
38 | * @param \phpDocumentor\GraphViz\Node $to Destination node where to create and |
||
39 | * edge to. |
||
40 | */ |
||
41 | public function __construct(Node $from, Node $to) |
||
46 | |||
47 | /** |
||
48 | * Factory method used to assist with fluent interface handling. |
||
49 | * |
||
50 | * See the examples for more details. |
||
51 | * |
||
52 | * @param \phpDocumentor\GraphViz\Node $from Starting node to create an Edge from. |
||
53 | * @param \phpDocumentor\GraphViz\Node $to Destination node where to create and |
||
54 | * edge to. |
||
55 | * |
||
56 | * @return \phpDocumentor\GraphViz\Edge |
||
57 | */ |
||
58 | 1 | public static function create(Node $from, Node $to) |
|
62 | |||
63 | /** |
||
64 | * Returns the source Node for this Edge. |
||
65 | * |
||
66 | * @return \phpDocumentor\GraphViz\Node |
||
67 | */ |
||
68 | 1 | public function getFrom() |
|
72 | |||
73 | /** |
||
74 | * Returns the destination Node for this Edge. |
||
75 | * |
||
76 | * @return \phpDocumentor\GraphViz\Node |
||
77 | */ |
||
78 | 1 | public function getTo() |
|
82 | |||
83 | /** |
||
84 | * Magic method to provide a getter/setter to add attributes on the edge. |
||
85 | * |
||
86 | * Using this method we make sure that we support any attribute without too |
||
87 | * much hassle. If the name for this method does not start with get or set |
||
88 | * we return null. |
||
89 | * |
||
90 | * Set methods return this graph (fluent interface) whilst get methods |
||
91 | * return the attribute value. |
||
92 | * |
||
93 | * @param string $name name of the invoked method, expect it to be |
||
94 | * setX or getX. |
||
95 | * @param mixed[] $arguments Arguments for the setter, only 1 is expected: value |
||
96 | * |
||
97 | * @return \phpDocumentor\GraphViz\Attribute|\phpDocumentor\GraphViz\Edge|null |
||
98 | */ |
||
99 | 1 | public function __call($name, $arguments) |
|
114 | |||
115 | /** |
||
116 | * Returns the edge definition as is requested by GraphViz. |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | 1 | public function __toString() |
|
138 | } |
||
139 |