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; }
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->targetGID != "" && !GID::isValid($this->targetGID)) { throw new IllegalModelStateException('Invalid targetGID: ' . $this->targetGID); } if ($this->status == '' || $this->status == NULL) { throw new IllegalModelStateException('Invalid status: ' . $this->status); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } $conversationStatus = new ConversationStatusObject($this); if ($conversationStatus->getSignature() == NULL) { $conversationStatus->signObject(); } if (!$conversationStatus->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $conversationStatus; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->featureList == NULL) { $this->featureList = array(); } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if ($this->expires == NULL) { $this->expires = $this->datetime; } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } $featureList = new FeatureListObject($this); if ($this->signature == NULL) { $featureList->signObject(); } if (!$featureList->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $featureList; }
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; }
public function setDatetime($datetime = NULL) { if ($datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } else { $this->datetime = $datetime; } return $this; }
public function datePublished($datePublished = NULL) { if ($datePublished == NULL) { $this->datePublished = XSDDateTime::getXSDDateTime(); } else { $this->datePublished = $datePublished; } return $this; }
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 setDateUpdated($dateUpdated = NULL) { if ($dateUpdated == NULL) { $this->dateUpdated = XSDDateTime::getXSDDateTime(); } else { $this->dateUpdated = $dateUpdated; } $this->invalidate(); return $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 (!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->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 ($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; }
/** * Builder method that creates the actual SocialRecord object * * @throws SocialRecordFormatException * * @return The SocialRecord (SocialRecord) */ public function build() { if ($this->displayName == NULL) { throw new SocialRecordFormatException('SocialRecord: displayName must be specified for instantiation'); } if ($this->profileLocation == NULL) { throw new SocialRecordFormatException('SocialRecord: profileLocation must be specified for instantiation'); } if ($this->personalPublicKey == NULL) { throw new SocialRecordFormatException('SocialRecord: personalPublicKey must be specified for instantiation'); } if ($this->accountPublicKey == NULL) { throw new SocialRecordFormatException('SocialRecord: accountPublicKey must be specified for instantiation'); } if ($this->type == NULL) { throw new SocialRecordFormatException('SocialRecord: type must be specified for instantiation'); } if ($this->type != SocialRecord::TYPE_PLATFORM && $this->type != SocialRecord::TYPE_USER) { throw new SocialRecordFormatException('SocialRecord: Invalid type value [' . $this->type . ']'); } if ($this->salt == NULL) { $this->salt = Random::getRandom(SocialRecord::SALT_CHARS); } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if ($this->globalID == NULL) { $this->globalID = GID::createGID($this->personalPublicKey, $this->salt); } if (!GID::isValid($this->globalID)) { throw new SocialRecordFormatException('SocialRecord: Invalid globalID value [' . $this->globalID . ']'); } if ($this->platformGID == NULL && $this->type == SocialRecord::TYPE_PLATFORM) { $this->platformGID = $this->globalID; } if ($this->platformGID == NULL) { throw new SocialRecordFormatException('SocialRecord: platformID must be specified for instantiation'); } if (!GID::isValid($this->platformGID)) { throw new SocialRecordFormatException('SocialRecord: Invalid platformGID value [' . $this->platformGID . ']'); } if ($this->keyRevocationList == NULL) { $this->keyRevocationList = array(); } if ($this->active == NULL) { $this->active = 1; } return new SocialRecord($this); }
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; }