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

CannotResolveLoggerComponent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A unknownService() 0 4 1
A resolutionFailed() 0 8 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