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

CouldNotMap   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A encountered() 0 12 1
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