1 | <?php |
||
9 | class ClassMetadata extends MergeableClassMetadata |
||
10 | { |
||
11 | /** |
||
12 | * @var bool |
||
13 | */ |
||
14 | public $restResource; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | public $namePrefix; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | public $pathPrefix; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | public $service; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | public $controller; |
||
35 | |||
36 | /** |
||
37 | * @var Right|null |
||
38 | */ |
||
39 | public $postRight; |
||
40 | |||
41 | /** |
||
42 | * @var Right|null |
||
43 | */ |
||
44 | public $putRight; |
||
45 | |||
46 | /** |
||
47 | * @var Right|null |
||
48 | */ |
||
49 | public $deleteRight; |
||
50 | |||
51 | /** |
||
52 | * @var Right|null |
||
53 | */ |
||
54 | public $listRight; |
||
55 | |||
56 | /** |
||
57 | * @var Right|null |
||
58 | */ |
||
59 | public $getRight; |
||
60 | |||
61 | /** |
||
62 | * @var string[] |
||
63 | */ |
||
64 | public $methods = ['LIST', 'POST', 'GET', 'PUT', 'DELETE']; |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | 2 | public function merge(MergeableInterface $object) |
|
70 | { |
||
71 | 2 | parent::merge($object); |
|
72 | /** @var ClassMetadata $object */ |
||
73 | 2 | $this->restResource = $object->restResource; |
|
74 | 2 | $this->namePrefix = $object->namePrefix; |
|
75 | 2 | $this->pathPrefix = $object->pathPrefix; |
|
76 | 2 | $this->service = $object->service; |
|
77 | 2 | $this->controller = $object->controller; |
|
78 | 2 | $this->listRight = $object->listRight; |
|
79 | 2 | $this->getRight = $object->getRight; |
|
80 | 2 | $this->postRight = $object->postRight; |
|
81 | 2 | $this->putRight = $object->putRight; |
|
82 | 2 | $this->deleteRight = $object->deleteRight; |
|
83 | 2 | $this->methods = $this->mergeMethods($this->methods, $object->methods); |
|
84 | 2 | } |
|
85 | |||
86 | /** |
||
87 | * @param bool $restResource |
||
88 | */ |
||
89 | 22 | public function setRestResource($restResource) |
|
93 | |||
94 | /** |
||
95 | * @return boolean |
||
96 | */ |
||
97 | 4 | public function isRestResource() |
|
101 | |||
102 | /** |
||
103 | * @return string |
||
104 | */ |
||
105 | 4 | public function getNamePrefix() |
|
109 | |||
110 | /** |
||
111 | * @param string $namePrefix |
||
112 | */ |
||
113 | public function setNamePrefix($namePrefix) |
||
117 | |||
118 | /** |
||
119 | * @return string |
||
120 | */ |
||
121 | 4 | public function getPathPrefix() |
|
125 | |||
126 | /** |
||
127 | * @param string $pathPrefix |
||
128 | */ |
||
129 | 12 | public function setPathPrefix(string $pathPrefix) |
|
130 | { |
||
131 | 12 | $this->pathPrefix = $pathPrefix; |
|
132 | 12 | } |
|
133 | |||
134 | /** |
||
135 | * @return string |
||
136 | */ |
||
137 | 4 | public function getController() |
|
141 | |||
142 | /** |
||
143 | * @param string $controller |
||
144 | */ |
||
145 | public function setController($controller) |
||
149 | |||
150 | /** |
||
151 | * @return string |
||
152 | */ |
||
153 | 4 | public function getService() |
|
157 | |||
158 | /** |
||
159 | * @param string $service |
||
160 | */ |
||
161 | public function setService($service) |
||
165 | |||
166 | /** |
||
167 | * @return Right|null |
||
168 | */ |
||
169 | 2 | public function getDeleteRight() |
|
170 | { |
||
171 | 2 | return $this->deleteRight; |
|
172 | } |
||
173 | |||
174 | /** |
||
175 | * @param Right|null $deleteRight |
||
176 | */ |
||
177 | public function setDeleteRight(Right $deleteRight) |
||
181 | |||
182 | /** |
||
183 | * @return Right|null |
||
184 | */ |
||
185 | 2 | public function getPostRight() |
|
186 | { |
||
187 | 2 | return $this->postRight; |
|
188 | } |
||
189 | |||
190 | /** |
||
191 | * @param Right|null $postRight |
||
192 | */ |
||
193 | public function setPostRight(Right $postRight) |
||
197 | |||
198 | /** |
||
199 | * @return Right|null |
||
200 | */ |
||
201 | 6 | public function getPutRight() |
|
202 | { |
||
203 | 6 | return $this->putRight; |
|
204 | } |
||
205 | |||
206 | /** |
||
207 | * @param Right|null $putRight |
||
208 | */ |
||
209 | 12 | public function setPutRight(Right $putRight) |
|
210 | { |
||
211 | 12 | $this->putRight = $putRight; |
|
212 | 12 | } |
|
213 | |||
214 | /** |
||
215 | * @return Right|null |
||
216 | */ |
||
217 | 6 | public function getListRight() |
|
221 | |||
222 | /** |
||
223 | * @param Right|null $listRight |
||
224 | */ |
||
225 | 12 | public function setListRight(Right $listRight) |
|
226 | { |
||
227 | 12 | $this->listRight = $listRight; |
|
228 | 12 | } |
|
229 | |||
230 | /** |
||
231 | * @return Right|null |
||
232 | */ |
||
233 | 6 | public function getGetRight() |
|
234 | { |
||
235 | 6 | return $this->getRight; |
|
236 | } |
||
237 | |||
238 | /** |
||
239 | * @param Right|null $getRight |
||
240 | */ |
||
241 | 12 | public function setGetRight(Right $getRight) |
|
242 | { |
||
243 | 12 | $this->getRight = $getRight; |
|
244 | 12 | } |
|
245 | |||
246 | /** |
||
247 | * @return string[] |
||
248 | */ |
||
249 | 4 | public function getMethods() |
|
253 | |||
254 | /** |
||
255 | * @param string[] $methods |
||
256 | */ |
||
257 | public function setMethods(array $methods) |
||
261 | |||
262 | 22 | public function getPropertyMetadata(string $property): ?PropertyMetadata |
|
263 | { |
||
264 | 22 | if (array_key_exists($property, $this->propertyMetadata)) { |
|
265 | 22 | return $this->propertyMetadata[$property]; |
|
266 | } |
||
267 | |||
268 | 12 | return null; |
|
270 | |||
271 | 2 | private function mergeMethods($thisMethods, $otherMethods) |
|
282 | } |
||
283 |