|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* File was created 10.10.2015 18:11 |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace PeekAndPoke\Component\Slumber\Core\LookUp; |
|
7
|
|
|
|
|
8
|
|
|
use PeekAndPoke\Component\Creator\Creator; |
|
9
|
|
|
use PeekAndPoke\Component\Slumber\Annotation\ClassMarker; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @author Karsten J. Gerber <[email protected]> |
|
13
|
|
|
*/ |
|
14
|
|
|
class EntityConfig |
|
15
|
|
|
{ |
|
16
|
|
|
/** @var string */ |
|
17
|
|
|
protected $className; |
|
18
|
|
|
/** @var Creator */ |
|
19
|
|
|
protected $creator; |
|
20
|
|
|
/** @var ClassMarker[] */ |
|
21
|
|
|
protected $markersOnClass; |
|
22
|
|
|
/** @var PropertyMarkedForSlumber[] */ |
|
23
|
|
|
protected $markedProperties; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @param string $className |
|
27
|
|
|
* @param Creator $creator |
|
28
|
|
|
* @param ClassMarker[] $markersOnClass |
|
29
|
|
|
* @param PropertyMarkedForSlumber[] $markedProperties |
|
30
|
|
|
*/ |
|
31
|
39 |
|
public function __construct($className, Creator $creator, $markersOnClass, $markedProperties) |
|
32
|
|
|
{ |
|
33
|
39 |
|
$this->className = $className; |
|
34
|
39 |
|
$this->creator = $creator; |
|
35
|
39 |
|
$this->markersOnClass = $markersOnClass; |
|
36
|
39 |
|
$this->markedProperties = $markedProperties; |
|
37
|
39 |
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @return string |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getClassName() |
|
43
|
|
|
{ |
|
44
|
|
|
return $this->className; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return Creator |
|
49
|
|
|
*/ |
|
50
|
13 |
|
public function getCreator() |
|
51
|
|
|
{ |
|
52
|
13 |
|
return $this->creator; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @return ClassMarker[] |
|
57
|
|
|
*/ |
|
58
|
|
|
public function getMarkersOnClass() |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->markersOnClass; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return PropertyMarkedForSlumber[] |
|
65
|
|
|
*/ |
|
66
|
25 |
|
public function getMarkedProperties() |
|
67
|
|
|
{ |
|
68
|
25 |
|
return $this->markedProperties; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @return int |
|
73
|
|
|
*/ |
|
74
|
1 |
|
public function getNumMarkedProperties() |
|
75
|
|
|
{ |
|
76
|
1 |
|
return \count($this->markedProperties); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @param string $name |
|
81
|
|
|
* |
|
82
|
|
|
* @return null|PropertyMarkedForSlumber |
|
83
|
|
|
*/ |
|
84
|
9 |
|
public function getMarkedPropertyByName($name) |
|
85
|
|
|
{ |
|
86
|
9 |
|
foreach ($this->markedProperties as $property) { |
|
87
|
9 |
|
if ($property->name === $name) { |
|
88
|
9 |
|
return $property; |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
2 |
|
return null; |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|