InvalidConfigPathException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 8
ccs 0
cts 6
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Diezz\YamlToObjectMapper;
4
5
use RuntimeException;
6
7
class InvalidConfigPathException extends RuntimeException
8
{
9
    public function __construct(array $config, ClassInfo $classInfo)
10
    {
11
        $message = "Yaml file contains properties that doesn't exists on a target class {$classInfo->getClassName()}:";
12
        foreach (array_keys($config) as $fieldName) {
13
            $message .= "\n- $fieldName";
14
        }
15
        $message .= "\nTo prevent this behaviour use #[IgnoreUnknown] on a target class";
16
        parent::__construct($message);
17
    }
18
}
19