Completed
Push — develop ( c7250c...c08e7b )
by Bartko
07:18 queued 03:02
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 113
    public function __construct($id, $parentId, $level, $left, $right, $scope)
23
    {
24 113
        $this->id       = $id;
25 113
        $this->parentId = $parentId;
26 113
        $this->level    = $level;
27 113
        $this->left     = $left;
28 113
        $this->right    = $right;
29 113
        $this->scope    = $scope;
30 113
    }
31
32
    /**
33
     * @return int
34
     */
35 37
    public function getId()
36
    {
37 37
        return $this->id;
38
    }
39
40
    /**
41
     * @return int
42
     */
43 50
    public function getParentId()
44
    {
45 50
        return $this->parentId;
46
    }
47
48
    /**
49
     * @param $level int
50
     */
51 3
    public function setLevel($level)
52
    {
53 3
        $this->level = $level;
54 3
    }
55
56
    /**
57
     * @return int
58
     */
59 72
    public function getLevel()
60
    {
61 72
        return $this->level;
62
    }
63
64
    /**
65
     * @param $left int
66
     */
67 3
    public function setLeft($left)
68
    {
69 3
        $this->left = $left;
70 3
    }
71
72
    /**
73
     * @return int
74
     */
75 106
    public function getLeft()
76
    {
77 106
        return $this->left;
78
    }
79
80
    /**
81
     * @param $right int
82
     */
83 3
    public function setRight($right)
84
    {
85 3
        $this->right = $right;
86 3
    }
87
88
    /**
89
     * @return int
90
     */
91 105
    public function getRight()
92
    {
93 105
        return $this->right;
94
    }
95
96
    /**
97
     * @return int|null
98
     */
99 35
    public function getScope()
100
    {
101 35
        return $this->scope;
102
    }
103
104
    /**
105
     * @return bool
106
     */
107 7
    public function isRoot()
108
    {
109 7
        if (0 == $this->getParentId()) {
110 5
            return true;
111
        } else {
112 6
            return false;
113
        }
114
    }
115
}
116