Completed
Push — master ( fbc01c...6057b3 )
by Westin
15s
created

PHPConsoleHandlerFactory::getConnector()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 1
crap 3
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11MonoLog\Handler;
5
6
use Monolog\Handler\PHPConsoleHandler;
7
use Monolog\Logger;
8
use WShafer\PSR11MonoLog\ContainerAwareInterface;
9
use WShafer\PSR11MonoLog\FactoryInterface;
10
use WShafer\PSR11MonoLog\ServiceTrait;
11
12 View Code Duplication
class PHPConsoleHandlerFactory implements FactoryInterface, ContainerAwareInterface
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 ServiceTrait;
15
16 1
    public function __invoke(array $options)
17
    {
18 1
        $consoleOptions = (array)   ($options['options'] ?? []);
19 1
        $connector      = $this->getService($options['connector'] ?? null);
20 1
        $level          = (int)     ($options['level']   ?? Logger::DEBUG);
21 1
        $bubble         = (boolean) ($options['bubble']  ?? true);
22
23 1
        return new PHPConsoleHandler(
24 1
            $consoleOptions,
25 1
            $connector,
26 1
            $level,
27 1
            $bubble
28
        );
29
    }
30
}
31