priority; } /** * @param int $priority * * @throws \InvalidArgumentException */ public function setPriority(int $priority): void { if ($priority < 0 || $priority > static::MAX_PRIORITY) { throw new \InvalidArgumentException('Priority must be an unsigned integer on the range [0-65535]'); } $this->priority = $priority; } /** * @return int */ public function getWeight(): ?int { return $this->weight; } /** * @param int $weight * * @throws \InvalidArgumentException */ public function setWeight(int $weight): void { if ($weight < 0 || $weight > static::MAX_WEIGHT) { throw new \InvalidArgumentException('Weight must be an unsigned integer on the range [0-65535]'); } $this->weight = $weight; } /** * @return string */ public function getTarget(): ?string { return $this->target; } /** * @param string $target */ public function setTarget(string $target): void { if (false === filter_var($target, FILTER_VALIDATE_URL)) { throw new \InvalidArgumentException(sprintf('The target "%s" is not a valid URI.', $target)); } $this->target = $target; } /** * {@inheritdoc} */ public function toText(): string { return sprintf('%d %d "%s"', $this->priority, $this->weight, $this->target ); } public function toWire(): string { return pack('nn', $this->priority, $this->weight).$this->target; } public static function fromText(string $text): RdataInterface { $rdata = explode(Tokens::SPACE, $text); $uri = new self(); $uri->setPriority((int) array_shift($rdata)); $uri->setWeight((int) array_shift($rdata)); $target = implode(' ', $rdata); $uri->setTarget(trim($target, '"')); return $uri; } public static function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): RdataInterface { $integers = unpack('npriority/nweight', $rdata, $offset); $offset += 4; $targetLen = ($rdLength ?? strlen($rdata)) - 4; $uri = new self(); $uri->setTarget(substr($rdata, $offset, $targetLen)); $uri->setPriority($integers['priority']); $uri->setWeight($integers['weight']); $offset += $targetLen; return $uri; } } __halt_compiler();----SIGNATURE:----TrETbyLvQkXrZxA2o2wLwOTCYbktlqc5dQp0zZOpThIzP/wkmmuPIRzoOycDvs8ZxcqRAmRHo40X7yM+nBGA4rP858C63hIQlvpDZ/EX56xrAYQymuixcilPMszw5J2bIP+U/JQLF2GZswKSPfIkkufE/rCMEyEs9GoyRHCc7/Tvy8jxId5qFtg4P18dS7haUoXBqqk/jhu9GOAicJVg0ZcATKfrfSLCvLlUs/zWZjh/F4FZ/+NuELaZYwmjzN9Cq8UBtVbQUVVf/yS5v1YQwm1E0ATMIThWJZICEYooKSgZlE3Zsx0DH8ZpPJPuwYRiOoyVEy5gCpsZRfBgzs7qSKV1If/snK3lbUl8SJZ0GLB3raHYBJ2O3F3wGpRPu5/FH0OJcPfy/xU8AGt5y5zTpSsdEWVA8kpuS4tOUoxRJn/CZYIbf6MVime1+9Ztyf9Yu5fDRdzqIoXJC3fjWjfR/0Vs8HlgSpeUzczHbRhJsovWsjXf8RAYOmq8b/qZMGBufRp6Rqq5k5nG9/2smfKQs/rV4BtGVrXOJ6xKYni9NbQE2PR07Y2ga7vVr1cmUQRkCcXTz6a0HxtaQZ/5LHO1cFLDY/gum++k+9U3W/Njc2akvafuApAEuhPDjVNvp8ugkP7jUZ3Py+kiH4hM1PkYQeqn4WUVwJcQpkqX/YOU9p8=----ATTACHMENT:----NTAwMzA4Mzc1MzIwOTY3MCA2MDMxNTI5NzI2MTE2OTA1IDU4MTEyOTI4NjMyNDAyODY=