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 (#10)
by
unknown
05:45
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;
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
 
181 181
         $res     = $http_response->hasHeader(self::DAVHeader);
182 182
         $options = [];
183
-        if($res){
183
+        if ($res) {
184 184
             $val = $http_response->getHeaderLine(self::DAVHeader);
185
-            if(!empty($val)){
185
+            if (!empty($val)) {
186 186
                 $options = explode(', ', $val);
187 187
             }
188 188
         }
@@ -196,14 +196,13 @@  discard block
 block discarded – undo
196 196
     public function getUserPrincipal()
197 197
     {
198 198
         $http_response = $this->makeRequest(
199
-            RequestFactory::createPropFindRequest
200
-            (
199
+            RequestFactory::createPropFindRequest(
201 200
                 $this->server_url,
202 201
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent()
203 202
             )
204 203
         );
205 204
 
206
-        return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
205
+        return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
207 206
     }
208 207
 
209 208
     /**
@@ -214,14 +213,13 @@  discard block
 block discarded – undo
214 213
     public function getCalendarHome($principal_url)
215 214
     {
216 215
         $http_response = $this->makeRequest(
217
-            RequestFactory::createPropFindRequest
218
-            (
216
+            RequestFactory::createPropFindRequest(
219 217
                 $principal_url,
220 218
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent()
221 219
             )
222 220
         );
223 221
 
224
-        return new CalendarHomesMultiResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
222
+        return new CalendarHomesMultiResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
225 223
     }
226 224
 
227 225
     /**
@@ -236,10 +234,9 @@  discard block
 block discarded – undo
236 234
         $uid           = $vo->getUID();
237 235
         $resource_name = $vo->getResourceName();
238 236
 
239
-        $resource_url  = $calendar_home_set . ($resource_name ? $resource_name : $uid);
237
+        $resource_url  = $calendar_home_set.($resource_name ? $resource_name : $uid);
240 238
         $http_response = $this->makeRequest(
241
-            RequestFactory::createMakeCalendarRequest
242
-            (
239
+            RequestFactory::createMakeCalendarRequest(
243 240
                 $resource_url,
244 241
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent()
245 242
             )
@@ -256,14 +253,13 @@  discard block
 block discarded – undo
256 253
     public function getCalendars($calendar_home_set_url)
257 254
     {
258 255
         $http_response = $this->makeRequest(
259
-            RequestFactory::createPropFindRequest
260
-            (
256
+            RequestFactory::createPropFindRequest(
261 257
                 $calendar_home_set_url,
262 258
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent()
263 259
             )
264 260
         );
265 261
 
266
-        return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
262
+        return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
267 263
     }
268 264
 
269 265
     /**
@@ -274,15 +270,14 @@  discard block
 block discarded – undo
274 270
     public function getCalendar($calendar_url)
275 271
     {
276 272
         $http_response = $this->makeRequest(
277
-            RequestFactory::createPropFindRequest
278
-            (
273
+            RequestFactory::createPropFindRequest(
279 274
                 $calendar_url,
280 275
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(),
281 276
                 0
282 277
             )
283 278
         );
284 279
 
285
-        return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
280
+        return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
286 281
     }
287 282
 
288 283
 
@@ -296,14 +291,13 @@  discard block
 block discarded – undo
296 291
     {
297 292
 
298 293
         $http_response = $this->makeRequest(
299
-            RequestFactory::createReportRequest
300
-            (
294
+            RequestFactory::createReportRequest(
301 295
                 $calendar_url,
302 296
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent()
303 297
             )
304 298
         );
305 299
 
306
-        return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode());
300
+        return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode());
307 301
     }
308 302
 
309 303
     /**
@@ -317,19 +311,17 @@  discard block
 block discarded – undo
317 311
         $uid           = $vo->getUID();
318 312
         $resource_url  = $calendar_url.$uid.self::SchedulingInformationSuffix;
319 313
         $http_response = $this->makeRequest(
320
-            RequestFactory::createPutRequest
321
-            (
314
+            RequestFactory::createPutRequest(
322 315
                 $resource_url,
323 316
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent()
324 317
             )
325 318
         );
326 319
         $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null;
327
-        return new EventCreatedResponse
328
-        (
320
+        return new EventCreatedResponse(
329 321
             $uid,
330 322
             $etag,
331 323
             $resource_url,
332
-            (string)$http_response->getBody(),
324
+            (string) $http_response->getBody(),
333 325
             $http_response->getStatusCode()
334 326
         );
335 327
     }
@@ -346,20 +338,18 @@  discard block
 block discarded – undo
346 338
         $uid           = $vo->getUID();
347 339
         $resource_url  = $calendar_url.$uid.self::SchedulingInformationSuffix;
348 340
         $http_response = $this->makeRequest(
349
-            RequestFactory::createPutRequest
350
-            (
341
+            RequestFactory::createPutRequest(
351 342
                 $resource_url,
352 343
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(),
353 344
                 $etag
354 345
             )
355 346
         );
356 347
         $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null;
357
-        return new EventUpdatedResponse
358
-        (
348
+        return new EventUpdatedResponse(
359 349
             $uid,
360 350
             $etag,
361 351
             $resource_url,
362
-            (string)$http_response->getBody(),
352
+            (string) $http_response->getBody(),
363 353
             $http_response->getStatusCode()
364 354
         );
365 355
     }
@@ -374,16 +364,14 @@  discard block
 block discarded – undo
374 364
     public function deleteEvent($calendar_url, $uid, $etag = null)
375 365
     {
376 366
         $http_response = $this->makeRequest(
377
-            RequestFactory::createDeleteRequest
378
-            (
367
+            RequestFactory::createDeleteRequest(
379 368
                 $calendar_url.$uid.self::SchedulingInformationSuffix,
380 369
                 $etag
381 370
             )
382 371
         );
383 372
 
384
-        return new EventDeletedResponse
385
-        (
386
-            (string)$http_response->getBody(), $http_response->getStatusCode()
373
+        return new EventDeletedResponse(
374
+            (string) $http_response->getBody(), $http_response->getStatusCode()
387 375
         );
388 376
     }
389 377
 
@@ -392,15 +380,14 @@  discard block
 block discarded – undo
392 380
      * @return string
393 381
      * @throws \GuzzleHttp\Exception\GuzzleException
394 382
      */
395
-    public function getEventVCardBy($event_url){
383
+    public function getEventVCardBy($event_url) {
396 384
         $http_response = $this->makeRequest(
397
-            RequestFactory::createGetRequest
398
-            (
385
+            RequestFactory::createGetRequest(
399 386
                 $event_url
400 387
             )
401 388
         );
402 389
 
403
-        $ical = (string)$http_response->getBody();
390
+        $ical = (string) $http_response->getBody();
404 391
         return $ical;
405 392
     }
406 393
 
@@ -413,17 +400,15 @@  discard block
 block discarded – undo
413 400
     public function getEventsBy($calendar_url, array $events_urls)
414 401
     {
415 402
         $http_response = $this->makeRequest(
416
-            RequestFactory::createReportRequest
417
-            (
403
+            RequestFactory::createReportRequest(
418 404
                 $calendar_url,
419 405
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent()
420 406
             )
421 407
         );
422 408
 
423
-        return new ResourceCollectionResponse
424
-        (
409
+        return new ResourceCollectionResponse(
425 410
             $this->server_url,
426
-            (string)$http_response->getBody(),
411
+            (string) $http_response->getBody(),
427 412
             $http_response->getStatusCode()
428 413
         );
429 414
     }
@@ -438,17 +423,15 @@  discard block
 block discarded – undo
438 423
     {
439 424
 
440 425
         $http_response = $this->makeRequest(
441
-            RequestFactory::createReportRequest
442
-            (
426
+            RequestFactory::createReportRequest(
443 427
                 $calendar_url,
444 428
                 CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent()
445 429
             )
446 430
         );
447 431
 
448
-        return new ResourceCollectionResponse
449
-        (
432
+        return new ResourceCollectionResponse(
450 433
             $this->server_url,
451
-            (string)$http_response->getBody(),
434
+            (string) $http_response->getBody(),
452 435
             $http_response->getStatusCode()
453 436
         );
454 437
     }
@@ -462,16 +445,14 @@  discard block
 block discarded – undo
462 445
     public function deleteCalendar($calendar_url, $etag = null)
463 446
     {
464 447
         $http_response = $this->makeRequest(
465
-            RequestFactory::createDeleteRequest
466
-            (
448
+            RequestFactory::createDeleteRequest(
467 449
                 $calendar_url,
468 450
                 $etag
469 451
             )
470 452
         );
471 453
 
472
-        return new CalendarDeletedResponse
473
-        (
474
-            (string)$http_response->getBody(), $http_response->getStatusCode()
454
+        return new CalendarDeletedResponse(
455
+            (string) $http_response->getBody(), $http_response->getStatusCode()
475 456
         );
476 457
     }
477 458
 }
Please login to merge, or discard this patch.