public static function getCmisProperties($xmlArray)
 {
     $properties = array();
     // find cmis:object tag
     $baseCmisObject = KT_cmis_atom_service_helper::findTag('cmis:object', $xmlArray, null, false);
     if (count($baseCmisObject) <= 0) {
         $entryObject = KT_cmis_atom_service_helper::findTag('entry', $xmlArray, null, false);
         $baseCmisObject = KT_cmis_atom_service_helper::findTag('cmis:object', $entryObject['@children'], null, true);
     }
     if (count($baseCmisObject) > 0) {
         foreach ($baseCmisObject['@children'] as $key => $childElement) {
             if ($key == 'cmis:properties') {
                 foreach ($childElement[0]['@children'] as $cmisPropertyDefinition) {
                     foreach ($cmisPropertyDefinition as $propertyType => $propertyDefinition) {
                         $properties[$propertyDefinition['@attributes']['cmis:name']] = $propertyDefinition['@children']['cmis:value'][0]['@value'];
                     }
                 }
             }
         }
     }
     return $properties;
 }
 public function PUT_action()
 {
     $repositoryId = KT_cmis_atom_service_helper::getRepositoryId($RepositoryService);
     $VersioningService = new VersioningService(KT_cmis_atom_service_helper::getKt());
     $ObjectService = new ObjectService(KT_cmis_atom_service_helper::getKt());
     // check for content stream
     // NOTE this is a hack!  will not work with CMISSpaces at least, probably not with any client except RestTest and similar
     //      where we can manually modify the input
     // first we try for an atom content tag
     $content = KT_cmis_atom_service_helper::getAtomValues($this->parsedXMLContent['@children'], 'content');
     if (!empty($content)) {
         $contentStream = $content;
     } else {
         $content = KT_cmis_atom_service_helper::findTag('content', $this->parsedXMLContent['@children'], null, false);
         $contentStream = $content['@value'];
     }
     // if we haven't found it now, the real hack begins - retrieve the EXISTING content and submit this as the contentStream
     // this is needed because KnowledgeTree will not accept a checkin without a content stream but CMISSpaces (and possibly
     // other CMIS clients are the same, does not send a content stream on checkin nor does it offer the user a method to choose one)
     // NOTE that if the content is INTENDED to be empty this and all the above checks will FAIL!
     // FIXME this is horrible, terrible, ugly and bad!
     if (empty($contentStream)) {
         $contentStream = base64_encode(KT_cmis_atom_service_helper::getContentStream($this, $ObjectService, $repositoryId));
     }
     // and if we don't have it by now, we give up...but leave the error to be generated by the underlying KnowledgeTree code
     // checkin function call
     // TODO dynamically detect version change type - leaving this for now as the CMIS clients tested do not appear to
     //      offer the choice to the user - perhaps it will turn out that this will come from somewhere else but for now
     //      we assume minor version updates only
     $major = false;
     $response = $VersioningService->checkIn($repositoryId, $this->params[0], $major, $contentStream);
     if (PEAR::isError($response)) {
         $feed = KT_cmis_atom_service_helper::getErrorFeed($this, self::STATUS_SERVER_ERROR, $response->getMessage());
         // Expose the responseFeed
         $this->responseFeed = $feed;
         return null;
     }
     $feed = KT_cmis_atom_service_helper::getObjectFeed($this, $ObjectService, $repositoryId, $this->params[0]);
     // Expose the responseFeed
     $this->responseFeed = $feed;
 }