Passed
Push — master ( 7abbc2...44d0ac )
by Jacobo
04:02
created

ParticipantLeft::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 10
rs 10
1
<?php
2
3
namespace SquareetLabs\LaravelOpenVidu\Events;
4
5
use Illuminate\Queue\SerializesModels;
6
7
/**
8
 * Class ParticipantJoined
9
 * @package SquareetLabs\LaravelOpenVidu\Events
10
 */
11
class ParticipantLeft
12
{
13
    use SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by SquareetLabs\LaravelOpen...\Events\ParticipantLeft: $id, $relations, $class, $connection, $keyBy
Loading history...
14
    /**
15
     * @var string $sessionId
16
     * Session for which the event was triggered
17
     * A string with the session unique identifier
18
     */
19
    public $sessionId;
20
21
    /**
22
     * @var int $timestamp
23
     * Time when the event was triggered
24
     * UTC milliseconds
25
     */
26
    public $timestamp;
27
28
    /**
29
     * @var string $participantId
30
     * Identifier of the participant
31
     * A string with the participant unique identifier
32
     */
33
    public $participantId;
34
35
    /**
36
     * @var string $platform
37
     * Complete description of the platform used by the participant to connect to the session
38
     * A string with the platform description
39
     */
40
    public $platform;
41
42
    /**
43
     * @var int $startTime
44
     * Time when the participant joined the session
45
     * UTC milliseconds
46
     */
47
    public $startTime;
48
49
    /**
50
     * @var int $duration
51
     * Total duration of the participant's connection to the session
52
     * Seconds
53
     */
54
    public $duration;
55
56
    /**
57
     * @var string $reason
58
     * How the participant left the session
59
     * ["disconnect","forceDisconnectByUser","forceDisconnectByServer","sessionClosedByServer","networkDisconnect","openviduServerStopped"]
60
     */
61
    public $reason;
62
63
    /**
64
     * @var string $event
65
     * Openvidu server webhook event
66
     */
67
    public $event;
68
69
    /**
70
     * Create a new SessionCreated event instance.
71
     * @param array $data
72
     */
73
    public function __construct(array $data)
74
    {
75
        $this->sessionId = $data['sessionId'];
76
        $this->timestamp = $data['timestamp'];
77
        $this->participantId = $data['participantId'];
78
        $this->platform = $data['platform'];
79
        $this->startTime = $data['startTime'];
80
        $this->duration = $data['duration'];
81
        $this->reason = $data['reason'];
82
        $this->event = $data['event'];
83
    }
84
}