Ejemplo n.º 1
0
 public function createPUTStream(StreamItemObject $streamItem)
 {
     $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_STREAM . '/' . $streamItem->getObjectID());
     $this->request->setRequestMethod('PUT');
     $this->request->setRequestBody($streamItem->getJSONString());
     return $this;
 }
Ejemplo n.º 2
0
 public function build()
 {
     if ($this->objectID == NULL) {
         $this->objectID = UOID::createUOID();
     }
     if (!UOID::isValid($this->objectID)) {
         throw new IllegalModelStateException('Invalid objectID');
     }
     if (!GID::isValid($this->owner)) {
         throw new IllegalModelStateException('Invalid owner');
     }
     if (!GID::isValid($this->author)) {
         throw new IllegalModelStateException('Invalid author');
     }
     if ($this->activity == '' || $this->activity == NULL) {
         throw new IllegalModelStateException('Invalid activity');
     }
     if (!XSDDateTime::validateXSDDateTime($this->datetime)) {
         throw new IllegalModelStateException('Invalid datetime');
     }
     $streamItem = new StreamItemObject($this);
     if ($streamItem->getSignature() == NULL) {
         $streamItem->signObject();
     }
     if (!$streamItem->verifyObjectSignature()) {
         throw new IllegalModelStateException('Invalid signature');
     }
     return $streamItem;
 }