예제 #1
0
 public function createPUTComment(CommentObject $commentObject)
 {
     $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_COMMENT . '/' . $commentObject->getObjectID());
     $this->request->setRequestMethod('PUT');
     $this->request->setRequestBody($commentObject->getJSONString());
     return $this;
 }
예제 #2
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if ($this->datePublished == NULL) {
         $this->datePublished = XSDDateTime::getXSDDateTime();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!UOID::isValid($this->targetID)) {
         throw new IllegalModelStateException('Invalid targetID');
     }
     if (!GID::isValid($this->author)) {
         throw new IllegalModelStateException('Invalid author');
     }
     if ($this->comment == '' || $this->comment == NULL) {
         throw new IllegalModelStateException('Invalid comment');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datePublished)) {
         throw new IllegalModelStateException('Invalid datePublished');
     }
     if ($this->dateUpdated != NULL && !XSDDateTime::validateXSDDateTime($this->dateUpdated)) {
         throw new IllegalModelStateException('Invalid dateUpdated');
     }
     $comment = new CommentObject($this);
     if ($this->signature == NULL) {
         $comment->signObject();
     }
     if (!$comment->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $comment;
 }