Completed
Push — master ( 2cee6a...9d457f )
by Jesse
03:27
created

CouldNotMap::encountered()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stratadox\Hydration\Hydrator;
6
7
use ReflectionClass;
8
use RuntimeException;
9
use function sprintf;
10
use Stratadox\Hydration\UnmappableInput;
11
use Throwable;
12
13
final class CouldNotMap extends RuntimeException implements UnmappableInput
14
{
15
    public static function encountered(
16
        Throwable $exception,
17
        ReflectionClass $class
18
    ) : self
19
    {
20
        return new self(
21
            sprintf('Could not map the class `%s`: %s',
22
                $class->getName(),
23
                $exception->getMessage()
24
            ),
25
            0,
26
            $exception
27
        );
28
    }
29
}
30