SyslogUdpHandlerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 18 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WShafer\PSR11MonoLog\Handler;
6
7
use Monolog\Handler\SyslogUdpHandler;
8
use Monolog\Logger;
9
use WShafer\PSR11MonoLog\FactoryInterface;
10
11
class SyslogUdpHandlerFactory implements FactoryInterface
12
{
13 1
    public function __invoke(array $options)
14
    {
15 1
        $host     = (string)  ($options['host']     ?? '');
16 1
        $port     = (int)     ($options['host']     ?? 514);
17 1
        $facility = (int)     ($options['facility'] ?? LOG_USER);
18 1
        $level    = (int)     ($options['level']    ?? Logger::DEBUG);
19 1
        $bubble   = (bool) ($options['bubble']   ?? true);
20 1
        $ident    = (string)  ($options['ident']    ?? 'php');
21
22 1
        return new SyslogUdpHandler(
23 1
            $host,
24 1
            $port,
25 1
            $facility,
26 1
            $level,
27 1
            $bubble,
28 1
            $ident
29
        );
30
    }
31
}
32