Completed
Push — master ( 3046ca...6411fa )
by Jesse
02:05
created

InvalidFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A threwException() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stratadox\Di;
6
7
use RuntimeException;
8
use function sprintf;
9
use Throwable;
10
11
final class InvalidFactory extends RuntimeException implements InvalidServiceDefinition
12
{
13
    public static function threwException(
14
        string $serviceName,
15
        Throwable $exception
16
    ) : Throwable
17
    {
18
        return new static(sprintf(
19
            'Service `%s` was configured incorrectly and could not be created: %s',
20
            $serviceName,
21
            $exception->getMessage()
22
        ), 0, $exception);
23
    }
24
}
25