Passed
Push — master ( c69a90...df5d45 )
by Edward
04:44
created

NodeScalarValue::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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 4
    public function __construct($data, PathInterface $path)
18
    {
19 4
        if (null !== $data && !is_scalar($data)) {
20 4
            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