RecordingStatusChanged::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 22
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 3
eloc 18
c 2
b 0
f 0
nc 4
nop 1
dl 0
loc 22
rs 9.6666
1
<?php
2
3
namespace SquareetLabs\LaravelOpenVidu\Events;
4
5
6
/**
7
 * Class RecordingStatusChanged
8
 * @package SquareetLabs\LaravelOpenVidu\Events
9
 */
10
class RecordingStatusChanged
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
    /**
28
     * @var string $participantId
29
     * Identifier of the participant
30
     * A string with the participant unique identifier
31
     */
32
    public $participantId;
33
34
    /**
35
     * @var int $startTime
36
     * Time when the recording started
37
     * UTC milliseconds
38
     */
39
    public $startTime;
40
41
    /**
42
     * @var string $id
43
     * Unique identifier of the recording
44
     * A string with the recording unique identifier
45
     */
46
    public $id;
47
48
    /**
49
     * @var string $name
50
     * Name given to the recording file
51
     * A string with the recording name
52
     */
53
    public $name;
54
55
56
    /**
57
     * @var string $outputMode
58
     * Output mode of the recording (COMPOSED or INDIVIDUAL)
59
     * A string with the recording output mode
60
     */
61
    public $outputMode;
62
63
64
    /**
65
     * @var bool $hasAudio
66
     * Wheter the recording file has audio or not
67
     *    [true,false]
68
     */
69
    public $hasAudio;
70
71
    /**
72
     * @var bool $hasVideo
73
     * Wheter the recording file has video or not
74
     *    [true,false]
75
     */
76
    public $hasVideo;
77
78
    /**
79
     * @var string $recordingLayout
80
     * The type of layout used in the recording. Only defined if outputMode is COMPOSED and hasVideo is true
81
     *  A RecordingLayout value (BEST_FIT, PICTURE_IN_PICTURE, CUSTOM ...)
82
     */
83
    public $recordingLayout;
84
85
    /**
86
     * @var string $resolution
87
     * Resolution of the recorded file. Only defined if outputMode is COMPOSED and hasVideo is true
88
     * A string with the width and height of the video file in pixels. e.g. "1280x720"
89
     */
90
    public $resolution;
91
92
    /**
93
     * @var int $size
94
     * The size of the video file. 0 until status is stopped
95
     * Bytes
96
     */
97
    public $size;
98
99
    /**
100
     * @var int $duration
101
     * Duration of the video file. 0 until status is stopped
102
     * Seconds
103
     */
104
    public $duration;
105
106
    /**
107
     * @var string $status
108
     * Status of the recording
109
     * ["started","stopped","ready","failed"]
110
     */
111
    public $status;
112
113
    /**
114
     * @var string $reason
115
     * Why the recording stopped. Only defined when status is stopped or ready
116
     * ["recordingStoppedByServer","lastParticipantLeft","sessionClosedByServer","automaticStop","openviduServerStopped","mediaServerDisconnect"]
117
     */
118
    public $reason;
119
120
    /**
121
     * @var string $event
122
     * Openvidu server webhook event
123
     */
124
    public $event;
125
126
    /**
127
     * Create a new SessionCreated event instance.
128
     * @param  array  $data
129
     */
130
    public function __construct(array $data)
131
    {
132
        $this->sessionId = $data['sessionId'];
133
        $this->timestamp = $data['timestamp'];
134
        if (array_key_exists('participantId', $data)) {
135
            $this->participantId = $data['participantId'];
136
        }
137
        $this->startTime = $data['startTime'];
138
        $this->id = $data['id'];
139
        $this->name = $data['name'];
140
        $this->outputMode = $data['outputMode'];
141
        $this->hasAudio = $data['hasAudio'];
142
        $this->hasVideo = $data['hasVideo'];
143
        $this->recordingLayout = $data['recordingLayout'];
144
        $this->resolution = $data['resolution'];
145
        $this->status = $data['status'];
146
        if (array_key_exists('reason', $data)) {
147
            $this->size = $data['size'];
148
            $this->duration = $data['duration'];
149
            $this->reason = $data['reason'];
150
        }
151
        $this->event = $data['event'];
152
    }
153
}