@@ -76,7 +76,9 @@ discard block |
||
76 | 76 | public function getAccount(int $accountId): ?Account |
77 | 77 | { |
78 | 78 | $response = $this->request("accounts/$accountId"); |
79 | - if ($response === null) return null; |
|
79 | + if ($response === null) { |
|
80 | + return null; |
|
81 | + } |
|
80 | 82 | |
81 | 83 | return Account::fromObject(json_decode($response)); |
82 | 84 | } |
@@ -94,7 +96,9 @@ discard block |
||
94 | 96 | |
95 | 97 | $response = $this->request("accounts/$accountId/events", 'post', $event); |
96 | 98 | |
97 | - if ($response === null) return false; |
|
99 | + if ($response === null) { |
|
100 | + return false; |
|
101 | + } |
|
98 | 102 | |
99 | 103 | $event = Event::fromObject(json_decode($response)); |
100 | 104 | |
@@ -114,7 +118,9 @@ discard block |
||
114 | 118 | |
115 | 119 | $response = $this->request("accounts/$accountId/events/$event->id", 'put', $event); |
116 | 120 | |
117 | - if ($response === null) return false; |
|
121 | + if ($response === null) { |
|
122 | + return false; |
|
123 | + } |
|
118 | 124 | |
119 | 125 | return true; |
120 | 126 | } |
@@ -141,7 +147,9 @@ discard block |
||
141 | 147 | 'saveVideo' => $saveVideo |
142 | 148 | ]); |
143 | 149 | |
144 | - if ($response === null) return null; |
|
150 | + if ($response === null) { |
|
151 | + return null; |
|
152 | + } |
|
145 | 153 | |
146 | 154 | return RTMPKey::fromObject(json_decode($response)); |
147 | 155 | } |
@@ -157,7 +165,9 @@ discard block |
||
157 | 165 | { |
158 | 166 | $response = $this->request("accounts/$accountId/events/$eventId/rtmp", 'put'); |
159 | 167 | |
160 | - if ($response === null) return null; |
|
168 | + if ($response === null) { |
|
169 | + return null; |
|
170 | + } |
|
161 | 171 | |
162 | 172 | return RTMPKey::fromObject(json_decode($response)); |
163 | 173 | } |
@@ -176,7 +186,9 @@ discard block |
||
176 | 186 | ): ?string { |
177 | 187 | $ch = curl_init(); |
178 | 188 | |
179 | - if (!$ch) throw new Exception("Could not initialize CURL."); |
|
189 | + if (!$ch) { |
|
190 | + throw new Exception("Could not initialize CURL."); |
|
191 | + } |
|
180 | 192 | |
181 | 193 | curl_setopt( |
182 | 194 | $ch, |
@@ -188,8 +200,12 @@ discard block |
||
188 | 200 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
189 | 201 | |
190 | 202 | if ($verb != 'get') { |
191 | - if ($verb == 'post') curl_setopt($ch, CURLOPT_POST, true); |
|
192 | - if ($verb == 'put') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); |
|
203 | + if ($verb == 'post') { |
|
204 | + curl_setopt($ch, CURLOPT_POST, true); |
|
205 | + } |
|
206 | + if ($verb == 'put') { |
|
207 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); |
|
208 | + } |
|
193 | 209 | if ($body) { |
194 | 210 | curl_setopt($ch, CURLOPT_HTTPHEADER, [ |
195 | 211 | 'Content-Type: ' . $body->getContentType() |
@@ -203,13 +219,21 @@ discard block |
||
203 | 219 | |
204 | 220 | curl_close($ch); |
205 | 221 | |
206 | - if ($code == 200 || $code == 201) return $response; |
|
222 | + if ($code == 200 || $code == 201) { |
|
223 | + return $response; |
|
224 | + } |
|
207 | 225 | |
208 | - if ($code == 404) return null; |
|
226 | + if ($code == 404) { |
|
227 | + return null; |
|
228 | + } |
|
209 | 229 | |
210 | - if ($code <= 199) throw new Exception("A CURL erorr with code '$code', has occurred."); |
|
230 | + if ($code <= 199) { |
|
231 | + throw new Exception("A CURL erorr with code '$code', has occurred."); |
|
232 | + } |
|
211 | 233 | |
212 | - if ($code == 403) throw new LiveStreamException(self::ERROR_CODES[$code] . ' ' . json_decode($response)->message); |
|
234 | + if ($code == 403) { |
|
235 | + throw new LiveStreamException(self::ERROR_CODES[$code] . ' ' . json_decode($response)->message); |
|
236 | + } |
|
213 | 237 | |
214 | 238 | throw new LiveStreamException(self::ERROR_CODES[$code]); |
215 | 239 | } |