Config::getCustomUser()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Pageon\SlackWebhookMonolog\Slack;
4
5
use Pageon\SlackWebhookMonolog\Slack\Interfaces\ConfigInterface;
6
use Pageon\SlackWebhookMonolog\Slack\Interfaces\UserInterface;
7
use Pageon\SlackWebhookMonolog\Slack\Interfaces\WebhookInterface;
8
9
/**
10
 * @author Jelmer Prins <[email protected]>
11
 *
12
 * @since 0.1.0
13
 */
14
class Config implements ConfigInterface
15
{
16
    /**
17
     * @var WebhookInterface the configuration for the webhook
18
     */
19
    private $webhook;
20
21
    /**
22
     * If not available the default config from slack will be used.
23
     *
24
     * @var UserInterface|null The configuration for the presentation of the webhook user.
25
     */
26
    private $customUser;
27
28
    /**
29
     * Config constructor.
30
     *
31
     * @param WebhookInterface $webhook
32
     * @param UserInterface|null $customUser
33
     */
34 9
    public function __construct(WebhookInterface $webhook, UserInterface $customUser = null)
35
    {
36 9
        $this->webhook = $webhook;
37 9
        $this->customUser = $customUser;
38 9
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 6
    public function getWebhook()
44
    {
45 6
        return $this->webhook;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51 4
    public function getCustomUser()
52
    {
53 4
        return $this->customUser;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59 6
    public function hasCustomUser()
60
    {
61 6
        return $this->customUser !== null;
62
    }
63
}
64