public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } 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 (!GID::isValid($this->tag)) { throw new IllegalModelStateException('Invalid tag'); } if (!XSDDateTime::validateXSDDateTime($this->datePublished)) { throw new IllegalModelStateException('Invalid date'); } $tag = new TagObject($this); if ($tag->getSignature() == NULL) { $tag->signObject(); } if (!$tag->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $tag; }
public function createPOSTTag(TagObject $tagObject) { $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_TAG); $this->request->setRequestMethod('POST'); $this->request->setRequestBody($tagObject->getJSONString()); return $this; }