Completed
Push — master ( cc8038...edef00 )
by Bartko
01:27
created

NodeInfo::setLevel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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