Passed
Push — master ( 1df370...dc6623 )
by Andrii
01:30
created

Node::__construct()   A

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
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KDTree\Structure;
6
7
use KDTree\{Interfaces\NodeInterface, Interfaces\PointInterface};
8
9
class Node implements NodeInterface
10
{
11
    /**
12
     * @var PointInterface
13
     */
14
    private $point;
15
16
    /**
17
     * @var NodeInterface|null
18
     */
19
    private $left;
20
21
    /**
22
     * @var NodeInterface|null
23
     */
24
    private $right;
25
26
    /**
27
     * @param PointInterface $point
28
     */
29
    public function __construct(PointInterface $point)
30
    {
31
        $this->point = $point;
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37
    public function getPoint(): PointInterface
38
    {
39
        return $this->point;
40
    }
41
42
    /**
43
     * @inheritDoc
44
     */
45
    public function setPoint(?PointInterface $point): NodeInterface
46
    {
47
        $this->point = $point;
48
49
        return $this;
50
    }
51
52
    /**
53
     * @inheritDoc
54
     */
55
    public function getLeft(): ?NodeInterface
56
    {
57
        return $this->left;
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63
    public function setLeft(?NodeInterface $node): NodeInterface
64
    {
65
        $this->left = $node;
66
67
        return $this;
68
    }
69
70
    /**
71
     * @inheritDoc
72
     */
73
    public function getRight(): ?NodeInterface
74
    {
75
        return $this->right;
76
    }
77
78
    /**
79
     * @inheritDoc
80
     */
81
    public function setRight(?NodeInterface $node): NodeInterface
82
    {
83
        $this->right = $node;
84
85
        return $this;
86
    }
87
}
88