Completed
Push — master ( 78ecab...6c5939 )
by Iman
14s queued 11s
created

VideoStreamStarted::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Iman\Streamer\Events;
4
5
use Illuminate\Broadcasting\Channel;
6
use Illuminate\Broadcasting\InteractsWithSockets;
7
use Illuminate\Broadcasting\PresenceChannel;
8
use Illuminate\Broadcasting\PrivateChannel;
9
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
10
use Illuminate\Foundation\Events\Dispatchable;
11
use Illuminate\Queue\SerializesModels;
12
use Iman\Streamer\Video;
13
14
class VideoStreamStarted
15
{
16
    use Dispatchable, InteractsWithSockets, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Iman\Streamer\Events\VideoStreamStarted: $id, $class, $connection, $relations
Loading history...
17
    /**
18
     * @var Video
19
     */
20
    private $video;
21
22
    /**
23
     * Create a new event instance.
24
     *
25
     * @param  Video  $video
26
     */
27
    public function __construct(Video $video)
28
    {
29
        $this->video = $video;
30
        info('video ended');
31
    }
32
33
    /**
34
     * @return Video
35
     */
36
    public function getVideo(): Video
37
    {
38
        return $this->video;
39
    }
40
41
42
    /**
43
     * Get the channels the event should broadcast on.
44
     *
45
     * @return \Illuminate\Broadcasting\Channel|array
46
     */
47
    public function broadcastOn()
48
    {
49
        return new PrivateChannel('channel-name');
50
    }
51
}
52