/**
  * Converts an object.
  *
  * @param array|null $data
  * @return null|ObjectData
  */
 public function convertObject(array $data = null)
 {
     if (empty($data)) {
         return null;
     }
     $object = new ObjectData();
     if (isset($data[JSONConstants::JSON_OBJECT_ACL]) && is_array($data[JSONConstants::JSON_OBJECT_ACL]) && isset($data[JSONConstants::JSON_OBJECT_EXACT_ACL])) {
         $acl = $this->convertAcl($data[JSONConstants::JSON_OBJECT_ACL], (bool) $data[JSONConstants::JSON_OBJECT_EXACT_ACL]);
         if ($acl !== null) {
             $object->setAcl($acl);
         }
     }
     if (isset($data[JSONConstants::JSON_OBJECT_ALLOWABLE_ACTIONS])) {
         $allowableActions = $this->convertAllowableActions($data[JSONConstants::JSON_OBJECT_ALLOWABLE_ACTIONS]);
         if ($allowableActions !== null) {
             $object->setAllowableActions($allowableActions);
         }
     }
     if (isset($data[JSONConstants::JSON_OBJECT_CHANGE_EVENT_INFO]) && is_array($data[JSONConstants::JSON_OBJECT_CHANGE_EVENT_INFO])) {
         $changeEventInfoData = $data[JSONConstants::JSON_OBJECT_CHANGE_EVENT_INFO];
         $changeEventInfo = new ChangeEventInfo();
         $changeEventInfo->setChangeTime($this->convertDateTimeValue($changeEventInfoData[JSONConstants::JSON_CHANGE_EVENT_TIME]));
         $changeEventInfo->setChangeType(ChangeType::cast($changeEventInfoData[JSONConstants::JSON_CHANGE_EVENT_TYPE]));
         $changeEventInfo->setExtensions($this->convertExtension($changeEventInfoData, JSONConstants::getChangeEventKeys()));
         $object->setChangeEventInfo($changeEventInfo);
     }
     if (isset($data[JSONConstants::JSON_OBJECT_EXACT_ACL])) {
         $object->setIsExactAcl((bool) $data[JSONConstants::JSON_OBJECT_EXACT_ACL]);
     }
     if (isset($data[JSONConstants::JSON_OBJECT_POLICY_IDS])) {
         $object->setPolicyIds($this->convertPolicyIdList($data[JSONConstants::JSON_OBJECT_POLICY_IDS]));
     }
     /**
      * A client MAY add the query parameter succinct (HTTP GET) or the control succinct (HTTP POST) with the
      * value <code>true</code> to a request. If this is set, the repository MUST return properties in a succinct
      * format. That is, whenever the repository renders an object or a query result, it MUST populate the
      * succinctProperties value and MUST NOT populate the properties value.
      *
      * @see http://docs.oasis-open.org/cmis/CMIS/v1.1/os/CMIS-v1.1-os.html#x1-552027r554
      */
     if (isset($data[JSONConstants::JSON_OBJECT_SUCCINCT_PROPERTIES]) && is_array($data[JSONConstants::JSON_OBJECT_SUCCINCT_PROPERTIES])) {
         $properties = $data[JSONConstants::JSON_OBJECT_SUCCINCT_PROPERTIES];
         $propertiesExtension = null;
         if (isset($data[JSONConstants::JSON_OBJECT_PROPERTIES_EXTENSION])) {
             $propertiesExtension = $data[JSONConstants::JSON_OBJECT_PROPERTIES_EXTENSION];
         }
         $object->setProperties($this->convertSuccinctProperties($properties, $propertiesExtension));
     } elseif (isset($data[JSONConstants::JSON_OBJECT_PROPERTIES]) && is_array($data[JSONConstants::JSON_OBJECT_PROPERTIES])) {
         $propertiesExtension = array();
         if (isset($data[JSONConstants::JSON_OBJECT_PROPERTIES_EXTENSION])) {
             $propertiesExtension = (array) $data[JSONConstants::JSON_OBJECT_PROPERTIES_EXTENSION];
         }
         $properties = $this->convertProperties($data[JSONConstants::JSON_OBJECT_PROPERTIES], $propertiesExtension);
         if ($properties !== null) {
             $object->setProperties($properties);
         }
     }
     if (isset($data[JSONConstants::JSON_OBJECT_RELATIONSHIPS]) && is_array($data[JSONConstants::JSON_OBJECT_RELATIONSHIPS])) {
         $relationships = $this->convertObjects($data[JSONConstants::JSON_OBJECT_RELATIONSHIPS]);
         if ($relationships !== null) {
             $object->setRelationships($relationships);
         }
     }
     if (isset($data[JSONConstants::JSON_OBJECT_RENDITIONS]) && is_array($data[JSONConstants::JSON_OBJECT_RENDITIONS])) {
         $object->setRenditions($this->convertRenditions($data[JSONConstants::JSON_OBJECT_RENDITIONS]));
     }
     $object->setExtensions($this->convertExtension($data, JSONConstants::getObjectKeys()));
     return $object;
 }
 /**
  * @covers  Dkd\PhpCmis\Converter\JsonConverter::convertObject
  * @depends testConvertAclConvertsArrayToAclObject
  * @depends testConvertAllowableActionsConvertsArrayToAllowableActionsObject
  * @depends testConvertPolicyIdsConvertsArrayToPolicyIdsListObject
  * @depends testConvertPropertiesConvertsArrayToPropertiesObject
  * @depends testConvertRenditionsConvertsArrayToRenditionObjects
  * @param $acl
  * @param $allowableActions
  * @param $policyIds
  * @param $properties
  * @param $renditions
  * @return ObjectData
  */
 public function testConvertObjectConvertsArrayToObjectDataObject($acl, $allowableActions, $policyIds, $properties, $renditions)
 {
     $expectedObject = new ObjectData();
     $expectedObject->setAcl($acl);
     $expectedObject->setAllowableActions($allowableActions);
     $expectedObject->setPolicyIds($policyIds);
     $expectedObject->setRenditions($renditions);
     $changeEvent = new ChangeEventInfo();
     $changeTime = new \DateTime();
     $changeTime->setTimestamp(1342160128);
     $changeEvent->setChangeTime($changeTime);
     $changeEvent->setChangeType(ChangeType::cast(ChangeType::UPDATED));
     $changeEvent->setExtensions($this->cmisExtensionsDummy);
     $expectedObject->setChangeEventInfo($changeEvent);
     $expectedObject->setIsExactAcl(true);
     $expectedObject->setExtensions($this->cmisExtensionsDummy);
     $expectedObject->setProperties($properties);
     $getObjectResponse = $this->getResponseFixtureContentAsArray('Cmis/v1.1/BrowserBinding/getObject-response.log');
     $object = $this->jsonConverter->convertObject($getObjectResponse);
     $this->assertEquals($expectedObject, $object);
     return $object;
 }
 /**
  * @depends testSetChangeTimeSetsProperty
  */
 public function testGetChangeTimeReturnsProperty()
 {
     $dateTime = new \DateTime();
     $this->changeEventInfo->setChangeTime($dateTime);
     $this->assertSame($dateTime, $this->changeEventInfo->getChangeTime());
 }