Node::setRight()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
4
namespace Hexogen\KDTree;
5
6
use Hexogen\KDTree\Interfaces\NodeInterface;
7
use Hexogen\KDTree\Interfaces\ItemInterface;
8
9
class Node implements NodeInterface
10
{
11
    /**
12
     * @var ItemInterface
13
     */
14
    private $item;
15
16
    /**
17
     * @var NodeInterface|null
18
     */
19
    private $left;
20
21
    /**
22
     * @var NodeInterface|null
23
     */
24
    private $right;
25
26
    /**
27
     * Node constructor.
28
     * @param ItemInterface $item
29
     */
30 96
    public function __construct(ItemInterface $item)
31
    {
32 96
        $this->item = $item;
33 96
        $this->left = null;
34 96
        $this->right = null;
35 96
    }
36
37
    /**
38
     * @return ItemInterface get item from the node
39
     */
40 72
    public function getItem() : ItemInterface
41
    {
42 72
        return $this->item;
43
    }
44
45
    /**
46
     * @param NodeInterface $node set right node
47
     */
48 75
    public function setRight(NodeInterface $node): void
49
    {
50 75
        $this->right = $node;
51 75
    }
52
53
    /**
54
     * @param NodeInterface $node set left node
55
     */
56 78
    public function setLeft(NodeInterface $node): void
57
    {
58 78
        $this->left = $node;
59 78
    }
60
61
    /**
62
     * @return NodeInterface|null get right node
63
     */
64 69
    public function getRight(): ?NodeInterface
65
    {
66 69
        return $this->right;
67
    }
68
69
    /**
70
     * @return NodeInterface|null get left node
71
     */
72 69
    public function getLeft(): ?NodeInterface
73
    {
74 69
        return $this->left;
75
    }
76
}
77