Passed
Push — 2.x ( 75d9da...077994 )
by Terry
01:57
created

ItemSlack::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
/*
3
 * This file is part of the Shieldon package.
4
 *
5
 * (c) Terry L. <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Shieldon\Firewall\Panel\Messenger;
14
15
use Shieldon\Messenger\Messenger\MessengerInterface;
16
use Shieldon\Messenger\Slack;
17
18
/**
19
 * The get for Slack.
20
 */
21
class ItemSlack
22
{
23
    /**
24
     * Initialize and get the instance.
25
     *
26
     * @param array $setting The configuration of that messanger.
27
     *
28
     * @return MessengerInterface
29
     */
30
    public static function get(array $setting): MessengerInterface
31
    {
32
        $botToken = $setting['config']['bot_token'] ?? '';
33
        $channel  = $setting['config']['channel']   ?? '';
34
35
        return new Slack($botToken, $channel);
36
    }
37
}