Passed
Push — master ( 76b76b...ca78d8 )
by Edward
02:11
created

NodeScalarValue::getPath()   A

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
declare(strict_types=1);
3
4
namespace Remorhaz\JSON\Data\Value\DecodedJson;
5
6
use Remorhaz\JSON\Data\Path\PathInterface;
7
use Remorhaz\JSON\Data\Value\NodeValueInterface;
8
use Remorhaz\JSON\Data\Value\ScalarValueInterface;
9
10
final class NodeScalarValue implements NodeValueInterface, ScalarValueInterface
11
{
12
13
    private $data;
14
15
    private $path;
16
17
    public function __construct($data, PathInterface $path)
18
    {
19
        if (null !== $data && !is_scalar($data)) {
20
            throw new Exception\InvalidNodeDataException($data, $path);
21
        }
22
        $this->data = $data;
23
        $this->path = $path;
24
    }
25
26
    public function getData()
27
    {
28
        return $this->data;
29
    }
30
31
    public function getPath(): PathInterface
32
    {
33
        return $this->path;
34
    }
35
}
36