AbstractIssue::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
namespace CodeReview\Issues;
3
4
abstract class AbstractIssue implements \ArrayAccess {
5
6
	/**
7
	 * @var array
8
	 */
9
	protected $data = array();
10
11
	/**
12
	 * @param array $params
13
	 */
14 12
	public function __construct(array $params = array()) {
15 12
		$this->data = $params;
16 12
	}
17
18
	/**
19
	 * @return string
20
	 */
21 10
	public function toString() {
22 10
		return "Function call: " . $this->data['name'] . " " . $this->getExplanation();
23
	}
24
25
	/**
26
	 * @return string
27
	 */
28
	abstract protected function getExplanation();
29
30
	/**
31
	 * @return string
32
	 */
33 10
	public function __toString() {
34 10
		return $this->toString();
35
	}
36
37
	/**
38
	 * @param mixed $offset
39
	 * @return bool
40
	 */
41 4
	public function offsetExists($offset) {
42 4
		return isset($this->data[$offset]);
43
	}
44
45
	/**
46
	 * @param mixed $offset
47
	 * @return mixed
48
	 */
49 4
	public function offsetGet($offset) {
50 4
		return $this->data[$offset];
51
	}
52
53
	/**
54
	 * @param mixed $offset
55
	 * @param mixed $value
56
	 */
57 1
	public function offsetSet($offset, $value) {
58 1
		$this->data[$offset] = $value;
59 1
	}
60
61
	/**
62
	 * @param mixed $offset
63
	 */
64 1
	public function offsetUnset($offset) {
65 1
		unset($this->data[$offset]);
66
	}
67
}