Completed
Push — master ( 9f7282...4881a6 )
by Nikola
01:20
created

CannotResolveLoggerComponent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 28.57%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 16
ccs 2
cts 7
cp 0.2857
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
    public static function resolutionFailed(string $serviceOrFactory, Throwable $previous): self
18
    {
19
        return new self(
20
            sprintf("Resolution of a '%s' logger component has failed. See previous error for more details.", $serviceOrFactory),
21
            0,
22
            $previous
23
        );
24
    }
25
}
26