Passed
Push — master ( 4b0d05...471523 )
by Arthur
103:49 queued 98:11
created

WebBroadcastChannel   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 24
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 14 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 14.10.18
6
 * Time: 21:39.
7
 */
8
9
namespace Modules\Notification\Channels;
10
11
use Illuminate\Notifications\Channels\BroadcastChannel;
12
use Illuminate\Notifications\Messages\BroadcastMessage;
13
use Illuminate\Notifications\Notification;
14
use Modules\Notification\Events\WebNotificationEvent;
15
16
class WebBroadcastChannel extends BroadcastChannel
17
{
18
    /**
19
     * Send the given notification.
20
     *
21
     * @param mixed                                  $notifiable
22
     * @param \Illuminate\Notifications\Notification $notification
23
     *
24
     * @return array|null
25
     */
26 31
    public function send($notifiable, Notification $notification)
27
    {
28 31
        $message = $this->getData($notifiable, $notification);
29
30 31
        $event = new WebNotificationEvent(
31 31
            $notifiable, $notification, is_array($message) ? $message : $message->data
32
        );
33
34 31
        if ($message instanceof BroadcastMessage) {
35
            $event->onConnection($message->connection)
36
                ->onQueue($message->queue);
37
        }
38
39 31
        return $this->events->dispatch($event);
40
    }
41
}
42