InvalidFactory::threwException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Di;
4
5
use RuntimeException;
6
use function sprintf;
7
use Throwable;
8
9
final class InvalidFactory extends RuntimeException implements InvalidServiceDefinition
10
{
11
    public static function threwException(
12
        string $serviceName,
13
        Throwable $exception
14
    ): InvalidServiceDefinition {
15
        return new static(sprintf(
16
            'Service `%s` was configured incorrectly and could not be created: %s',
17
            $serviceName,
18
            $exception->getMessage()
19
        ), 0, $exception);
20
    }
21
}
22