Completed
Push — master ( 5033a3...4be7fb )
by Bartko
03:45
created

NodeInfo::setNeedUpdate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace StefanoTree\NestedSet;
3
4
class NodeInfo
5
{
6
    private $id;
7
    private $parentId;
8
    private $level;
9
    private $left;
10
    private $right;
11
    private $scope;
12
13
    /**
14
     * NodeInfo constructor.
15
     * @param $id int
16
     * @param $parentId int
17
     * @param $level int
18
     * @param $left int
19
     * @param $right int
20
     * @param $scope null|int if scope is not used
21
     */
22
    public function __construct($id, $parentId, $level, $left, $right, $scope)
23
    {
24 86
        $this->id       = $id;
25
        $this->parentId = $parentId;
26 86
        $this->level    = $level;
27 86
        $this->left     = $left;
28 86
        $this->right    = $right;
29 86
        $this->scope    = $scope;
30 86
    }
31 86
32 86
    /**
33
     * @return int
34
     */
35
    public function getId()
36
    {
37 25
        return $this->id;
38
    }
39 25
40
    /**
41
     * @return int
42
     */
43
    public function getParentId()
44
    {
45 54
        return $this->parentId;
46
    }
47 54
48
    /**
49
     * @param $level int
50
     */
51
    public function setLevel($level)
52
    {
53 7
        $this->level = $level;
54
    }
55 7
56 7
    /**
57
     * @return int
58
     */
59
    public function getLevel()
60
    {
61 62
        return $this->level;
62
    }
63 62
64
    /**
65
     * @param $left int
66
     */
67
    public function setLeft($left)
68
    {
69 7
        $this->left = $left;
70
    }
71 7
72 7
    /**
73
     * @return int
74
     */
75
    public function getLeft()
76
    {
77 77
        return $this->left;
78
    }
79 77
80
    /**
81
     * @param $right int
82
     */
83
    public function setRight($right)
84
    {
85 7
        $this->right = $right;
86
    }
87 7
88 7
    /**
89
     * @return int
90
     */
91
    public function getRight()
92
    {
93 77
        return $this->right;
94
    }
95 77
96
    /**
97
     * @return int|null
98
     */
99
    public function getScope()
100
    {
101 53
        return $this->scope;
102
    }
103 53
104
    /**
105
     * @return bool
106
     */
107
    public function isRoot()
108
    {
109 17
        if (0 == $this->getParentId()) {
110
            return true;
111 17
        } else {
112 13
            return false;
113
        }
114 16
    }
115
}
116