/** * @param array|null $data * @return RepositoryCapabilities|null */ public function convertRepositoryCapabilities(array $data = null) { if (empty($data)) { return null; } if (isset($data[JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY])) { $data[JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY] = CapabilityContentStreamUpdates::cast($data[JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY]); } if (isset($data[JSONConstants::JSON_CAP_CHANGES])) { $data[JSONConstants::JSON_CAP_CHANGES] = CapabilityChanges::cast($data[JSONConstants::JSON_CAP_CHANGES]); } if (isset($data[JSONConstants::JSON_CAP_RENDITIONS])) { $data[JSONConstants::JSON_CAP_RENDITIONS] = CapabilityRenditions::cast($data[JSONConstants::JSON_CAP_RENDITIONS]); } if (isset($data[JSONConstants::JSON_CAP_ORDER_BY])) { $data[JSONConstants::JSON_CAP_ORDER_BY] = CapabilityOrderBy::cast($data[JSONConstants::JSON_CAP_ORDER_BY]); } if (isset($data[JSONConstants::JSON_CAP_QUERY])) { $data[JSONConstants::JSON_CAP_QUERY] = CapabilityQuery::cast($data[JSONConstants::JSON_CAP_QUERY]); } if (isset($data[JSONConstants::JSON_CAP_JOIN])) { $data[JSONConstants::JSON_CAP_JOIN] = CapabilityJoin::cast($data[JSONConstants::JSON_CAP_JOIN]); } if (isset($data[JSONConstants::JSON_CAP_ACL])) { $data[JSONConstants::JSON_CAP_ACL] = CapabilityAcl::cast($data[JSONConstants::JSON_CAP_ACL]); } if (isset($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES])) { $data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES] = $this->convertCreatablePropertyTypes($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES]); if ($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES] === null) { unset($data[JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES]); } } if (isset($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES])) { $data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES] = $this->convertNewTypeSettableAttributes($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES]); if ($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES] === null) { unset($data[JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES]); } } $repositoryCapabilities = new RepositoryCapabilities(); $repositoryCapabilities->setExtensions($this->convertExtension($data, JSONConstants::getCapabilityKeys())); $repositoryCapabilities->populate($data, array_merge(array_combine(JSONConstants::getCapabilityKeys(), JSONConstants::getCapabilityKeys()), array(JSONConstants::JSON_CAP_CONTENT_STREAM_UPDATABILITY => 'contentStreamUpdatesCapability', JSONConstants::JSON_CAP_CHANGES => 'changesCapability', JSONConstants::JSON_CAP_RENDITIONS => 'renditionsCapability', JSONConstants::JSON_CAP_GET_DESCENDANTS => 'supportsGetDescendants', JSONConstants::JSON_CAP_GET_FOLDER_TREE => 'supportsGetFolderTree', JSONConstants::JSON_CAP_MULTIFILING => 'supportsMultifiling', JSONConstants::JSON_CAP_UNFILING => 'supportsUnfiling', JSONConstants::JSON_CAP_VERSION_SPECIFIC_FILING => 'supportsVersionSpecificFiling', JSONConstants::JSON_CAP_PWC_SEARCHABLE => 'supportsPwcSearchable', JSONConstants::JSON_CAP_PWC_UPDATABLE => 'supportsPwcUpdatable', JSONConstants::JSON_CAP_ALL_VERSIONS_SEARCHABLE => 'supportsAllVersionsSearchable', JSONConstants::JSON_CAP_ORDER_BY => 'orderByCapability', JSONConstants::JSON_CAP_QUERY => 'queryCapability', JSONConstants::JSON_CAP_JOIN => 'joinCapability', JSONConstants::JSON_CAP_ACL => 'aclCapability', JSONConstants::JSON_CAP_CREATABLE_PROPERTY_TYPES => 'creatablePropertyTypes', JSONConstants::JSON_CAP_NEW_TYPE_SETTABLE_ATTRIBUTES => 'newTypeSettableAttributes')), true); return $repositoryCapabilities; }