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.
Completed
Push — master ( 402375...9025fe )
by Alexander
01:40
created
YaLinqo/EnumerablePagination.php 1 patch
Braces   +69 added lines, -47 removed lines patch added patch discarded remove patch
@@ -32,14 +32,16 @@  discard block
 block discarded – undo
32 32
         $it = $this->getIterator();
33 33
 
34 34
         if ($it instanceof \ArrayAccess) {
35
-            if (!$it->offsetExists($key))
36
-                throw new \UnexpectedValueException(Errors::NO_KEY);
35
+            if (!$it->offsetExists($key)) {
36
+                            throw new \UnexpectedValueException(Errors::NO_KEY);
37
+            }
37 38
             return $it->offsetGet($key);
38 39
         }
39 40
 
40 41
         foreach ($it as $k => $v) {
41
-            if ($k === $key)
42
-                return $v;
42
+            if ($k === $key) {
43
+                            return $v;
44
+            }
43 45
         }
44 46
         throw new \UnexpectedValueException(Errors::NO_KEY);
45 47
     }
@@ -58,12 +60,14 @@  discard block
 block discarded – undo
58 60
         /** @var $it \Iterator|\ArrayAccess */
59 61
         $it = $this->getIterator();
60 62
 
61
-        if ($it instanceof \ArrayAccess)
62
-            return $it->offsetExists($key) ? $it->offsetGet($key) : $default;
63
+        if ($it instanceof \ArrayAccess) {
64
+                    return $it->offsetExists($key) ? $it->offsetGet($key) : $default;
65
+        }
63 66
 
64 67
         foreach ($it as $k => $v) {
65
-            if ($k === $key)
66
-                return $v;
68
+            if ($k === $key) {
69
+                            return $v;
70
+            }
67 71
         }
68 72
         return $default;
69 73
     }
@@ -86,8 +90,9 @@  discard block
 block discarded – undo
86 90
         $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true);
87 91
 
88 92
         foreach ($this as $k => $v) {
89
-            if ($predicate($v, $k))
90
-                return $v;
93
+            if ($predicate($v, $k)) {
94
+                            return $v;
95
+            }
91 96
         }
92 97
         throw new \UnexpectedValueException(Errors::NO_MATCHES);
93 98
     }
@@ -109,8 +114,9 @@  discard block
 block discarded – undo
109 114
         $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true);
110 115
 
111 116
         foreach ($this as $k => $v) {
112
-            if ($predicate($v, $k))
113
-                return $v;
117
+            if ($predicate($v, $k)) {
118
+                            return $v;
119
+            }
114 120
         }
115 121
         return $default;
116 122
     }
@@ -132,8 +138,9 @@  discard block
 block discarded – undo
132 138
         $predicate = Utils::createLambda($predicate, 'v,k', Functions::$true);
133 139
 
134 140
         foreach ($this as $k => $v) {
135
-            if ($predicate($v, $k))
136
-                return $v;
141
+            if ($predicate($v, $k)) {
142
+                            return $v;
143
+            }
137 144
         }
138 145
         return $fallback();
139 146
     }
@@ -163,8 +170,9 @@  discard block
 block discarded – undo
163 170
                 $value = $v;
164 171
             }
165 172
         }
166
-        if (!$found)
167
-            throw new \UnexpectedValueException(Errors::NO_MATCHES);
173
+        if (!$found) {
174
+                    throw new \UnexpectedValueException(Errors::NO_MATCHES);
175
+        }
168 176
         return $value;
169 177
     }
170 178
 
@@ -243,14 +251,16 @@  discard block
 block discarded – undo
243 251
         $value = null;
244 252
         foreach ($this as $k => $v) {
245 253
             if ($predicate($v, $k)) {
246
-                if ($found)
247
-                    throw new \UnexpectedValueException(Errors::MANY_MATCHES);
254
+                if ($found) {
255
+                                    throw new \UnexpectedValueException(Errors::MANY_MATCHES);
256
+                }
248 257
                 $found = true;
249 258
                 $value = $v;
250 259
             }
251 260
         }
252
-        if (!$found)
253
-            throw new \UnexpectedValueException(Errors::NO_MATCHES);
261
+        if (!$found) {
262
+                    throw new \UnexpectedValueException(Errors::NO_MATCHES);
263
+        }
254 264
         return $value;
255 265
     }
256 266
 
@@ -275,8 +285,9 @@  discard block
 block discarded – undo
275 285
         $value = null;
276 286
         foreach ($this as $k => $v) {
277 287
             if ($predicate($v, $k)) {
278
-                if ($found)
279
-                    throw new \UnexpectedValueException(Errors::MANY_MATCHES);
288
+                if ($found) {
289
+                                    throw new \UnexpectedValueException(Errors::MANY_MATCHES);
290
+                }
280 291
                 $found = true;
281 292
                 $value = $v;
282 293
             }
@@ -305,8 +316,9 @@  discard block
 block discarded – undo
305 316
         $value = null;
306 317
         foreach ($this as $k => $v) {
307 318
             if ($predicate($v, $k)) {
308
-                if ($found)
309
-                    throw new \UnexpectedValueException(Errors::MANY_MATCHES);
319
+                if ($found) {
320
+                                    throw new \UnexpectedValueException(Errors::MANY_MATCHES);
321
+                }
310 322
                 $found = true;
311 323
                 $value = $v;
312 324
             }
@@ -325,12 +337,13 @@  discard block
 block discarded – undo
325 337
     public function indexOf($value)
326 338
     {
327 339
         $array = $this->tryGetArrayCopy();
328
-        if ($array !== null)
329
-            return array_search($value, $array, true);
330
-        else {
340
+        if ($array !== null) {
341
+                    return array_search($value, $array, true);
342
+        } else {
331 343
             foreach ($this as $k => $v) {
332
-                if ($v === $value)
333
-                    return $k;
344
+                if ($v === $value) {
345
+                                    return $k;
346
+                }
334 347
             }
335 348
             return false;
336 349
         }
@@ -348,8 +361,9 @@  discard block
 block discarded – undo
348 361
     {
349 362
         $key = null;
350 363
         foreach ($this as $k => $v) {
351
-            if ($v === $value)
352
-                $key = $k;
364
+            if ($v === $value) {
365
+                            $key = $k;
366
+            }
353 367
         }
354 368
         return $key; // not -1
355 369
     }
@@ -367,8 +381,9 @@  discard block
 block discarded – undo
367 381
         $predicate = Utils::createLambda($predicate, 'v,k');
368 382
 
369 383
         foreach ($this as $k => $v) {
370
-            if ($predicate($v, $k))
371
-                return $k;
384
+            if ($predicate($v, $k)) {
385
+                            return $k;
386
+            }
372 387
         }
373 388
         return null; // not -1
374 389
     }
@@ -387,8 +402,9 @@  discard block
 block discarded – undo
387 402
 
388 403
         $key = null;
389 404
         foreach ($this as $k => $v) {
390
-            if ($predicate($v, $k))
391
-                $key = $k;
405
+            if ($predicate($v, $k)) {
406
+                            $key = $k;
407
+            }
392 408
         }
393 409
         return $key; // not -1
394 410
     }
@@ -407,8 +423,9 @@  discard block
 block discarded – undo
407 423
         return new self(function() use ($count) {
408 424
             $it = $this->getIterator();
409 425
             $it->rewind();
410
-            for ($i = 0; $i < $count && $it->valid(); ++$i)
411
-                $it->next();
426
+            for ($i = 0; $i < $count && $it->valid(); ++$i) {
427
+                            $it->next();
428
+            }
412 429
             while ($it->valid()) {
413 430
                 yield $it->key() => $it->current();
414 431
                 $it->next();
@@ -432,10 +449,12 @@  discard block
 block discarded – undo
432 449
         return new self(function() use ($predicate) {
433 450
             $yielding = false;
434 451
             foreach ($this as $k => $v) {
435
-                if (!$yielding && !$predicate($v, $k))
436
-                    $yielding = true;
437
-                if ($yielding)
438
-                    yield $k => $v;
452
+                if (!$yielding && !$predicate($v, $k)) {
453
+                                    $yielding = true;
454
+                }
455
+                if ($yielding) {
456
+                                    yield $k => $v;
457
+                }
439 458
             }
440 459
         });
441 460
     }
@@ -451,14 +470,16 @@  discard block
 block discarded – undo
451 470
      */
452 471
     public function take(int $count)
453 472
     {
454
-        if ($count <= 0)
455
-            return new self(new \EmptyIterator, false);
473
+        if ($count <= 0) {
474
+                    return new self(new \EmptyIterator, false);
475
+        }
456 476
 
457 477
         return new self(function() use ($count) {
458 478
             foreach ($this as $k => $v) {
459 479
                 yield $k => $v;
460
-                if (--$count == 0)
461
-                    break;
480
+                if (--$count == 0) {
481
+                                    break;
482
+                }
462 483
             }
463 484
         });
464 485
     }
@@ -478,8 +499,9 @@  discard block
 block discarded – undo
478 499
 
479 500
         return new self(function() use ($predicate) {
480 501
             foreach ($this as $k => $v) {
481
-                if (!$predicate($v, $k))
482
-                    break;
502
+                if (!$predicate($v, $k)) {
503
+                                    break;
504
+                }
483 505
                 yield $k => $v;
484 506
             }
485 507
         });
Please login to merge, or discard this patch.