Passed
Push — master ( 2661ba...d91ec9 )
by Francis
02:48 queued 35s
created
src/LiveStream/LiveStream.php 1 patch
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@  discard block
 block discarded – undo
68 68
             self::$instance = new static($apiKey);
69 69
         }
70 70
 
71
-        if ($apiKey) self::$instance->apiKey = $apiKey;
71
+        if ($apiKey) {
72
+            self::$instance->apiKey = $apiKey;
73
+        }
72 74
 
73 75
         return self::$instance;
74 76
     }
@@ -100,7 +102,9 @@  discard block
 block discarded – undo
100 102
     public function getAccount(int $accountId): ?Account
101 103
     {
102 104
         $response = $this->request("accounts/$accountId");
103
-        if ($response === null) return null;
105
+        if ($response === null) {
106
+            return null;
107
+        }
104 108
 
105 109
         return Account::fromObject(json_decode($response));
106 110
     }
@@ -118,7 +122,9 @@  discard block
 block discarded – undo
118 122
 
119 123
         $response = $this->request("accounts/$accountId/events", 'post', $event);
120 124
 
121
-        if ($response === null) return false;
125
+        if ($response === null) {
126
+            return false;
127
+        }
122 128
 
123 129
         $event = Event::fromObject(json_decode($response));
124 130
 
@@ -138,7 +144,9 @@  discard block
 block discarded – undo
138 144
 
139 145
         $response = $this->request("accounts/$accountId/events/$event->id", 'put', $event);        
140 146
 
141
-        if ($response === null) return false;
147
+        if ($response === null) {
148
+            return false;
149
+        }
142 150
 
143 151
         return true;
144 152
     }
@@ -165,7 +173,9 @@  discard block
 block discarded – undo
165 173
             'saveVideo'       => $saveVideo
166 174
         ]);
167 175
 
168
-        if ($response === null) return null;
176
+        if ($response === null) {
177
+            return null;
178
+        }
169 179
 
170 180
         return RTMPKey::fromObject(json_decode($response));
171 181
     }
@@ -181,7 +191,9 @@  discard block
 block discarded – undo
181 191
     {
182 192
         $response = $this->request("accounts/$accountId/events/$eventId/rtmp", 'put');
183 193
 
184
-        if ($response === null) return null;
194
+        if ($response === null) {
195
+            return null;
196
+        }
185 197
 
186 198
         return RTMPKey::fromObject(json_decode($response));
187 199
     }
@@ -200,7 +212,9 @@  discard block
 block discarded – undo
200 212
     ): ?string {
201 213
         $ch = curl_init();
202 214
 
203
-        if (!$ch) throw new Exception("Could not initialize CURL.");
215
+        if (!$ch) {
216
+            throw new Exception("Could not initialize CURL.");
217
+        }
204 218
 
205 219
         curl_setopt(
206 220
             $ch,
@@ -212,8 +226,12 @@  discard block
 block discarded – undo
212 226
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
213 227
 
214 228
         if ($verb != 'get') {
215
-            if ($verb == 'post') curl_setopt($ch, CURLOPT_POST, true);
216
-            if ($verb == 'put') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
229
+            if ($verb == 'post') {
230
+                curl_setopt($ch, CURLOPT_POST, true);
231
+            }
232
+            if ($verb == 'put') {
233
+                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
234
+            }
217 235
             if ($body) {
218 236
                 curl_setopt($ch, CURLOPT_HTTPHEADER, [
219 237
                     'Content-Type: ' . $body->getContentType()
@@ -227,13 +245,21 @@  discard block
 block discarded – undo
227 245
 
228 246
         curl_close($ch);
229 247
 
230
-        if ($code == 200 || $code == 201) return $response;
248
+        if ($code == 200 || $code == 201) {
249
+            return $response;
250
+        }
231 251
 
232
-        if ($code == 404) return null;
252
+        if ($code == 404) {
253
+            return null;
254
+        }
233 255
 
234
-        if ($code <= 199) throw new Exception("A CURL erorr with code '$code', has occurred.");
256
+        if ($code <= 199) {
257
+            throw new Exception("A CURL erorr with code '$code', has occurred.");
258
+        }
235 259
 
236
-        if ($code == 403) throw new LiveStreamException(self::ERROR_CODES[$code] . ' ' . json_decode($response)->message);
260
+        if ($code == 403) {
261
+            throw new LiveStreamException(self::ERROR_CODES[$code] . ' ' . json_decode($response)->message);
262
+        }
237 263
 
238 264
         throw new LiveStreamException(self::ERROR_CODES[$code]);
239 265
     }
Please login to merge, or discard this patch.
src/LiveStream/Resources/Event.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
     public function __construct(string $fullName, bool $init = true)
19 19
     {
20 20
         parent::__construct($init);
21
-        if ($init)
22
-            $this->data->fullName  = $fullName;
21
+        if ($init) {
22
+                    $this->data->fullName  = $fullName;
23
+        }
23 24
     }
24 25
 
25 26
     /**
@@ -77,7 +78,9 @@  discard block
 block discarded – undo
77 78
      */
78 79
     public function addTag(string $tag): Event
79 80
     {
80
-        if (!isset($this->data->tags)) $this->data->tags = '';
81
+        if (!isset($this->data->tags)) {
82
+            $this->data->tags = '';
83
+        }
81 84
 
82 85
         $this->data->tags .= rtrim($tag, ',') . ',';
83 86
 
@@ -156,8 +159,9 @@  discard block
 block discarded – undo
156 159
     private function set_fields(array &$array, array $map): void
157 160
     {
158 161
         foreach ($map as $key => $value) {
159
-            if ($value)
160
-                $array[$key] = $value;
162
+            if ($value) {
163
+                            $array[$key] = $value;
164
+            }
161 165
         }
162 166
     }
163 167
 
@@ -180,7 +184,9 @@  discard block
 block discarded – undo
180 184
      */
181 185
     public function validate(bool $exists = false): void
182 186
     {
183
-        if (!$this->data->fullName ?? null) throw new InValidResourceException('Event', 'fullName');
187
+        if (!$this->data->fullName ?? null) {
188
+            throw new InValidResourceException('Event', 'fullName');
189
+        }
184 190
 
185 191
         if (($this->data->isPasswordProtected ?? false) && (!$this->data->password ?? null)) {
186 192
             throw new InValidResourceException('Event', 'password (password must be present for a password protected event)');
Please login to merge, or discard this patch.