ZendMonitorHandlerFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 6
Ratio 60 %

Importance

Changes 0
Metric Value
dl 6
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WShafer\PSR11MonoLog\Handler;
6
7
use Monolog\Handler\MissingExtensionException;
8
use Monolog\Handler\ZendMonitorHandler;
9
use Monolog\Logger;
10
use WShafer\PSR11MonoLog\FactoryInterface;
11
12
/**
13
 * @codeCoverageIgnore
14
 *
15
 * No Zend Server available to test against
16
 */
17 View Code Duplication
class ZendMonitorHandlerFactory implements FactoryInterface
18
{
19
    /**
20
     * @param array $options
21
     * @return ZendMonitorHandler
22
     * @throws MissingExtensionException
23
     */
24
    public function __invoke(array $options)
25
    {
26
        $level  = (int)     ($options['level']  ?? Logger::DEBUG);
27
        $bubble = (bool) ($options['bubble'] ?? true);
28
29
        return new ZendMonitorHandler(
30
            $level,
31
            $bubble
32
        );
33
    }
34
}
35