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.
Test Setup Failed
Push — master ( e039e4...016889 )
by Gabriel
04:43
created

Collection::end()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Nip;
4
5
use Nip\Collections\AbstractCollection;
6
7
/**
8
 * Class Collection
9
 * @package Nip
10
 */
11
class Collection extends AbstractCollection
12
{
13
14
    /**
15
     * @param $value
16
     * @param bool $index
17
     * @return $this
18
     */
19
    public function unshift($value, $index = false)
20
    {
21
        if (is_null($index)) {
22
            $index = $this->index++;
23
        }
24
25
        $this->items = array_reverse($this->items, true);
26
        $this->items[$index] = $value;
27
        $this->items = array_reverse($this->items, true);
28
29
        return $this;
30
    }
31
32
    /**
33
     * @return $this
34
     */
35
    public function clear()
36
    {
37
        $this->rewind();
38
        $this->items = [];
39
40
        return $this;
41
    }
42
43
    /**
44
     * @param $key
45
     * @return $this
46
     */
47
    public function keyBy($key)
48
    {
49
        $oldItems = $this->toArray();
50
        $newItems = [];
51
        foreach ($oldItems as $item) {
52
            $aKey = $item->{$key};
53
            $newItems[$aKey] = $item;
54
        }
55
        $this->setItems($newItems);
56
        return $this;
57
    }
58
59
    /**
60
     * @param $index
61
     * @return mixed|null
62
     */
63
    public function getNth($index)
64
    {
65
        $keys = $this->keys();
66
        $index = $index - 1;
67
        if (isset($keys[$index])) {
68
            $key = $keys[$index];
69
            return $this->offsetGet($key);
70
        }
71
        return null;
72
    }
73
}