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

InvalidOptions::invalidHandlers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MonologFactory\Exception;
6
7
use InvalidArgumentException;
8
use Monolog\Formatter\FormatterInterface;
9
use Monolog\Handler\HandlerInterface;
10
11
final class InvalidOptions extends InvalidArgumentException implements MonologFactoryException
12
{
13 1
    public static function invalidHandlers($handlers): self
14
    {
15 1
        return new self(sprintf("'handlers' should be an array; %s given", gettype($handlers)));
16
    }
17
18 1
    public static function invalidHandler($handler): self
19
    {
20 1
        return new self(sprintf(
21 1
            "'handlers' item should be either %s instance or an factory input array; %s given",
22 1
            HandlerInterface::class,
23 1
            gettype($handler)
24
        ));
25
    }
26
27 1
    public static function invalidProcessors($processors): self
28
    {
29 1
        return new self(sprintf("'processors' should be an array; %s given", gettype($processors)));
30
    }
31
32 1
    public static function invalidProcessor($processor): self
33
    {
34 1
        return new self(sprintf(
35 1
            "'processors' item should be either callable or an factory input array; %s given",
36 1
            gettype($processor)
37
        ));
38
    }
39
40 1
    public static function invalidFormatter($formatter): self
41
    {
42 1
        return new self(sprintf(
43 1
            "Handler 'formatter' should be either %s instance or an factory input array; %s given",
44 1
            FormatterInterface::class,
45 1
            gettype($formatter)
46
        ));
47
    }
48
}
49