SCBroadcaster   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 35
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A broadcast() 0 6 2
1
<?php
2
namespace SocketCluster\Laravel;
3
4
use Illuminate\Contracts\Broadcasting\Broadcaster;
5
use SocketCluster\SocketCluster;
6
7
/**
8
 * @package SocketCluster\Laravel
9
 */
10
class SCBroadcaster implements Broadcaster
11
{
12
    /**
13
     * @var SocketCluster
14
     */
15
    protected $socketcluster;
16
17
    /**
18
     * Construct
19
     *
20
     * @param SocketCluster $socketcluster
21
     *
22
     * @param void
23
     */
24 3
    public function __construct(SocketCluster $socketcluster)
25
    {
26 3
        $this->socketcluster = $socketcluster;
27 3
    }
28
29
    /**
30
     * Broadcast
31
     *
32
     * @param array  $channels
33
     * @param string $event
34
     * @param array  $payload
35
     *
36
     * @return void
37
     */
38 1
    public function broadcast(array $channels, $event, array $payload = array())
39
    {
40 1
        foreach ($channels as $channel) {
41 1
            $this->socketcluster->publish($channel, $payload);
42 1
        }
43 1
    }
44
}
45