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.
Completed
Push — master ( 2f0bc6...b62162 )
by Marius
04:15
created

ArrayAccessTrait::getPropertyNames()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 0
dl 0
loc 9
ccs 0
cts 0
cp 0
crap 6
rs 9.6666
c 0
b 0
f 0
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 = [];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
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