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

Broadcast::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace IrishDan\NotificationBundle\Broadcast;
4
5
use IrishDan\NotificationBundle\Notification\NotifiableInterface;
6
use IrishDan\NotificationBundle\PusherableInterface;
7
use IrishDan\NotificationBundle\SlackableInterface;
8
9
class Broadcast implements BroadcastNotifiableInterface, NotifiableInterface, SlackableInterface, PusherableInterface
10
{
11
    protected $slackWebhook;
12
    protected $pusherChannel;
13
    protected $subscribedChannels = [
14
        'slack',
15
        'pusher',
16
    ];
17
18
    public function setSlackWebhook($webhook)
19
    {
20
        $this->slackWebhook = $webhook;
21
    }
22
23
    public function getSlackWebhook()
24
    {
25
        return $this->slackWebhook;
26
    }
27
28
    public function setPusherChannel($pusherChannel)
29
    {
30
        $this->pusherChannel = $pusherChannel;
31
    }
32
33
    public function getPusherChannel()
34
    {
35
        return $this->pusherChannel;
36
    }
37
38
    public function getSubscribedChannels()
39
    {
40
        $this->subscribedChannels;
41
    }
42
43
    public function isSubscribedToChannel($channel)
44
    {
45
        return in_array($this->subscribedChannels, $channel);
46
    }
47
48
    public function getPusherChannelSuffix()
49
    {
50
        return 'broadcast';
51
    }
52
53
    public function getData()
54
    {
55
        return [
56
            'pusher_channel' => $this->pusherChannel,
57
            'slack_webhook' => $this->slackWebhook,
58
        ];
59
    }
60
}