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.

ResourceCollection::count()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace prgTW\BaseCRM\Resource;
4
5
class ResourceCollection implements \ArrayAccess, \Iterator, \Countable
6
{
7
	/** @var Resource[] */
8
	protected $items;
9
10
	/**
11
	 * @param array $resources
12
	 */
13
	public function __construct(array $resources)
14
	{
15
		$this->items = $resources;
16
		$this->rewind();
17
	}
18
19
	/**
20
	 * @return Resource[]
21
	 */
22
	public function getItems()
23
	{
24
		return $this->items;
25
	}
26
27
	/** {@inheritdoc} */
28
	public function offsetExists($offset)
29
	{
30
		return array_key_exists($offset, $this->items);
31
	}
32
33
	/** {@inheritdoc} */
34
	public function offsetGet($offset)
35
	{
36
		return $this->items[$offset];
37
	}
38
39
	/** {@inheritdoc} */
40
	public function offsetSet($offset, $value)
41
	{
42
		$this->items[$offset] = $value;
43
	}
44
45
	/** {@inheritdoc} */
46
	public function offsetUnset($offset)
47
	{
48
		unset($this->items[$offset]);
49
	}
50
51
	/**
52
	 * @return Resource|null
0 ignored issues
show
Documentation introduced by
Should the return type not be resource|false?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
53
	 */
54
	public function current()
55
	{
56
		return current($this->items);
57
	}
58
59
	/**
60
	 * @return Resource|null
0 ignored issues
show
Documentation introduced by
Should the return type not be resource|false?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
61
	 */
62
	public function next()
63
	{
64
		return next($this->items);
65
	}
66
67
	/** {@inheritdoc} */
68
	public function key()
69
	{
70
		return key($this->items);
71
	}
72
73
	/** {@inheritdoc} */
74
	public function valid()
75
	{
76
		return null !== $this->key();
77
	}
78
79
	/** {@inheritdoc} */
80
	public function rewind()
81
	{
82
		reset($this->items);
83
	}
84
85
	/** @{inheritdoc} */
86
	public function count()
87
	{
88
		return count($this->items);
89
	}
90
}
91