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
|
24 |
|
public function __construct($className, Creator $creator, $markersOnClass, $markedProperties) |
32
|
|
|
{ |
33
|
24 |
|
$this->className = $className; |
34
|
24 |
|
$this->creator = $creator; |
35
|
24 |
|
$this->markersOnClass = $markersOnClass; |
36
|
24 |
|
$this->markedProperties = $markedProperties; |
37
|
24 |
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return string |
41
|
|
|
*/ |
42
|
|
|
public function getClassName() |
43
|
|
|
{ |
44
|
|
|
return $this->className; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return Creator |
49
|
|
|
*/ |
50
|
12 |
|
public function getCreator() |
51
|
|
|
{ |
52
|
12 |
|
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
|
23 |
|
public function getMarkedProperties() |
67
|
|
|
{ |
68
|
23 |
|
return $this->markedProperties; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param string $name |
73
|
|
|
* |
74
|
|
|
* @return null|PropertyMarkedForSlumber |
75
|
|
|
*/ |
76
|
|
|
public function getMarkedPropertyByName($name) |
77
|
|
|
{ |
78
|
|
|
foreach ($this->markedProperties as $property) { |
79
|
|
|
if ($property->name === $name) { |
80
|
|
|
return $property; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
return null; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|