1 | <?php |
||
12 | class MetadataManager implements MetadataManagerInterface |
||
13 | { |
||
14 | /** |
||
15 | * Structures metadata parser |
||
16 | * |
||
17 | * @var MetadataParserInterface |
||
18 | */ |
||
19 | private $parser; |
||
20 | /** |
||
21 | * Structures metadata cache |
||
22 | * |
||
23 | * @var Cache |
||
24 | */ |
||
25 | private $cache; |
||
26 | /** |
||
27 | * Structures metadata |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | private $metadata = []; |
||
32 | /** |
||
33 | * Prefix for cache entries for structure metadata |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | private $cachePrefix = 'StructMetadata_'; |
||
38 | |||
39 | /** |
||
40 | * Get structure metadata information for given structure |
||
41 | * |
||
42 | * @param string|StructInterface $struct Either structure class name or instance of structure object |
||
43 | * to get metadata for |
||
44 | * @throws \InvalidArgumentException |
||
45 | * @return StructMetadata|null |
||
46 | */ |
||
47 | 188 | public function getMetadata($struct) |
|
95 | |||
96 | /** |
||
97 | * Get cache key for given class |
||
98 | * |
||
99 | * @param string $class |
||
100 | * @return string |
||
101 | */ |
||
102 | 182 | protected function getCacheKey($class) |
|
106 | |||
107 | /** |
||
108 | * Get metadata cache |
||
109 | * |
||
110 | * @return Cache |
||
111 | */ |
||
112 | 184 | public function getCache() |
|
119 | |||
120 | /** |
||
121 | * Set metadata cache |
||
122 | * |
||
123 | * @param Cache $cache |
||
124 | * @return $this |
||
125 | */ |
||
126 | 6 | public function setCache(Cache $cache) |
|
131 | |||
132 | /** |
||
133 | * Get metadata parser |
||
134 | * |
||
135 | * @return MetadataParserInterface |
||
136 | */ |
||
137 | 185 | public function getParser() |
|
147 | |||
148 | /** |
||
149 | * Set metadata parser |
||
150 | * |
||
151 | * @param MetadataParserInterface $parser |
||
152 | * @return $this |
||
153 | */ |
||
154 | 7 | public function setParser(MetadataParserInterface $parser) |
|
162 | } |
||
163 |