InvalidScalarDataException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildMessage() 0 3 1
A getData() 0 3 1
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