Completed
Push — master ( 4137d9...e7a3c7 )
by dan
02:02
created

BaseChannel::getConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace IrishDan\NotificationBundle\Channel;
4
5
use IrishDan\NotificationBundle\Adapter\MessageAdapterInterface;
6
7
/**
8
 * Class BaseChannel
9
 *
10
 * @package IrishDan\NotificationBundle\Channel
11
 */
12
abstract class BaseChannel implements ChannelInterface
13
{
14
    /**
15
     * @var array
16
     */
17
    protected $channelConfiguration;
18
    /**
19
     * @var
20
     */
21
    protected $channelName;
22
    /**
23
     * @var
24
     */
25
    protected $adapter;
26
27
    public function __construct(array $channelConfiguration = [], $channelName = null, MessageAdapterInterface $adapter = null)
28
    {
29
        $this->channelConfiguration = $channelConfiguration;
30
        $this->channelName = $channelName;
31
32
        if (!empty($adapter)) {
33
            // The adapter needs the channel name and the configurations.
34
            $adapter->setChannelName($channelName);
35
            $adapter->setConfiguration($channelConfiguration);
36
37
            $this->adapter = $adapter;
38
        }
39
    }
40
41
    /**
42
     * @return mixed
43
     */
44
    public function channelName()
45
    {
46
        return $this->channelName;
47
    }
48
49
    public function getConfiguration()
50
    {
51
        return $this->channelConfiguration;
52
    }
53
}
54