public static function construct($extended_pan_id, $extended_address, $network_address, $device_type, $rx_on_when_idle, $relationship, $permit_joining, $depth, $lqi) { $frame = new self(); $frame->setExtendedPanId($extended_pan_id); $frame->setExtendedAddress($extended_address); $frame->setNetworkAddress($network_address); $frame->setDeviceType($device_type); $frame->setRxOnWhenIdle($rx_on_when_idle); $frame->setRelationship($relationship); $frame->setPermitJoining($permit_joining); $frame->setDepth($depth); $frame->setLqi($lqi); return $frame; }
/** * @param Workflow $workflow * @param User $user * @param string $content * @param string $format wikitext|html * @param string[optional] $changeType * @return PostRevision */ public function reply(Workflow $workflow, User $user, $content, $format, $changeType = 'reply') { $reply = new self(); // UUIDs should not be reused for different entities/entity types in the future. // (It is also inconsistent with newFromId, which uses separate ones.) // This may be changed here in the future. $reply->revId = $reply->postId = UUID::create(); $reply->user = UserTuple::newFromUser($user); $reply->origUser = $reply->user; $reply->replyToId = $this->postId; $reply->setContent($content, $format, $workflow->getArticleTitle()); $reply->changeType = $changeType; $reply->setChildren(array()); $reply->setDepth($this->getDepth() + 1); $reply->rootPost = $this->rootPost; return $reply; }
/** * @param \DOMElement $element * * @throws \InvalidArgumentException * @return self * * @todo define exception message */ public static function fromXml(\DOMElement $element) { $xpath = new \DOMXPath($element->ownerDocument); $xpath->registerNamespace('D', 'DAV:'); $xLockType = $xpath->query('D:locktype/*', $element); $xLockScope = $xpath->query('D:lockscope/*', $element); if ($xLockType->length == 0 || $xLockScope->length == 0) { throw new \InvalidArgumentException(); } $result = new self($xLockScope->item(0)->localName, $xLockType->item(0)->localName); if ($depth = $xpath->evaluate('string(D:depth)', $element)) { $result->setDepth(DepthHeader::parse($depth)); } if ($timeout = $xpath->evaluate('string(D:timeout)', $element)) { $result->setTimeout($timeout); } $xOwner = $xpath->query('D:owner', $element); if ($xOwner->length) { $result->setOwner(trim($xOwner->item(0)->textContent)); } $xLockToken = $xpath->query('D:locktoken', $element); if ($xLockToken->length) { $result->setToken(trim($xLockToken->item(0)->textContent)); } return $result; }