ParticipantLeft::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 12
rs 9.9332
1
<?php
2
3
namespace SquareetLabs\LaravelOpenVidu\Events;
4
5
6
/**
7
 * Class ParticipantLeft
8
 * @package SquareetLabs\LaravelOpenVidu\Events
9
 */
10
class ParticipantLeft
11
{
12
    /**
13
     * @var string $sessionId
14
     * Session for which the event was triggered
15
     * A string with the session unique identifier
16
     */
17
    public $sessionId;
18
19
    /**
20
     * @var int $timestamp
21
     * Time when the event was triggered
22
     * UTC milliseconds
23
     */
24
    public $timestamp;
25
26
    /**
27
     * @var string $participantId
28
     * Identifier of the participant
29
     * A string with the participant unique identifier
30
     */
31
    public $participantId;
32
33
    /**
34
     * @var string $platform
35
     * Complete description of the platform used by the participant to connect to the session
36
     * A string with the platform description
37
     */
38
    public $platform;
39
40
    /**
41
     * @var string $clientData
42
     * Additional data added client side while connecting to Session
43
     */
44
    public $clientData;
45
46
    /**
47
     * @var string $serverData
48
     * Additional data added server side while generating Token
49
     */
50
    public $serverData;
51
52
    /**
53
     * @var int $startTime
54
     * Time when the participant joined the session
55
     * UTC milliseconds
56
     */
57
    public $startTime;
58
59
    /**
60
     * @var int $duration
61
     * Total duration of the participant's connection to the session
62
     * Seconds
63
     */
64
    public $duration;
65
66
    /**
67
     * @var string $reason
68
     * How the participant left the session
69
     * ["disconnect","forceDisconnectByUser","forceDisconnectByServer","sessionClosedByServer","networkDisconnect","openviduServerStopped"]
70
     */
71
    public $reason;
72
73
    /**
74
     * @var string $event
75
     * Openvidu server webhook event
76
     */
77
    public $event;
78
79
    /**
80
     * Create a new SessionCreated event instance.
81
     * @param  array  $data
82
     */
83
    public function __construct(array $data)
84
    {
85
        $this->sessionId = $data['sessionId'];
86
        $this->timestamp = $data['timestamp'];
87
        $this->participantId = $data['participantId'];
88
        $this->platform = $data['platform'];
89
        $this->clientData = $data['clientData'] ?? "";
90
        $this->serverData = $data['serverData'] ?? "";
91
        $this->startTime = $data['startTime'];
92
        $this->duration = $data['duration'];
93
        $this->reason = $data['reason'];
94
        $this->event = $data['event'];
95
    }
96
}
97
98