InvalidScalarDataException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Remorhaz\JSON\Path\Value\Exception;
6
7
use DomainException;
8
use Remorhaz\JSON\Data\Value\DataAwareInterface;
9
use Throwable;
10
11
final class InvalidScalarDataException extends DomainException implements
12
    ExceptionInterface,
13
    DataAwareInterface
14
{
15
16
    private $data;
17
18 5
    public function __construct($data, Throwable $previous = null)
19
    {
20 5
        $this->data = $data;
21 5
        parent::__construct($this->buildMessage(), 0, $previous);
22 5
    }
23
24 5
    private function buildMessage(): string
25
    {
26 5
        return "Invalid scalar data";
27
    }
28
29 1
    public function getData()
30
    {
31 1
        return $this->data;
32
    }
33
}
34