Completed
Push — master ( fce883...b7eaea )
by Westin
03:16
created

RedisHandlerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 16 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11MonoLog\Handler;
5
6
use Monolog\Handler\RedisHandler;
7
use Monolog\Logger;
8
use WShafer\PSR11MonoLog\ClientTrait;
9
use WShafer\PSR11MonoLog\ContainerAwareInterface;
10
use WShafer\PSR11MonoLog\FactoryInterface;
11
12
class RedisHandlerFactory implements FactoryInterface, ContainerAwareInterface
13
{
14
    use ClientTrait;
15
16 1
    public function __invoke(array $options)
17
    {
18 1
        $client  = $this->getClient($options);
19 1
        $key     = (string)  ($options['key']     ?? '');
20 1
        $level   = (int)     ($options['level']   ?? Logger::DEBUG);
21 1
        $bubble  = (boolean) ($options['bubble']  ?? true);
22 1
        $capSize = (int)     ($options['capSize'] ?? 0);
23
24 1
        return new RedisHandler(
25 1
            $client,
26 1
            $key,
27 1
            $level,
28 1
            $bubble,
29 1
            $capSize
30
        );
31
    }
32
}
33