KeyValueNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 5
dl 0
loc 10
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types=1);
9
10
namespace loophp\phptree\Node;
11
12
use loophp\phptree\Traverser\TraverserInterface;
13
14
/**
15
 * Class KeyValueNode.
16
 */
17
class KeyValueNode extends ValueNode implements KeyValueNodeInterface
18
{
19
    /**
20
     * @var mixed
21
     */
22
    private $key;
23
24
    /**
25
     * KeyValueNode constructor.
26
     *
27
     * @param mixed|null $key
28
     * @param mixed|null $value
29
     */
30 5
    public function __construct(
31
        $key,
32
        $value,
33
        int $capacity = 0,
34
        ?TraverserInterface $traverser = null,
35
        ?NodeInterface $parent = null
36
    ) {
37 5
        parent::__construct($value, $capacity, $traverser, $parent);
38
39 5
        $this->key = $key;
40 5
    }
41
42 2
    public function getKey()
43
    {
44 2
        return $this->key;
45
    }
46
}
47