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.

ArrayAccessTrait   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 68
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
__set() 0 1 ?
__get() 0 1 ?
A getPropertyNames() 0 9 2
A offsetSet() 0 4 1
A offsetExists() 0 4 1
A offsetUnset() 0 7 2
A offsetGet() 0 4 1
1
<?php
2
/**
3
 * @package domain
4
 * @subpackage models
5
 * @author Marius Orcsik <[email protected]>
6
 * @created 2015-04-15
7
 */
8
namespace vsc\domain\models;
9
10
trait ArrayAccessTrait {
11
	/**
12
	 * @param string $sOffset
13
	 * @param mixed $mValue
14
	 * @return mixed
15
	 */
16
	public abstract function __set($sOffset, $mValue);
17
18
	/**
19
	 * @param string $sOffset
20
	 * @return mixed
21
	 */
22
	public abstract function __get($sOffset);
23
24
	/**
25
	 * @return array
26
	 */
27
	private function getPropertyNames() {
28
		$ret = [];
29
		$mirror = new \ReflectionClass($this);
30
		foreach ($mirror->getProperties() as $mirrorProperty) {
31
			$ret[] = $mirrorProperty->getName();
32
		}
33
34
		return $ret;
35
	}
36
37
	/**
38
	 * ArrayAccess interface
39
	 * @param mixed $sOffset
40
	 * @param mixed $mValue
41
	 * @throws
42
	 */
43
	public function offsetSet($sOffset, $mValue)
44
	{
45
		$this->__set($sOffset, $mValue);
46
	}
47
48
	/**
49
	 * @param string $sOffset
50
	 * @return bool
51
	 */
52
	public function offsetExists($sOffset)
53
	{
54
		return in_array($sOffset, $this->getPropertyNames());
55
	}
56
57
	/**
58
	 * @param string $sOffset
59
	 */
60
	public function offsetUnset($sOffset)
61
	{
62
		$oProperty = new \ReflectionProperty($this, $sOffset);
63
		if ($oProperty->isPublic()) {
64
			unset ($this->$sOffset);
65
		}
66
	}
67
68
	/**
69
	 * @param string $sOffset
70
	 * @return mixed
71
	 */
72
	public function offsetGet($sOffset)
73
	{
74
		return $this->__get($sOffset);
75
	}
76
77
}
78