DataSchemaException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 13
ccs 8
cts 8
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace CHStudio\Raven\Validator\Exception;
4
5
use RuntimeException;
6
use Throwable;
7
8
class DataSchemaException extends RuntimeException implements ValidationException
9
{
10 2
    public function __construct(
11
        public readonly mixed $value,
12
        public readonly string $path,
13
        Throwable $previous
14
    ) {
15 2
        $message = sprintf(
16 2
            "Data validation failed for property \"%s\", invalid value: %s\n\n> %s",
17 2
            $path,
18 2
            var_export($value, true),
19 2
            $previous->getMessage()
20 2
        );
21
22 2
        parent::__construct($message, 0, $previous);
23
    }
24
}
25