NodeScalarValue::getPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\JSON\Data\Value\DecodedJson;
6
7
use Remorhaz\JSON\Data\Path\PathInterface;
8
use Remorhaz\JSON\Data\Value\NodeValueInterface;
9
use Remorhaz\JSON\Data\Value\ScalarValueInterface;
10
11
final class NodeScalarValue implements NodeValueInterface, ScalarValueInterface
12
{
13
14
    private $data;
15
16
    private $path;
17
18
    public function __construct($data, PathInterface $path)
19
    {
20
        if (null !== $data && !is_scalar($data)) {
21
            throw new Exception\InvalidNodeDataException($data, $path);
22
        }
23
        $this->data = $data;
24
        $this->path = $path;
25
    }
26
27
    public function getData()
28
    {
29
        return $this->data;
30
    }
31
32
    public function getPath(): PathInterface
33
    {
34
        return $this->path;
35
    }
36
}
37