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

ExceptionMapperLocatorException::noMapperFound()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
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