Completed
Push — develop ( d0fbe3...729812 )
by Bartko
14:43
created

NodeInfo   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 1 Features 1
Metric Value
wmc 9
c 5
b 1
f 1
lcom 1
cbo 0
dl 0
loc 79
ccs 24
cts 24
cp 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getId() 0 4 1
A getParentId() 0 4 1
A getLevel() 0 4 1
A getLeft() 0 4 1
A getRight() 0 4 1
A getScope() 0 4 1
A isRoot() 0 8 2
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 73
    public function __construct($id, $parentId, $level, $left, $right, $scope=null)
14
    {
15 73
        $this->id       = $id;
16 73
        $this->parentId = $parentId;
17 73
        $this->level    = $level;
18 73
        $this->left     = $left;
19 73
        $this->right    = $right;
20 73
        $this->scope    = $scope;
21 73
    }
22
23
    /**
24
     * @return int|null
25
     */
26 17
    public function getId()
27
    {
28 17
        return $this->id;
29
    }
30
31
    /**
32
     * @return int|null
33
     */
34 46
    public function getParentId()
35
    {
36 46
        return $this->parentId;
37
    }
38
39
    /**
40
     * @return int|null
41
     */
42 53
    public function getLevel()
43
    {
44 53
        return $this->level;
45
    }
46
47
    /**
48
     * @return int|null
49
     */
50 68
    public function getLeft()
51
    {
52 68
        return $this->left;
53
    }
54
55
    /**
56
     * @return int|null
57
     */
58 68
    public function getRight()
59
    {
60 68
        return $this->right;
61
    }
62
63
    /**
64
     * @return null|int
65
     */
66 53
    public function getScope()
67
    {
68 53
        return $this->scope;
69
    }
70
71
    /**
72
     * @return bool
73
     */
74 17
    public function isRoot()
75
    {
76 17
        if (0 == $this->getParentId()) {
0 ignored issues
show
Bug introduced by
It seems like you are loosely comparing $this->getParentId() of type integer|null to 0; this is ambiguous as not only 0 == 0 is true, but null == 0 is true, too. Consider using a strict comparison ===.
Loading history...
77 13
            return true;
78
        } else {
79 16
            return false;
80
        }
81
    }
82
}
83