Completed
Push — master ( 2e294b...087ce9 )
by Renato
06:42
created

SCBroadcaster::broadcast()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 3
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\SocketCluster
14
     */
15
    protected $socketcluster;
16
17
    /**
18
     * Construct
19
     *
20
     * @param SocketCluster $socketcluster
21
     *
22
     * @param void
23
     */
24
    public function __construct(SocketCluster $socketcluster)
25
    {
26
        $this->socketcluster = $socketcluster;
0 ignored issues
show
Documentation Bug introduced by
It seems like $socketcluster of type object<SocketCluster\SocketCluster> is incompatible with the declared type object<SocketCluster\SocketCluster\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...
27
    }
28
29
    /**
30
     * Broadcast
31
     *
32
     * @param array  $channels
33
     * @param string $event
34
     * @param array  $payload
35
     *
36
     * @return void
37
     */
38
    public function broadcast(array $channels, $event, array $payload = array())
39
    {
40
        foreach ($channels as $channel) {
41
            $this->socketcluster->publish($channel, $payload);
42
        }
43
    }
44
}
45