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

Broadcast   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
lcom 2
cbo 0
dl 0
loc 52
rs 10
c 1
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setSlackWebhook() 0 4 1
A getSlackWebhook() 0 4 1
A setPusherChannel() 0 4 1
A getPusherChannel() 0 4 1
A getSubscribedChannels() 0 4 1
A isSubscribedToChannel() 0 4 1
A getPusherChannelSuffix() 0 4 1
A getData() 0 7 1
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
}