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.

CustomFieldsCollection   A
last analyzed

Complexity

Total Complexity 14

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 14
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 100
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toArray() 0 10 2
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 CustomFieldsCollection implements \ArrayAccess, \Iterator, \Countable
6
{
7
	/** @var array|CustomField[] */
8
	protected $customFields;
9
10
	/**
11
	 * @param array|CustomField[] $customFields
12
	 */
13
	public function __construct(array $customFields)
14
	{
15
		$this->customFields = $customFields;
16
		$this->rewind();
17
	}
18
19
	/**
20
	 * @return array
21
	 */
22
	public function toArray()
23
	{
24
		$array = [];
25
		foreach ($this as $customField)
26
		{
27
			$array[$customField->getName()] = $customField->getValue();
28
		}
29
30
		return $array;
31
	}
32
33
	/**
34
	 * @return array|CustomField[]
35
	 */
36
	public function getItems()
37
	{
38
		return $this->customFields;
39
	}
40
41
	/** {@inheritdoc} */
42
	public function offsetExists($offset)
43
	{
44
		return array_key_exists($offset, $this->customFields);
45
	}
46
47
	/** {@inheritdoc} */
48
	public function offsetGet($offset)
49
	{
50
		return $this->customFields[$offset];
51
	}
52
53
	/** {@inheritdoc} */
54
	public function offsetSet($offset, $value)
55
	{
56
		$this->customFields[$offset] = $value;
57
	}
58
59
	/** {@inheritdoc} */
60
	public function offsetUnset($offset)
61
	{
62
		unset($this->customFields[$offset]);
63
	}
64
65
	/**
66
	 * @return CustomField|null
67
	 */
68
	public function current()
69
	{
70
		return current($this->customFields);
71
	}
72
73
	/**
74
	 * @return CustomField|null
75
	 */
76
	public function next()
77
	{
78
		return next($this->customFields);
79
	}
80
81
	/** {@inheritdoc} */
82
	public function key()
83
	{
84
		return key($this->customFields);
85
	}
86
87
	/** {@inheritdoc} */
88
	public function valid()
89
	{
90
		return null !== $this->key();
91
	}
92
93
	/** {@inheritdoc} */
94
	public function rewind()
95
	{
96
		reset($this->customFields);
97
	}
98
99
	/** {@inheritdoc} */
100
	public function count()
101
	{
102
		return count($this->customFields);
103
	}
104
}
105