@@ 305-335 (lines=31) @@ | ||
302 | * @param string[]|null $data |
|
303 | * @return NewTypeSettableAttributes|null Returns object or <code>null</code> if given data is empty |
|
304 | */ |
|
305 | public function convertNewTypeSettableAttributes(array $data = null) |
|
306 | { |
|
307 | if (empty($data)) { |
|
308 | return null; |
|
309 | } |
|
310 | $object = new NewTypeSettableAttributes(); |
|
311 | ||
312 | $object->populate( |
|
313 | $data, |
|
314 | array_combine( |
|
315 | JSONConstants::getCapabilityNewTypeSettableAttributeKeys(), |
|
316 | array_map( |
|
317 | function ($key) { |
|
318 | // add a prefix "canSet" to all keys as this are the property names |
|
319 | return 'canSet' . ucfirst($key); |
|
320 | }, |
|
321 | JSONConstants::getCapabilityNewTypeSettableAttributeKeys() |
|
322 | ) |
|
323 | ), |
|
324 | true |
|
325 | ); |
|
326 | ||
327 | $object->setExtensions( |
|
328 | $this->convertExtension( |
|
329 | $data, |
|
330 | JSONConstants::getCapabilityNewTypeSettableAttributeKeys() |
|
331 | ) |
|
332 | ); |
|
333 | ||
334 | return $object; |
|
335 | } |
|
336 | ||
337 | /** |
|
338 | * Create CreatablePropertyTypes object and populate given data to it |
|
@@ 612-638 (lines=27) @@ | ||
609 | * @param array|null $data The data that should be populated to the object |
|
610 | * @return TypeMutability|null Returns the type mutability object or <code>null</code> if empty array is given |
|
611 | */ |
|
612 | public function convertTypeMutability(array $data = null) |
|
613 | { |
|
614 | if (empty($data)) { |
|
615 | return null; |
|
616 | } |
|
617 | $typeMutability = new TypeMutability(); |
|
618 | $typeMutability->populate( |
|
619 | $data, |
|
620 | array_combine( |
|
621 | JSONConstants::getTypeTypeMutabilityKeys(), |
|
622 | array_map( |
|
623 | function ($key) { |
|
624 | // add a prefix "can" to all keys as this are the property names |
|
625 | return 'can' . ucfirst($key); |
|
626 | }, |
|
627 | JSONConstants::getTypeTypeMutabilityKeys() |
|
628 | ) |
|
629 | ), |
|
630 | true |
|
631 | ); |
|
632 | ||
633 | $typeMutability->setExtensions( |
|
634 | $this->convertExtension($data, JSONConstants::getTypeTypeMutabilityKeys()) |
|
635 | ); |
|
636 | ||
637 | return $typeMutability; |
|
638 | } |
|
639 | ||
640 | /** |
|
641 | * @param array|null $data |