Index::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
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