InvalidFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

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

1 Method

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