SCBroadcaster   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A broadcast() 0 6 2
1
<?php
2
3
namespace LaravelSocketCluster;
4
5
use \Illuminate\Contracts\Broadcasting\Broadcaster;
6
use LaravelSocketCluster\SocketCluster;
7
8
/**
9
 * @package SocketCluster\SCBroadcaster
10
 */
11
class SCBroadcaster implements Broadcaster
12
{
13
    /**
14
     * @var SocketCluster\SocketCluster
15
     */
16
    protected $socketcluster;
17
18
    /**
19
     * Construct
20
     *
21
     * @param SocketCluster $socketcluster
22
     *
23
     * @param void
24
     */
25
    public function __construct(SocketCluster $socketcluster)
26
    {
27
        $this->socketcluster = $socketcluster;
0 ignored issues
show
Documentation Bug introduced by
It seems like $socketcluster of type object<LaravelSocketCluster\SocketCluster> is incompatible with the declared type object<LaravelSocketClus...tCluster\SocketCluster> of property $socketcluster.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28
    }
29
30
    /**
31
     * Broadcast
32
     *
33
     * @param array  $channels
34
     * @param string $event
35
     * @param array  $payload
36
     *
37
     * @return void
38
     */
39
    public function broadcast(array $channels, $event, array $payload = array())
40
    {
41
        foreach ($channels as $channel) {
42
            $this->socketcluster->publish($channel, $payload);
43
        }
44
    }
45
}