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

TelegramBotHandlerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.7998
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\TelegramBotHandler;
7
use Monolog\Logger;
8
use WShafer\PSR11MonoLog\FactoryInterface;
9
10 View Code Duplication
class TelegramBotHandlerFactory implements FactoryInterface
11
{
12
    public function __invoke(array $options)
13
    {
14
        $apiKey     = (string)  ($options['apiKey']  ?? '');
15
        $channel    = (string)  ($options['channel'] ?? '');
16
        $level      = (int)     ($options['level']   ?? Logger::DEBUG);
17
        $bubble     = (boolean) ($options['bubble']  ?? true);
18
19
        return new TelegramBotHandler(
20
            $apiKey,
21
            $channel,
22
            $level,
23
            $bubble
24
        );
25
    }
26
}
27