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 build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } 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 (!GID::isValid($this->link)) { throw new IllegalModelStateException('Invalid link'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } $link = new LinkObject($this); if ($link->getSignature() == NULL) { $link->signObject(); } if (!$link->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $link; }
protected function verifyDataFormat() { // TODO validate data and formats if (!XSDDateTime::validateXSDDateTime($this->headers[SONIC_HEADER__DATE])) { throw new MalformedRequestHeaderException("Malformed request: Header " . SONIC_HEADER__DATE . " malformed: " . $this->headers[SONIC_HEADER__DATE]); } return true; }
public function testXSDDateTime() { $time = 1449479356; $datetime = '2015-12-07T10:09:16+01:00'; //$this->assertEquals(false, XSDDateTime::validateXSDDateTime($impossible)); $this->assertEquals(true, XSDDateTime::validateXSDDateTime($datetime)); $this->assertEquals($datetime, XSDDateTime::getXSDDateTime($time)); $this->assertEquals($time, XSDDateTime::getUnixTimestamp($datetime)); }
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->platformGID)) { throw new IllegalModelStateException('Invalid platformGID'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } if (!is_array($this->results)) { throw new IllegalModelStateException('Invalid results value'); } return new SearchResultCollectionObject($this); }
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; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->datetime == NULL) { $this->datetime = 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->body == '' || $this->body == NULL) { throw new IllegalModelStateException('Invalid body'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } $conversationMessage = new ConversationMessageObject($this); if ($conversationMessage->getSignature() == NULL) { $conversationMessage->signObject(); } if (!$conversationMessage->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $conversationMessage; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } if (!GID::isValid($this->initiatingGID)) { throw new IllegalModelStateException('Invalid initiatingGID'); } if (!GID::isValid($this->targetedGID)) { throw new IllegalModelStateException('Invalid targetedGID'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } return new LinkRequestObject($this); }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } if (!UOID::isValid($this->conversationID)) { throw new IllegalModelStateException('Invalid conversationID'); } if (!UOID::isValid($this->targetID)) { throw new IllegalModelStateException('Invalid targetID'); } if (!GID::isValid($this->author)) { throw new IllegalModelStateException('Invalid author'); } if ($this->status == '' || $this->status == NULL) { throw new IllegalModelStateException('Invalid status: ' . $this->status); } if ($this->status != ConversationMessageStatusObject::STATUS_READ && $this->status != ConversationMessageStatusObject::STATUS_RECEIVED && $this->status != ConversationMessageStatusObject::STATUS_DELETED) { throw new IllegalModelStateException('Invalid status: ' . $this->status); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime: ' . $this->datetime); } $conversationMessageStatus = new ConversationMessageStatusObject($this); if ($conversationMessageStatus->getSignature() == NULL) { $conversationMessageStatus->signObject(); } if (!$conversationMessageStatus->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $conversationMessageStatus; }
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; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } if (!UOID::isValid($this->targetID)) { throw new IllegalModelStateException('Invalid targetID'); } if ($this->accept === true && $this->link == NULL) { throw new IllegalModelStateException('Invalid link'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime: ' . $this->datetime); } return new LinkResponseObject($this); }
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; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->hopCount == NULL) { $this->hopCount = 0; } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } if (!GID::isValid($this->initiatingGID)) { throw new IllegalModelStateException('Invalid initiatingGID'); } if (!is_numeric($this->hopCount) || $this->hopCount > 3) { throw new IllegalModelStateException('Invalid value for hopCount'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } if ($this->query === NULL || !$this->query instanceof ESQuery) { throw new IllegalModelStateException('Invalid value for query'); } $searchQuery = new SearchQueryObject($this); if ($searchQuery->getSignature() == NULL) { $searchQuery->signObject(); } if (!$searchQuery->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $searchQuery; }