Index   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 42
ccs 5
cts 5
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addChild() 0 3 1
A __construct() 0 4 2
1
<?php
2
3
namespace HughCube\HTree;
4
5
class Index
6
{
7
    /**
8
     * @var int|string
9
     */
10
    public $id;
11
12
    /**
13
     * @var int
14
     */
15
    public $level;
16
17
    /**
18
     * @var int
19
     */
20
    public $left;
21
22
    /**
23
     * @var int
24
     */
25
    public $right;
26
27
    /**
28
     * @var int|string
29
     */
30
    public $parent;
31
32
    /**
33
     * @var static[]
34
     */
35
    public $children = [];
36
37 2
    public function __construct(array $properties)
38
    {
39 2
        foreach ($properties as $name => $property) {
40 2
            $this->{$name} = $property;
41
        }
42
    }
43
44 2
    public function addChild($index)
45
    {
46 2
        $this->children[] = $index;
47
    }
48
}
49