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 (!XSDDateTime::validateXSDDateTime($this->datePublished)) { throw new IllegalModelStateException('Invalid datePublished'); } $like = new LikeObject($this); if ($like->getSignature() == NULL) { $like->signObject(); } if (!$like->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $like; }