Completed
Push — master ( 898923...2395af )
by Westin
01:43
created

SyslogUdpHandlerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 0
cts 14
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 1
crap 2
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11MonoLog\Handler;
5
6
use Monolog\Handler\SyslogUdpHandler;
7
use Monolog\Logger;
8
use WShafer\PSR11MonoLog\FactoryInterface;
9
10
class SyslogUdpHandlerFactory implements FactoryInterface
11
{
12
    public function __invoke(array $options)
13
    {
14
        $host     = (string)  ($options['host']     ?? '');
15
        $port     = (int)     ($options['host']     ?? 514);
16
        $facility = (int)     ($options['facility'] ?? LOG_USER);
17
        $level    = (int)     ($options['level']    ?? Logger::DEBUG);
18
        $bubble   = (boolean) ($options['bubble']   ?? true);
19
        $ident    = (string)  ($options['ident']    ?? 'php');
20
21
        return new SyslogUdpHandler(
22
            $host,
23
            $port,
24
            $facility,
25
            $level,
26
            $bubble,
27
            $ident
28
        );
29
    }
30
}
31