Completed
Branch master (486a28)
by Paweł
02:07
created

CodeReview_Issues_Abstract::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
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 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
/**
3
 * Class CodeReview_Issues_Abstract
4
 */
5
abstract class CodeReview_Issues_Abstract implements ArrayAccess {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
6
7
	/**
8
	 * @var array
9
	 */
10
	protected $data = array();
11
12
	/**
13
	 * @param array $params
14
	 */
15 3
	public function __construct(array $params = array()) {
16 3
		$this->data = $params;
17 3
	}
18
19
	/**
20
	 * @return string
21
	 */
22 2
	public function toString() {
23 2
		return "Line " . $this->data['line'] . ":\tFunction call: " . $this->data['name'] . " " . $this->getExplanation();
24
	}
25
26
	/**
27
	 * @return string
28
	 */
29
	abstract protected function getExplanation();
30
31
	/**
32
	 * @return string
33
	 */
34 2
	public function __toString() {
35 2
		return $this->toString();
36
	}
37
38
	/**
39
	 * @param mixed $offset
40
	 * @return bool
41
	 */
42 3
	public function offsetExists($offset) {
43 3
		return isset($this->data[$offset]);
44
	}
45
46
	/**
47
	 * @param mixed $offset
48
	 * @return mixed
49
	 */
50 3
	public function offsetGet($offset) {
51 3
		return $this->data[$offset];
52
	}
53
54
	/**
55
	 * @param mixed $offset
56
	 * @param mixed $value
57
	 */
58 1
	public function offsetSet($offset, $value) {
59 1
		$this->data[$offset] = $value;
60 1
	}
61
62
	/**
63
	 * @param mixed $offset
64
	 */
65 1
	public function offsetUnset($offset) {
66 1
		unset($this->data[$offset]);
67
	}
68
}