public function createPUTConversation(ConversationObject $conversationObject)
 {
     $this->request = new OutgoingRequest();
     $this->request->setServer($this->getDomainFromProfileLocation($this->targetSocialRecord->getProfileLocation()));
     $this->request->setPath($this->getPathFromProfileLocation($this->targetSocialRecord->getProfileLocation()) . $this->targetSocialRecord->getGlobalID() . '/' . self::RESOURCE_NAME_CONVERSATION . '/' . $conversationObject->getObjectID());
     $this->request->setRequestMethod('PUT');
     $this->request->setRequestBody($conversationObject->getJSONString());
     return $this;
 }
예제 #2
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if ($this->members == NULL) {
         $this->members = array();
     }
     if ($this->datetime == NULL) {
         $this->datetime = XSDDateTime::getXSDDateTime();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime');
     }
     if (!is_array($this->members)) {
         throw new IllegalModelStateException('Invalid members');
     }
     $conversation = new ConversationObject($this);
     if ($this->signature == NULL) {
         $conversation->signObject();
     }
     if (!$conversation->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $conversation;
 }