PushoverHandlerFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 22
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 22
cts 22
cp 1
rs 9.504
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WShafer\PSR11MonoLog\Handler;
6
7
use Monolog\Handler\PushoverHandler;
8
use Monolog\Logger;
9
use WShafer\PSR11MonoLog\FactoryInterface;
10
11
class PushoverHandlerFactory implements FactoryInterface
12
{
13 1
    public function __invoke(array $options)
14
    {
15 1
        $token             = (string)  ($options['token']             ?? '');
16 1
        $users             = (array)   ($options['users']             ?? []);
17 1
        $title             =            $options['title']             ?? null;
18 1
        $level             = (int)     ($options['level']             ?? Logger::DEBUG);
19 1
        $bubble            = (bool) ($options['bubble']            ?? true);
20 1
        $useSSL            = (bool) ($options['useSSL']            ?? true);
21 1
        $highPriorityLevel = (int)     ($options['highPriorityLevel'] ?? Logger::CRITICAL);
22 1
        $emergencyLevel    = (int)     ($options['emergencyLevel']    ?? Logger::EMERGENCY);
23 1
        $retry             = (int)     ($options['retry']             ?? 30);
24 1
        $expire            = (int)     ($options['expire']            ?? 25200);
25
26 1
        return new PushoverHandler(
27 1
            $token,
28 1
            $users,
29 1
            $title,
30 1
            $level,
31 1
            $bubble,
32 1
            $useSSL,
33 1
            $highPriorityLevel,
34 1
            $emergencyLevel,
35 1
            $retry,
36 1
            $expire
37
        );
38
    }
39
}
40