Passed
Push — 2.x ( a2237c...c5863b )
by Terry
02:56
created

ItemSlackWebhook::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
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\Firewall\Messenger;
14
15
use Shieldon\Messenger\Messenger\MessengerInterface;
16
use Shieldon\Messenger\SlackWebhook;
17
18
/**
19
 * The get for Slack Webhook.
20
 */
21
class ItemSlackWebhook
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
        $webhookUrl = $setting['config']['webhook_url'] ?? '';
33
34
        return new SlackWebhook($webhookUrl);
35
    }
36
}