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

InvalidFactory::threwException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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