Passed
Push — master ( 28c96c...8168cc )
by Jacobo
03:21
created
src/Session.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     public function __construct(Client $client, ?string $sessionId = null, ?SessionProperties $properties = null)
62 62
     {
63 63
         $this->client = $client;
64
-        if(!$sessionId) {
64
+        if (!$sessionId) {
65 65
             $this->properties = $properties ? $properties : new SessionProperties(MediaMode::ROUTED, RecordingMode::MANUAL, OutputMode::COMPOSED, RecordingLayout::BEST_FIT);
66 66
             $this->sessionId = $this->getSessionId();
67 67
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                 case 409:
86 86
                     return $this->properties->getCustomSessionId();
87 87
                 default:
88
-                    throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
88
+                    throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
89 89
             }
90 90
         } else {
91 91
             return $this->sessionId;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 case 404:
120 120
                     throw new OpenViduSessionNotFoundException();
121 121
                 default:
122
-                    throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
122
+                    throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
123 123
             }
124 124
         } catch (Exception $e) {
125 125
             throw new OpenViduTokenCantCreateException($e->getMessage(), $e);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function close()
135 135
     {
136
-        $response = $this->client->delete(Uri::SESSION_URI.'/'.$this->sessionId);
136
+        $response = $this->client->delete(Uri::SESSION_URI . '/' . $this->sessionId);
137 137
         switch ($response->getStatusCode()) {
138 138
             case 204:
139 139
                 Cache::store('openvidu')->forget($this->sessionId);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             case 404:
142 142
                 throw new OpenViduSessionNotFoundException();
143 143
             default:
144
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
144
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
145 145
         }
146 146
     }
147 147
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
     public function fetch()
165 165
     {
166
-        $response = $this->client->get(Uri::SESSION_URI.'/'.$this->sessionId, [
166
+        $response = $this->client->get(Uri::SESSION_URI . '/' . $this->sessionId, [
167 167
             'headers' => [
168 168
                 'Content-Type' => 'application/x-www-form-urlencoded',
169 169
                 'Accept' => 'application/json',
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      */
279 279
     public function forceDisconnect(string $connectionId)
280 280
     {
281
-        $response = $this->client->delete(Uri::SESSION_URI.'/'.$this->sessionId.'/connection/'.$connectionId, [
281
+        $response = $this->client->delete(Uri::SESSION_URI . '/' . $this->sessionId . '/connection/' . $connectionId, [
282 282
             'headers' => [
283 283
                 'Content-Type' => 'application/x-www-form-urlencoded',
284 284
                 'Accept' => 'application/json',
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             case 404:
295 295
                 throw new OpenViduConnectionNotFoundException();
296 296
             default:
297
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
297
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
298 298
         }
299 299
     }
300 300
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
     private function leaveSession(string $connectionId)
308 308
     {
309 309
         $connectionClosed = null;
310
-        $this->activeConnections = array_filter($this->activeConnections, function (Connection $connection) use (&$connectionClosed, $connectionId) {
310
+        $this->activeConnections = array_filter($this->activeConnections, function(Connection $connection) use (&$connectionClosed, $connectionId) {
311 311
             if ($connection->getConnectionId() !== $connectionId) {
312 312
                 return true;
313 313
             }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
      */
338 338
     public function publish(IPCameraOptions $IPCameraOptions)
339 339
     {
340
-        $response = $this->client->post(Uri::SESSION_URI.'/'.$this->sessionId.'/connection', [
340
+        $response = $this->client->post(Uri::SESSION_URI . '/' . $this->sessionId . '/connection', [
341 341
             RequestOptions::JSON => array_merge($IPCameraOptions->toArray())
342 342
         ]);
343 343
         switch ($response->getStatusCode()) {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      */
375 375
     public function forceUnpublish(string $streamId)
376 376
     {
377
-        $response = $this->client->delete(Uri::SESSION_URI.'/'.$this->sessionId.'/stream/'.$streamId, [
377
+        $response = $this->client->delete(Uri::SESSION_URI . '/' . $this->sessionId . '/stream/' . $streamId, [
378 378
             'headers' => [
379 379
                 'Content-Type' => 'application/x-www-form-urlencoded',
380 380
                 'Accept' => 'application/json',
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
             case 405:
396 396
                 throw new OpenViduStreamCantCloseException("You cannot directly delete the stream of an IPCAM participant");
397 397
             default:
398
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
398
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
399 399
         }
400 400
     }
401 401
 
Please login to merge, or discard this patch.
src/OpenVidu.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function createSession(?SessionProperties $properties = null): Session
54 54
     {
55
-        $session = new Session($this->client(),null, $properties);
55
+        $session = new Session($this->client(), null, $properties);
56 56
         Cache::store('openvidu')->forever($session->getSessionId(), $session->toJson());
57 57
         return $session;
58 58
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             'auth' => [
75 75
                 $this->config['app'], $this->config['secret']
76 76
             ],
77
-            'base_uri' => $this->config['domain'].':'.$this->config['port'],
77
+            'base_uri' => $this->config['domain'] . ':' . $this->config['port'],
78 78
             'debug' => $this->config['debug'],
79 79
             'http_errors' => false,
80 80
             'verify' => false
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             case 501:
137 137
                 throw new OpenViduServerRecordingIsDisabledException();
138 138
             default:
139
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
139
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
140 140
         }
141 141
     }
142 142
 
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function getRecording(string $recordingId): Recording
168 168
     {
169
-        $response = $this->client()->get(Uri::RECORDINGS_URI.'/'.$recordingId);
169
+        $response = $this->client()->get(Uri::RECORDINGS_URI . '/' . $recordingId);
170 170
         switch ($response->getStatusCode()) {
171 171
             case 200:
172 172
                 return RecordingBuilder::build(json_decode($response->getBody()->getContents(), true));
173 173
             case 404:
174 174
                 throw new OpenViduRecordingNotFoundException();
175 175
             default:
176
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
176
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
177 177
         }
178 178
     }
179 179
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function stopRecording(string $recordingId): Recording
203 203
     {
204
-        $response = $this->client()->post(Uri::RECORDINGS_STOP.'/'.$recordingId);
204
+        $response = $this->client()->post(Uri::RECORDINGS_STOP . '/' . $recordingId);
205 205
         switch ($response->getStatusCode()) {
206 206
             case 200:
207 207
                 $recording = RecordingBuilder::build(json_decode($response->getBody()->getContents(), true));
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             case 406:
217 217
                 throw new OpenViduRecordingStatusException("The recording has `starting` status. Wait until `started` status before stopping the recording.");
218 218
             default:
219
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
219
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
220 220
         }
221 221
     }
222 222
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 }
239 239
                 return $recordings;
240 240
             default:
241
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
241
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
242 242
         }
243 243
     }
244 244
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      */
254 254
     public function deleteRecording(string $recordingId): bool
255 255
     {
256
-        $response = $this->client()->delete(Uri::RECORDINGS_URI.'/'.$recordingId);
256
+        $response = $this->client()->delete(Uri::RECORDINGS_URI . '/' . $recordingId);
257 257
 
258 258
         switch ($response->getStatusCode()) {
259 259
             case 200:
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                 throw new OpenViduRecordingStatusException("The recording has `started` status. Stop it before deletion.");
266 266
                 break;
267 267
             default:
268
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
268
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
269 269
         }
270 270
     }
271 271
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
             case 406:
329 329
                 throw new OpenViduSessionHasNotConnectedParticipantsException();
330 330
             default:
331
-                throw new OpenViduException("Invalid response status code ".$response->getStatusCode(), $response->getStatusCode());
331
+                throw new OpenViduException("Invalid response status code " . $response->getStatusCode(), $response->getStatusCode());
332 332
         }
333 333
     }
334 334
 }
Please login to merge, or discard this patch.