Completed
Branch master (bbeaa5)
by Edwin
02:03
created

PusherBroadcaster::broadcast()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
3
namespace EdwinLuijten\Ekko\Broadcast\Broadcasters;
4
5
use Pusher;
6
7
class PusherBroadcaster implements BroadcasterInterface
8
{
9
    /**
10
     * @var Pusher
11
     */
12
    private $pusher;
13
14
    /**
15
     * PusherBroadcaster constructor.
16
     * @param Pusher $pusher
17
     */
18 9
    public function __construct(Pusher $pusher)
19
    {
20 9
        $this->pusher = $pusher;
21 9
    }
22
23
    /**
24
     * Broadcast the given event.
25
     *
26
     * @param  array $channels
27
     * @param  string $event
28
     * @param  array $payload
29
     * @return void
30
     */
31 3
    public function broadcast(array $channels, $event, array $payload = [])
32
    {
33 3
        $this->pusher->trigger($channels, $event, $payload);
34 3
    }
35
36
    /**
37
     * Get the Pusher instance.
38
     *
39
     * @return Pusher
40
     */
41 3
    public function getPusher()
42
    {
43 3
        return $this->pusher;
44
    }
45
}
46