Index::addChild()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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