Passed
Branch master (44d0ac)
by Jacobo
06:04 queued 03:36
created

WebRTCConnectionCreated::__construct()   A

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
use Illuminate\Queue\SerializesModels;
6
7
/**
8
 * Class WebRTCConnectionCreated
9
 * @package SquareetLabs\LaravelOpenVidu\Events
10
 */
11
class WebRTCConnectionCreated
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...WebRTCConnectionCreated: $id, $relations, $class, $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 $connection
37
     * Whether the media connection is an inbound connection (the participant is receiving media from OpenVidu) or an outbound connection (the participant is sending media to OpenVidu)
38
     * ["INBOUND","OUTBOUND"]
39
     */
40
    public $connection;
41
42
43
    /**
44
     * @var string $receivingFrom
45
     * If connection is "INBOUND", the participant from whom the media stream is being received
46
     * A string with the participant (sender) unique identifier
47
     */
48
    public $receivingFrom;
49
50
    /**
51
     * @var bool $audioEnabled
52
     * Whether the media connection has negotiated audio or not
53
     * [true,false]
54
     */
55
    public $audioEnabled;
56
57
    /**
58
     * @var bool $videoEnabled
59
     * Whether the media connection has negotiated video or not
60
     * [true,false]
61
     */
62
    public $videoEnabled;
63
64
    /**
65
     * @var string $videoSource
66
     * If videoEnabled is true, the type of video that is being transmitted
67
     * ["CAMERA","SCREEN"]
68
     */
69
    public $videoSource;
70
71
    /**
72
     * @var int $videoFramerate
73
     * If videoEnabled is true, the framerate of the transmitted video
74
     * Number of fps
75
     */
76
    public $videoFramerate;
77
78
    /**
79
     * @var int $videoDimensions
80
     * If videoEnabled is true, the dimensions transmitted video
81
     * String with the dimensions (e.g. "1920x1080")
82
     */
83
    public $videoDimensions;
84
85
    /**
86
     * @var string $event
87
     * Openvidu server webhook event
88
     */
89
    public $event;
90
91
92
    /**
93
     * Create a new SessionCreated event instance.
94
     * @param array $data
95
     */
96
    public function __construct(array $data)
97
    {
98
        $this->sessionId = $data['sessionId'];
99
        $this->timestamp = $data['timestamp'];
100
        $this->participantId = $data['participantId'];
101
        $this->receivingFrom = $data['receivingFrom'];
102
        $this->audioEnabled = $data['audioEnabled'];
103
        $this->videoEnabled = $data['videoEnabled'];
104
        $this->videoSource = $data['videoSource'];
105
        $this->videoFramerate = $data['videoFramerate'];
106
        $this->videoDimensions = $data['videoDimensions'];
107
        $this->event = $data['event'];
108
    }
109
}
110