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