@@ 330-360 (lines=31) @@ | ||
327 | * @param string[]|null $data |
|
328 | * @return NewTypeSettableAttributes|null Returns object or <code>null</code> if given data is empty |
|
329 | */ |
|
330 | public function convertNewTypeSettableAttributes(array $data = null) |
|
331 | { |
|
332 | if (empty($data)) { |
|
333 | return null; |
|
334 | } |
|
335 | $object = new NewTypeSettableAttributes(); |
|
336 | ||
337 | $object->populate( |
|
338 | $data, |
|
339 | array_combine( |
|
340 | JSONConstants::getCapabilityNewTypeSettableAttributeKeys(), |
|
341 | array_map( |
|
342 | function ($key) { |
|
343 | // add a prefix "canSet" to all keys as this are the property names |
|
344 | return 'canSet' . ucfirst($key); |
|
345 | }, |
|
346 | JSONConstants::getCapabilityNewTypeSettableAttributeKeys() |
|
347 | ) |
|
348 | ), |
|
349 | true |
|
350 | ); |
|
351 | ||
352 | $object->setExtensions( |
|
353 | $this->convertExtension( |
|
354 | $data, |
|
355 | JSONConstants::getCapabilityNewTypeSettableAttributeKeys() |
|
356 | ) |
|
357 | ); |
|
358 | ||
359 | return $object; |
|
360 | } |
|
361 | ||
362 | /** |
|
363 | * Create CreatablePropertyTypes object and populate given data to it |
|
@@ 674-700 (lines=27) @@ | ||
671 | * @param array|null $data The data that should be populated to the object |
|
672 | * @return TypeMutability|null Returns the type mutability object or <code>null</code> if empty array is given |
|
673 | */ |
|
674 | public function convertTypeMutability(array $data = null) |
|
675 | { |
|
676 | if (empty($data)) { |
|
677 | return null; |
|
678 | } |
|
679 | $typeMutability = new TypeMutability(); |
|
680 | $typeMutability->populate( |
|
681 | $data, |
|
682 | array_combine( |
|
683 | JSONConstants::getTypeTypeMutabilityKeys(), |
|
684 | array_map( |
|
685 | function ($key) { |
|
686 | // add a prefix "can" to all keys as this are the property names |
|
687 | return 'can' . ucfirst($key); |
|
688 | }, |
|
689 | JSONConstants::getTypeTypeMutabilityKeys() |
|
690 | ) |
|
691 | ), |
|
692 | true |
|
693 | ); |
|
694 | ||
695 | $typeMutability->setExtensions( |
|
696 | $this->convertExtension($data, JSONConstants::getTypeTypeMutabilityKeys()) |
|
697 | ); |
|
698 | ||
699 | return $typeMutability; |
|
700 | } |
|
701 | ||
702 | /** |
|
703 | * @param array|null $data |