Completed
Push — master ( 537349...e26b4a )
by Westin
11:04
created

LogmaticHandlerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11MonoLog\Handler;
5
6
use Monolog\Handler\LogmaticHandler;
7
use Monolog\Logger;
8
use WShafer\PSR11MonoLog\FactoryInterface;
9
10
class LogmaticHandlerFactory implements FactoryInterface
11
{
12
    public function __invoke(array $options)
13
    {
14
        $token    = (string)  ($options['token']  ?? '');
15
        $hostname = (string)  ($options['hostname'] ?? '');
16
        $appname  = (string)  ($options['appname'] ?? '');
17
        $useSSL   = (bool)    ($options['useSSL'] ?? true);
18
        $level    = (int)     ($options['level']  ?? Logger::DEBUG);
19
        $bubble   = (boolean) ($options['bubble'] ?? true);
20
21
        return new LogmaticHandler(
22
            $token,
23
            $hostname,
24
            $appname,
25
            $useSSL,
26
            $level,
27
            $bubble
28
        );
29
    }
30
}
31