1 | <?php |
||
20 | final class DefaultClassMetadata implements ClassMetadata |
||
21 | { |
||
22 | /** |
||
23 | * The class name |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | private $name; |
||
28 | |||
29 | /** |
||
30 | * The class annotations |
||
31 | * |
||
32 | * @var AnnotationSet |
||
33 | */ |
||
34 | private $annotations; |
||
35 | |||
36 | /** |
||
37 | * An array of [@see PropertyMetadata] objects |
||
38 | * |
||
39 | * @var PropertyMetadata[] |
||
40 | */ |
||
41 | private $propertyMetadata; |
||
42 | |||
43 | /** |
||
44 | * Constructor |
||
45 | * |
||
46 | * @param string $name |
||
47 | * @param AnnotationSet $annotations |
||
48 | */ |
||
49 | 8 | public function __construct(string $name, AnnotationSet $annotations) |
|
54 | |||
55 | /** |
||
56 | * Get the class name as a string |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | 2 | public function getName(): string |
|
64 | |||
65 | /** |
||
66 | * Get all class annotations |
||
67 | * |
||
68 | * @return AnnotationSet |
||
69 | */ |
||
70 | 1 | public function getAnnotations(): AnnotationSet |
|
74 | |||
75 | /** |
||
76 | * Get a specific annotation by class name, returns null if the annotation |
||
77 | * doesn't exist. |
||
78 | * |
||
79 | * @param string $annotationClass |
||
80 | * @return null|object |
||
81 | */ |
||
82 | 2 | public function getAnnotation(string $annotationClass) |
|
86 | |||
87 | /** |
||
88 | * Returns an array of [@see PropertyMetadata] objects |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | 1 | public function getPropertyMetadata(): array |
|
96 | |||
97 | /** |
||
98 | * Get [@see PropertyMetadata] by property name |
||
99 | * |
||
100 | * @param string $propertyName |
||
101 | * @return PropertyMetadata|null |
||
102 | */ |
||
103 | 1 | public function getProperty(string $propertyName): ?PropertyMetadata |
|
113 | |||
114 | /** |
||
115 | * Add [@see PropertyMetadata] link |
||
116 | * |
||
117 | * @param PropertyMetadata $propertyMetadata |
||
118 | * @return void |
||
119 | */ |
||
120 | 5 | public function addPropertyMetadata(PropertyMetadata $propertyMetadata): void |
|
124 | } |
||
125 |