Test Failed
Push — main ( 450f80...a11e57 )
by Fractal
02:32
created

ExceptionMapperLocatorException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A noMapperFound() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FRZB\Component\RequestMapper\Exception;
6
7
final class ExceptionMapperLocatorException extends \DomainException
8
{
9
    private const NO_MAPPER_FOUND_MESSAGE = 'No mapper found for exception "%s"';
10
11
    public static function noMapperFound(\Throwable $previous, bool $wrapCallable = true)
12
    {
13
        $message = sprintf(self::NO_MAPPER_FOUND_MESSAGE, $previous::class);
14
        $exception = new self($message, previous: $previous);
15
16
        return $wrapCallable ? static fn () => throw $exception : $exception;
17
    }
18
}
19