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
Pull Request — master (#7)
by
unknown
03:11
created
src/Facade/CalDavClient.php 1 patch
Spacing   +40 added lines, -59 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param string $authtype
109 109
      * @param array $headers Additional headers to send with each request
110 110
      */
111
-    public function __construct($server_url, $user = null, $password = null, $authtype = self::DefaultAuthType, $headers=[])
111
+    public function __construct($server_url, $user = null, $password = null, $authtype = self::DefaultAuthType, $headers = [])
112 112
     {
113 113
         $this->server_url = $server_url;
114 114
         $this->user       = $user;
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
      * @return mixed|\Psr\Http\Message\ResponseInterface
158 158
      * @throws \GuzzleHttp\Exception\GuzzleException
159 159
      */
160
-    private function makeRequest(Request $http_request){
161
-        try{
160
+    private function makeRequest(Request $http_request) {
161
+        try {
162 162
             $options = [
163 163
                 'timeout' => $this->timeout
164 164
             ];
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
             return $this->client->send($http_request, $options);
178 178
         }
179
-        catch (ClientException $ex){
180
-            switch($ex->getCode()){
179
+        catch (ClientException $ex) {
180
+            switch ($ex->getCode()) {
181 181
                 case 401:
182 182
                     throw new UserUnAuthorizedException();
183 183
                     break;
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 
211 211
         $res     = $http_response->hasHeader(self::DAVHeader);
212 212
         $options = [];
213
-        if($res){
213
+        if ($res) {
214 214
             $val = $http_response->getHeaderLine(self::DAVHeader);
215
-            if(!empty($val)){
215
+            if (!empty($val)) {
216 216
                 $options = explode(', ', $val);
217 217
             }
218 218
         }
@@ -226,14 +226,13 @@  discard block
 block discarded – undo
226 226
     public function getUserPrincipal()
227 227
     {
228 228
         $http_response = $this->makeRequest(
229
-            RequestFactory::createPropFindRequest
230
-            (
229
+            RequestFactory::createPropFindRequest(
231 230
                 $this->server_url,
232 231
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent()
233 232
             )
234 233
         );
235 234
 
236
-        return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
235
+        return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
237 236
     }
238 237
 
239 238
     /**
@@ -244,14 +243,13 @@  discard block
 block discarded – undo
244 243
     public function getCalendarHome($principal_url)
245 244
     {
246 245
         $http_response = $this->makeRequest(
247
-            RequestFactory::createPropFindRequest
248
-            (
246
+            RequestFactory::createPropFindRequest(
249 247
                 $principal_url,
250 248
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent()
251 249
             )
252 250
         );
253 251
 
254
-        return new CalendarHomesResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
252
+        return new CalendarHomesResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
255 253
     }
256 254
 
257 255
     /**
@@ -266,10 +264,9 @@  discard block
 block discarded – undo
266 264
         $uid           = $vo->getUID();
267 265
         $resource_name = $vo->getResourceName();
268 266
 
269
-        $resource_url  = $calendar_home_set . ($resource_name ? $resource_name : $uid);
267
+        $resource_url  = $calendar_home_set.($resource_name ? $resource_name : $uid);
270 268
         $http_response = $this->makeRequest(
271
-            RequestFactory::createMakeCalendarRequest
272
-            (
269
+            RequestFactory::createMakeCalendarRequest(
273 270
                 $resource_url,
274 271
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent()
275 272
             )
@@ -286,14 +283,13 @@  discard block
 block discarded – undo
286 283
     public function getCalendars($calendar_home_set_url)
287 284
     {
288 285
         $http_response = $this->makeRequest(
289
-            RequestFactory::createPropFindRequest
290
-            (
286
+            RequestFactory::createPropFindRequest(
291 287
                 $calendar_home_set_url,
292 288
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent()
293 289
             )
294 290
         );
295 291
 
296
-        return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
292
+        return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
297 293
     }
298 294
 
299 295
     /**
@@ -305,15 +301,14 @@  discard block
 block discarded – undo
305 301
     public function getCalendar($calendar_url, $depth = 0)
306 302
     {
307 303
         $http_response = $this->makeRequest(
308
-            RequestFactory::createPropFindRequest
309
-            (
304
+            RequestFactory::createPropFindRequest(
310 305
                 $calendar_url,
311 306
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(),
312 307
                 $depth
313 308
             )
314 309
         );
315 310
 
316
-        return new GetCalendarMultiResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
311
+        return new GetCalendarMultiResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
317 312
     }
318 313
 
319 314
 
@@ -327,14 +322,13 @@  discard block
 block discarded – undo
327 322
     {
328 323
 
329 324
         $http_response = $this->makeRequest(
330
-            RequestFactory::createReportRequest
331
-            (
325
+            RequestFactory::createReportRequest(
332 326
                 $calendar_url,
333 327
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent()
334 328
             )
335 329
         );
336 330
 
337
-        return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
331
+        return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
338 332
     }
339 333
 
340 334
     /**
@@ -348,19 +342,17 @@  discard block
 block discarded – undo
348 342
         $uid           = $vo->getUID();
349 343
         $resource_url  = $calendar_url.$uid.self::SchedulingInformationSuffix;
350 344
         $http_response = $this->makeRequest(
351
-            RequestFactory::createPutRequest
352
-            (
345
+            RequestFactory::createPutRequest(
353 346
                 $resource_url,
354 347
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent()
355 348
             )
356 349
         );
357 350
         $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null;
358
-        return new EventCreatedResponse
359
-        (
351
+        return new EventCreatedResponse(
360 352
             $uid,
361 353
             $etag,
362 354
             $resource_url,
363
-            (string)$http_response->getBody(),
355
+            (string) $http_response->getBody(),
364 356
             $http_response->getStatusCode()
365 357
         );
366 358
     }
@@ -377,20 +369,18 @@  discard block
 block discarded – undo
377 369
         $uid           = $vo->getUID();
378 370
         $resource_url  = $calendar_url.$uid.self::SchedulingInformationSuffix;
379 371
         $http_response = $this->makeRequest(
380
-            RequestFactory::createPutRequest
381
-            (
372
+            RequestFactory::createPutRequest(
382 373
                 $resource_url,
383 374
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(),
384 375
                 $etag
385 376
             )
386 377
         );
387 378
         $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null;
388
-        return new EventUpdatedResponse
389
-        (
379
+        return new EventUpdatedResponse(
390 380
             $uid,
391 381
             $etag,
392 382
             $resource_url,
393
-            (string)$http_response->getBody(),
383
+            (string) $http_response->getBody(),
394 384
             $http_response->getStatusCode()
395 385
         );
396 386
     }
@@ -405,16 +395,14 @@  discard block
 block discarded – undo
405 395
     public function deleteEvent($calendar_url, $uid, $etag = null)
406 396
     {
407 397
         $http_response = $this->makeRequest(
408
-            RequestFactory::createDeleteRequest
409
-            (
398
+            RequestFactory::createDeleteRequest(
410 399
                 $calendar_url.$uid.self::SchedulingInformationSuffix,
411 400
                 $etag
412 401
             )
413 402
         );
414 403
 
415
-        return new EventDeletedResponse
416
-        (
417
-            (string)$http_response->getBody(), $http_response->getStatusCode()
404
+        return new EventDeletedResponse(
405
+            (string) $http_response->getBody(), $http_response->getStatusCode()
418 406
         );
419 407
     }
420 408
 
@@ -423,15 +411,14 @@  discard block
 block discarded – undo
423 411
      * @return string
424 412
      * @throws \GuzzleHttp\Exception\GuzzleException
425 413
      */
426
-    public function getEventVCardBy($event_url){
414
+    public function getEventVCardBy($event_url) {
427 415
         $http_response = $this->makeRequest(
428
-            RequestFactory::createGetRequest
429
-            (
416
+            RequestFactory::createGetRequest(
430 417
                 $event_url
431 418
             )
432 419
         );
433 420
 
434
-        $ical = (string)$http_response->getBody();
421
+        $ical = (string) $http_response->getBody();
435 422
         return $ical;
436 423
     }
437 424
 
@@ -444,17 +431,15 @@  discard block
 block discarded – undo
444 431
     public function getEventsBy($calendar_url, array $events_urls)
445 432
     {
446 433
         $http_response = $this->makeRequest(
447
-            RequestFactory::createReportRequest
448
-            (
434
+            RequestFactory::createReportRequest(
449 435
                 $calendar_url,
450 436
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent()
451 437
             )
452 438
         );
453 439
 
454
-        return new ResourceCollectionResponse
455
-        (
440
+        return new ResourceCollectionResponse(
456 441
             $this->server_url,
457
-            (string)$http_response->getBody(),
442
+            (string) $http_response->getBody(),
458 443
             $http_response->getStatusCode()
459 444
         );
460 445
     }
@@ -469,17 +454,15 @@  discard block
 block discarded – undo
469 454
     {
470 455
 
471 456
         $http_response = $this->makeRequest(
472
-            RequestFactory::createReportRequest
473
-            (
457
+            RequestFactory::createReportRequest(
474 458
                 $calendar_url,
475 459
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent()
476 460
             )
477 461
         );
478 462
 
479
-        return new ResourceCollectionResponse
480
-        (
463
+        return new ResourceCollectionResponse(
481 464
             $this->server_url,
482
-            (string)$http_response->getBody(),
465
+            (string) $http_response->getBody(),
483 466
             $http_response->getStatusCode()
484 467
         );
485 468
     }
@@ -493,16 +476,14 @@  discard block
 block discarded – undo
493 476
     public function deleteCalendar($calendar_url, $etag = null)
494 477
     {
495 478
         $http_response = $this->makeRequest(
496
-            RequestFactory::createDeleteRequest
497
-            (
479
+            RequestFactory::createDeleteRequest(
498 480
                 $calendar_url,
499 481
                 $etag
500 482
             )
501 483
         );
502 484
 
503
-        return new CalendarDeletedResponse
504
-        (
505
-            (string)$http_response->getBody(), $http_response->getStatusCode()
485
+        return new CalendarDeletedResponse(
486
+            (string) $http_response->getBody(), $http_response->getStatusCode()
506 487
         );
507 488
     }
508 489
 }
Please login to merge, or discard this patch.