public function testGetTypeKeysReturnsContentOfStaticArray() { $this->assertSame($this->getStaticAttribute('\\Dkd\\PhpCmis\\Bindings\\Browser\\JSONConstants', 'TYPE_KEYS'), JSONConstants::getTypeKeys()); }
/** * Convert an array to a type definition object * * @param array|null $data * @return AbstractTypeDefinition|null * @throws CmisInvalidArgumentException */ public function convertTypeDefinition(array $data = null) { if (empty($data)) { return null; } if (empty($data[JSONConstants::JSON_TYPE_ID])) { throw new CmisInvalidArgumentException('Id of type definition is empty but must not be empty!'); } $baseTypeId = ''; if (isset($data[JSONConstants::JSON_TYPE_BASE_ID])) { $baseTypeId = $data[JSONConstants::JSON_TYPE_BASE_ID]; unset($data[JSONConstants::JSON_TYPE_BASE_ID]); } $typeDefinition = $this->getBindingsObjectFactory()->getTypeDefinitionByBaseTypeId($baseTypeId, $data[JSONConstants::JSON_TYPE_ID]); $data = $this->convertTypeDefinitionSpecificData($data, $typeDefinition); if (isset($data[JSONConstants::JSON_TYPE_TYPE_MUTABILITY])) { $data[JSONConstants::JSON_TYPE_TYPE_MUTABILITY] = $this->convertTypeMutability($data[JSONConstants::JSON_TYPE_TYPE_MUTABILITY]); if ($data[JSONConstants::JSON_TYPE_TYPE_MUTABILITY] === null) { unset($data[JSONConstants::JSON_TYPE_TYPE_MUTABILITY]); } } if (isset($data[JSONConstants::JSON_TYPE_PROPERTY_DEFINITIONS]) && is_array($data[JSONConstants::JSON_TYPE_PROPERTY_DEFINITIONS])) { foreach ($data[JSONConstants::JSON_TYPE_PROPERTY_DEFINITIONS] as $propertyDefinitionData) { if (is_array($propertyDefinitionData)) { $propertyDefinition = $this->convertPropertyDefinition($propertyDefinitionData); if ($propertyDefinition !== null) { $typeDefinition->addPropertyDefinition($propertyDefinition); } } } } unset($data[JSONConstants::JSON_TYPE_PROPERTY_DEFINITIONS]); $typeDefinition->populate($data, array_merge(array_combine(JSONConstants::getTypeKeys(), JSONConstants::getTypeKeys()), array(JSONConstants::JSON_TYPE_PARENT_ID => 'parentTypeId', JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES => 'allowedTargetTypeIds', JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES => 'allowedSourceTypeIds')), true); $typeDefinition->setExtensions($this->convertExtension($data, JSONConstants::getTypeKeys())); return $typeDefinition; }