Completed
Push — master ( bdaaad...4f4372 )
by personal
04:35 queued 45s
created

Edge::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * (c) Jean-François Lépine <https://twitter.com/Halleck45>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Hal\Component\Tree;
11
12
class Edge
13
{
14
15
    /**
16
     * @var Node
17
     */
18
    private $from;
19
20
    /**
21
     * @var Node
22
     */
23
    private $to;
24
25
    /**
26
     * @var boolean
27
     */
28
    public $cyclic = false;
29
30
    /**
31
     * Edge constructor.
32
     * @param Node $from
33
     * @param Node $to
34
     */
35
    public function __construct(Node $from, Node $to)
36
    {
37
        $this->from = $from;
38
        $this->to = $to;
39
    }
40
41
    /**
42
     * @return Node
43
     */
44
    public function getFrom()
45
    {
46
        return $this->from;
47
    }
48
49
    /**
50
     * @return Node
51
     */
52
    public function getTo()
53
    {
54
        return $this->to;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function asString()
61
    {
62
        return sprintf('%s -> %s', $this->from->getKey(), $this->to->getKey());
63
    }
64
}