WebRTCConnectionCreated   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 24
c 2
b 0
f 0
dl 0
loc 100
rs 10
wmc 3

1 Method

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