Passed
Push — master ( 97996b...04a345 )
by Pol
02:40
created

KeyValueNode::getKey()   A

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