Column::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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("PROPERTY")
9
 */
10
class Column implements IPillarAnnotation
11
{
12
	/**
13
	 * @var string
14
	 * @Required()
15
	 */
16
	protected $name;
17
18
	/**
19
	 * @var string
20
	 * @Required()
21
	 */
22
	protected $table;
23
24
	/**
25
	 * @var string|null
26
	 */
27
	protected $customSelect;
28
29
	/**
30
	 * @var bool
31
	 */
32
	protected $deprecated = false;
33
34
	/**
35
	 * @var bool
36
	 */
37
	protected $primary = false;
38
39 6
	public function __construct($values)
40
	{
41 6
		if (isset($values['value'])) {
42
			$this->name = $values['value'];
43
		}
44 6
		if (isset($values['name'])) {
45 6
			$this->name = $values['name'];
46
		}
47 6
		if (isset($values['table'])) {
48 6
			$this->table = $values['table'];
49
		}
50 6
		if (isset($values['primary'])) {
51 6
			$this->primary = $values['primary'];
52
		}
53 6
		if (isset($values['deprecated'])) {
54
			$this->deprecated = $values['deprecated'];
55
		}
56 6
		if (isset($values['customSelect'])) {
57
			$this->customSelect = $values['customSelect'];
58
		}
59 6
	}
60
61
	/**
62
	 * @return string
63
	 */
64 6
	public function getName()
65
	{
66 6
		return $this->name;
67
	}
68
69
	/**
70
	 * @return string
71
	 */
72 6
	public function getTable()
73
	{
74 6
		return $this->table;
75
	}
76
77
	/**
78
	 * @return bool
79
	 */
80 6
	public function isPrimary()
81
	{
82 6
		return $this->primary;
83
	}
84
85
	/**
86
	 * @return bool
87
	 */
88 6
	public function isDeprecated()
89
	{
90 6
		return $this->deprecated;
91
	}
92
93
	/**
94
	 * @return string|null
95
	 */
96 6
	public function getCustomSelect()
97
	{
98 6
		return $this->customSelect;
99
	}
100
}
101