Completed
Push — master ( a84ecf...ac90c5 )
by Nikola
01:16
created

CannotResolveLoggerComponent::resolutionFailed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MonologFactory\Exception;
6
7
use RuntimeException;
8
use Throwable;
9
10
final class CannotResolveLoggerComponent extends RuntimeException implements MonologFactoryException
11
{
12 3
    public static function unknownService(string $serviceOrFactory): self
13
    {
14 3
        return new self(sprintf("Cannot resolve '%s' logger component to a service or a factory class", $serviceOrFactory));
15
    }
16
17 1
    public static function resolutionFailed(string $serviceOrFactory, Throwable $previous): self
18
    {
19 1
        return new self(
20 1
            sprintf("Resolution of a '%s' logger component has failed. See previous error for more details.", $serviceOrFactory),
21 1
            0,
22 1
            $previous
23
        );
24
    }
25
}
26