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

AbstractCollection::has()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Nip\Collections;
4
5
use ArrayAccess;
6
use ArrayIterator;
7
use Countable;
8
use IteratorAggregate;
9
use JsonSerializable;
10
use Nip\Collections\Traits\AccessMethodsTrait;
11
use Nip\Collections\Traits\ArrayAccessTrait;
12
use Nip\Collections\Traits\OperationsTrait;
13
use Nip\Collections\Traits\SortingTrait;
14
use Nip\Collections\Traits\TransformMethodsTrait;
15
16
/**
17
 * Class Registry
18
 * @package Nip
19
 */
20
class AbstractCollection implements ArrayAccess, Countable, IteratorAggregate, JsonSerializable
21
{
22
    use ArrayAccessTrait;
23
    use AccessMethodsTrait;
24
    use OperationsTrait;
25
    use SortingTrait;
26
    use TransformMethodsTrait;
27
28
    /**
29
     * @var array
30
     */
31
    protected $items = [];
32
33
    protected $index = 0;
34
35
    /**
36
     * Collection constructor.
37
     * @param array $items
38
     */
39
    public function __construct($items = [])
40
    {
41
        if (is_array($items)) {
42
            $this->items = $items;
43
        } elseif ($items instanceof AbstractCollection) {
44
            $this->items = $items->toArray();
45
        }
46
    }
47
48
    /**
49
     * @param $needle
50
     * @return bool
51
     */
52
    function contains($needle)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
53
    {
54
        foreach ($this as $key => $value) {
55
            if ($value === $needle) {
56
                return true;
57
            }
58
        }
59
        return false;
60
    }
61
62
    /**
63
     * @return ArrayIterator
64
     */
65
    public function getIterator()
66
    {
67
        return new ArrayIterator($this->items);
68
    }
69
70
71
}