GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( c3462b...f42cce )
by sebastian
02:09
created
src/Facade/CalDavClient.php 1 patch
Spacing   +39 added lines, -58 removed lines patch added patch discarded remove patch
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
      * @return mixed|\Psr\Http\Message\ResponseInterface
142 142
      * @throws \GuzzleHttp\Exception\GuzzleException
143 143
      */
144
-    private function makeRequest(Request $http_request){
145
-        try{
144
+    private function makeRequest(Request $http_request) {
145
+        try {
146 146
             return $this->client->send($http_request, [
147 147
                 'auth'    => [$this->user, $this->password, $this->authtype],
148 148
                 'timeout' => $this->timeout
149 149
             ]);
150 150
         }
151
-        catch (ClientException $ex){
152
-            switch($ex->getCode()){
151
+        catch (ClientException $ex) {
152
+            switch ($ex->getCode()) {
153 153
                 case 401:
154 154
                     throw new UserUnAuthorizedException();
155 155
                     break;
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 
180 180
         $res     = $http_response->hasHeader(self::DAVHeader);
181 181
         $options = [];
182
-        if($res){
182
+        if ($res) {
183 183
             $val = $http_response->getHeaderLine(self::DAVHeader);
184
-            if(!empty($val)){
184
+            if (!empty($val)) {
185 185
                 $options = explode(', ', $val);
186 186
             }
187 187
         }
@@ -195,14 +195,13 @@  discard block
 block discarded – undo
195 195
     public function getUserPrincipal()
196 196
     {
197 197
         $http_response = $this->makeRequest(
198
-            RequestFactory::createPropFindRequest
199
-            (
198
+            RequestFactory::createPropFindRequest(
200 199
                 $this->server_url,
201 200
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent()
202 201
             )
203 202
         );
204 203
 
205
-        return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
204
+        return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
206 205
     }
207 206
 
208 207
     /**
@@ -212,14 +211,13 @@  discard block
 block discarded – undo
212 211
     public function getCalendarHome($principal_url)
213 212
     {
214 213
         $http_response = $this->makeRequest(
215
-            RequestFactory::createPropFindRequest
216
-            (
214
+            RequestFactory::createPropFindRequest(
217 215
                 $principal_url,
218 216
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent()
219 217
             )
220 218
         );
221 219
 
222
-        return new CalendarHomesResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
220
+        return new CalendarHomesResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
223 221
     }
224 222
 
225 223
     /**
@@ -233,10 +231,9 @@  discard block
 block discarded – undo
233 231
         $uid           = $vo->getUID();
234 232
         $resource_name = $vo->getResourceName();
235 233
 
236
-        $resource_url  = $calendar_home_set . ($resource_name ? $resource_name : $uid);
234
+        $resource_url  = $calendar_home_set.($resource_name ? $resource_name : $uid);
237 235
         $http_response = $this->makeRequest(
238
-            RequestFactory::createMakeCalendarRequest
239
-            (
236
+            RequestFactory::createMakeCalendarRequest(
240 237
                 $resource_url,
241 238
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent()
242 239
             )
@@ -252,14 +249,13 @@  discard block
 block discarded – undo
252 249
     public function getCalendars($calendar_home_set_url)
253 250
     {
254 251
         $http_response = $this->makeRequest(
255
-            RequestFactory::createPropFindRequest
256
-            (
252
+            RequestFactory::createPropFindRequest(
257 253
                 $calendar_home_set_url,
258 254
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent()
259 255
             )
260 256
         );
261 257
 
262
-        return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
258
+        return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
263 259
     }
264 260
 
265 261
     /**
@@ -269,15 +265,14 @@  discard block
 block discarded – undo
269 265
     public function getCalendar($calendar_url)
270 266
     {
271 267
         $http_response = $this->makeRequest(
272
-            RequestFactory::createPropFindRequest
273
-            (
268
+            RequestFactory::createPropFindRequest(
274 269
                 $calendar_url,
275 270
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(),
276 271
                 0
277 272
             )
278 273
         );
279 274
 
280
-        return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
275
+        return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
281 276
     }
282 277
 
283 278
 
@@ -290,14 +285,13 @@  discard block
 block discarded – undo
290 285
     {
291 286
 
292 287
         $http_response = $this->makeRequest(
293
-            RequestFactory::createReportRequest
294
-            (
288
+            RequestFactory::createReportRequest(
295 289
                 $calendar_url,
296 290
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent()
297 291
             )
298 292
         );
299 293
 
300
-        return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
294
+        return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
301 295
     }
302 296
 
303 297
     /**
@@ -310,19 +304,17 @@  discard block
 block discarded – undo
310 304
         $uid           = $vo->getUID();
311 305
         $resource_url  = $calendar_url.$uid.self::SchedulingInformationSuffix;
312 306
         $http_response = $this->makeRequest(
313
-            RequestFactory::createPutRequest
314
-            (
307
+            RequestFactory::createPutRequest(
315 308
                 $resource_url,
316 309
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent()
317 310
             )
318 311
         );
319 312
         $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null;
320
-        return new EventCreatedResponse
321
-        (
313
+        return new EventCreatedResponse(
322 314
             $uid,
323 315
             $etag,
324 316
             $resource_url,
325
-            (string)$http_response->getBody(),
317
+            (string) $http_response->getBody(),
326 318
             $http_response->getStatusCode()
327 319
         );
328 320
     }
@@ -338,20 +330,18 @@  discard block
 block discarded – undo
338 330
         $uid           = $vo->getUID();
339 331
         $resource_url  = $calendar_url.$uid.self::SchedulingInformationSuffix;
340 332
         $http_response = $this->makeRequest(
341
-            RequestFactory::createPutRequest
342
-            (
333
+            RequestFactory::createPutRequest(
343 334
                 $resource_url,
344 335
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(),
345 336
                 $etag
346 337
             )
347 338
         );
348 339
         $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null;
349
-        return new EventUpdatedResponse
350
-        (
340
+        return new EventUpdatedResponse(
351 341
             $uid,
352 342
             $etag,
353 343
             $resource_url,
354
-            (string)$http_response->getBody(),
344
+            (string) $http_response->getBody(),
355 345
             $http_response->getStatusCode()
356 346
         );
357 347
     }
@@ -365,16 +355,14 @@  discard block
 block discarded – undo
365 355
     public function deleteEvent($calendar_url, $uid, $etag = null)
366 356
     {
367 357
         $http_response = $this->makeRequest(
368
-            RequestFactory::createDeleteRequest
369
-            (
358
+            RequestFactory::createDeleteRequest(
370 359
                 $calendar_url.$uid.self::SchedulingInformationSuffix,
371 360
                 $etag
372 361
             )
373 362
         );
374 363
 
375
-        return new EventDeletedResponse
376
-        (
377
-            (string)$http_response->getBody(), $http_response->getStatusCode()
364
+        return new EventDeletedResponse(
365
+            (string) $http_response->getBody(), $http_response->getStatusCode()
378 366
         );
379 367
     }
380 368
 
@@ -382,15 +370,14 @@  discard block
 block discarded – undo
382 370
      * @param string $event_url
383 371
      * @return string
384 372
      */
385
-    public function getEventVCardBy($event_url){
373
+    public function getEventVCardBy($event_url) {
386 374
         $http_response = $this->makeRequest(
387
-            RequestFactory::createGetRequest
388
-            (
375
+            RequestFactory::createGetRequest(
389 376
                 $event_url
390 377
             )
391 378
         );
392 379
 
393
-        $ical = (string)$http_response->getBody();
380
+        $ical = (string) $http_response->getBody();
394 381
         return $ical;
395 382
     }
396 383
 
@@ -402,17 +389,15 @@  discard block
 block discarded – undo
402 389
     public function getEventsBy($calendar_url, array $events_urls)
403 390
     {
404 391
         $http_response = $this->makeRequest(
405
-            RequestFactory::createReportRequest
406
-            (
392
+            RequestFactory::createReportRequest(
407 393
                 $calendar_url,
408 394
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent()
409 395
             )
410 396
         );
411 397
 
412
-        return new ResourceCollectionResponse
413
-        (
398
+        return new ResourceCollectionResponse(
414 399
             $this->server_url,
415
-            (string)$http_response->getBody(),
400
+            (string) $http_response->getBody(),
416 401
             $http_response->getStatusCode()
417 402
         );
418 403
     }
@@ -426,17 +411,15 @@  discard block
 block discarded – undo
426 411
     {
427 412
 
428 413
         $http_response = $this->makeRequest(
429
-            RequestFactory::createReportRequest
430
-            (
414
+            RequestFactory::createReportRequest(
431 415
                 $calendar_url,
432 416
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent()
433 417
             )
434 418
         );
435 419
 
436
-        return new ResourceCollectionResponse
437
-        (
420
+        return new ResourceCollectionResponse(
438 421
             $this->server_url,
439
-            (string)$http_response->getBody(),
422
+            (string) $http_response->getBody(),
440 423
             $http_response->getStatusCode()
441 424
         );
442 425
     }
@@ -449,16 +432,14 @@  discard block
 block discarded – undo
449 432
     public function deleteCalendar($calendar_url, $etag = null)
450 433
     {
451 434
         $http_response = $this->makeRequest(
452
-            RequestFactory::createDeleteRequest
453
-            (
435
+            RequestFactory::createDeleteRequest(
454 436
                 $calendar_url,
455 437
                 $etag
456 438
             )
457 439
         );
458 440
 
459
-        return new CalendarDeletedResponse
460
-        (
461
-            (string)$http_response->getBody(), $http_response->getStatusCode()
441
+        return new CalendarDeletedResponse(
442
+            (string) $http_response->getBody(), $http_response->getStatusCode()
462 443
         );
463 444
     }
464 445
 }
Please login to merge, or discard this patch.