Completed
Push — master ( b7eaea...0fe4ba )
by Westin
09:24
created

MongoDBHandlerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 16
Ratio 100 %

Importance

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