Completed
Push — master ( 20dd79...fbc01c )
by Westin
04:56 queued 03:09
created

BufferHandlerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 0
Metric Value
dl 16
loc 16
ccs 12
cts 12
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11MonoLog\Handler;
5
6
use Monolog\Handler\BufferHandler;
7
use Monolog\Logger;
8
use WShafer\PSR11MonoLog\HandlerManagerAwareInterface;
9
use WShafer\PSR11MonoLog\HandlerManagerTrait;
10
use WShafer\PSR11MonoLog\FactoryInterface;
11
12 View Code Duplication
class BufferHandlerFactory implements FactoryInterface, HandlerManagerAwareInterface
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    use HandlerManagerTrait;
15
16 1
    public function __invoke(array $options)
17
    {
18 1
        $handler          = $this->getHandlerManager()->get($options['handler']);
19 1
        $bufferLimit      = (int)     ($options['bufferLimit']     ?? 0);
20 1
        $level            = (int)     ($options['level']           ?? Logger::DEBUG);
21 1
        $bubble           = (boolean) ($options['bubble']          ?? true);
22 1
        $flushOnOverflow  = (boolean) ($options['flushOnOverflow'] ?? true);
23
24 1
        return new BufferHandler(
25 1
            $handler,
26 1
            $bufferLimit,
27 1
            $level,
28 1
            $bubble,
29 1
            $flushOnOverflow
30
        );
31
    }
32
}
33