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   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 12
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 86
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getItems() 0 4 1
A offsetExists() 0 4 1
A offsetGet() 0 4 1
A offsetSet() 0 4 1
A offsetUnset() 0 4 1
A current() 0 4 1
A next() 0 4 1
A key() 0 4 1
A valid() 0 4 1
A rewind() 0 4 1
A count() 0 4 1
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