Node::setPoint()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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