SendGridHandlerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
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 26
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 20 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WShafer\PSR11MonoLog\Handler;
6
7
use Monolog\Handler\SendGridHandler;
8
use Monolog\Logger;
9
use WShafer\PSR11MonoLog\FactoryInterface;
10
11
class SendGridHandlerFactory implements FactoryInterface
12
{
13
    /**
14
     * * @SuppressWarnings(PHPMD.ShortVariable)
15
     */
16 1
    public function __invoke(array $options)
17
    {
18 1
        $apiUser    = (string)  ($options['apiUser'] ?? '');
19 1
        $apiKey     = (string)  ($options['apiKey']  ?? '');
20 1
        $from       = (string)  ($options['from']    ?? '');
21 1
        $to         =           ($options['to']      ?? '');
22 1
        $subject    = (string)  ($options['subject'] ?? '');
23 1
        $level      = (int)     ($options['level']   ?? Logger::DEBUG);
24 1
        $bubble     = (bool) ($options['bubble']  ?? true);
25
26 1
        return new SendGridHandler(
27 1
            $apiUser,
28 1
            $apiKey,
29 1
            $from,
30 1
            $to,
31 1
            $subject,
32 1
            $level,
33 1
            $bubble
34
        );
35
    }
36
}
37