TraverseStepItem::getVertex()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Smoren\GraphTools\Structs;
4
5
use Smoren\GraphTools\Models\Interfaces\EdgeInterface;
6
use Smoren\GraphTools\Models\Interfaces\VertexInterface;
7
use Smoren\GraphTools\Structs\Interfaces\TraverseStepPairInterface;
8
9
/**
10
 * Pair of Vertex and Edge (if given) class
11
 * @author Smoren <[email protected]>
12
 */
13
class TraverseStepItem implements TraverseStepPairInterface
14
{
15
    /**
16
     * @var EdgeInterface|null edge or null
17
     */
18
    protected ?EdgeInterface $edge;
19
    /**
20
     * @var VertexInterface vertex
21
     */
22
    protected VertexInterface $vertex;
23
24
    /**
25
     * EdgeVertexPair constructor
26
     * @param EdgeInterface|null $edge edge or null
27
     * @param VertexInterface $vertex vertex
28
     */
29
    public function __construct(?EdgeInterface $edge, VertexInterface $vertex)
30
    {
31
        $this->edge = $edge;
32
        $this->vertex = $vertex;
33
    }
34
35
    /**
36
     * @inheritDoc
37
     */
38
    public function getEdge(): ?EdgeInterface
39
    {
40
        return $this->edge;
41
    }
42
43
    /**
44
     * @inheritDoc
45
     */
46
    public function getVertex(): VertexInterface
47
    {
48
        return $this->vertex;
49
    }
50
}
51