ValueNode   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A label() 0 3 1
A getValue() 0 3 1
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 ValueNode.
16
 */
17
class ValueNode extends NaryNode implements ValueNodeInterface
18
{
19
    /**
20
     * @var mixed
21
     */
22
    private $value;
23
24
    /**
25
     * ValueNode constructor.
26
     *
27
     * @param mixed|null $value
28
     */
29 37
    public function __construct(
30
        $value,
31
        int $capacity = 0,
32
        ?TraverserInterface $traverser = null,
33
        ?NodeInterface $parent = null
34
    ) {
35 37
        parent::__construct($capacity, $traverser, $parent);
36
37 37
        $this->value = $value;
38 37
    }
39
40 25
    public function getValue()
41
    {
42 25
        return $this->value;
43
    }
44
45 13
    public function label(): string
46
    {
47 13
        return (string) $this->getValue();
48
    }
49
}
50