Table::__construct()   A
last analyzed

Complexity

Conditions 5
Paths 16

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 5.025

Importance

Changes 0
Metric Value
cc 5
eloc 9
nc 16
nop 1
dl 0
loc 14
ccs 9
cts 10
cp 0.9
crap 5.025
rs 9.6111
c 0
b 0
f 0
1
<?php
2
namespace SpareParts\Pillar\Mapper\Annotation;
3
4
use Doctrine\Common\Annotations\Annotation\Required;
5
6
/**
7
 * @Annotation
8
 * @Target("CLASS")
9
 */
10
class Table implements IPillarAnnotation
11
{
12
	/**
13
	 * @var string
14
	 * @Required()
15
	 */
16
	protected $name;
17
18
	/**
19
	 * @var string
20
	 */
21
	protected $identifier;
22
23
	/**
24
	 * @var string
25
	 */
26
	protected $code;
27
28 6
	public function __construct($values)
29
	{
30 6
		if (isset($values['value'])) {
31
			$this->name = $values['value'];
32
		}
33 6
		if (isset($values['name'])) {
34 6
			$this->name = $values['name'];
35
		}
36 6
		$this->identifier = $this->name;
37 6
		if (isset($values['identifier'])) {
38 6
			$this->identifier = $values['identifier'];
39
		}
40 6
		if (isset($values['code'])) {
41 6
			$this->code = $values['code'];
42
		}
43 6
	}
44
45
	/**
46
	 * @return string
47
	 */
48 6
	public function getName()
49
	{
50 6
		return $this->name;
51
	}
52
53
	/**
54
	 * @return string
55
	 */
56 6
	public function getIdentifier()
57
	{
58 6
		return $this->identifier;
59
	}
60
61
	/**
62
	 * @return string
63
	 */
64 6
	public function getCode()
65
	{
66 6
		return $this->code;
67
	}
68
}
69