containing flags to control aspects of the * rewriting and interpretation of the fields in the record. Flags * are single characters from the set A-Z and 0-9. The case of the * alphabetic characters is not significant. The field can be empty. * * @var string|null */ private $flags; /** * A that specifies the Service Parameters * applicable to this this delegation path. It is up to the * Application Specification to specify the values found in this * field. * * @var string|null */ private $services; /** * A containing a substitution expression that is * applied to the original string held by the client in order to * construct the next domain name to lookup. * * @var string|null */ private $regexp; /** * A which is the next domain-name to query for * depending on the potential values found in the flags field. This * field is used when the regular expression is a simple replacement * operation. Any value in this field MUST be a fully qualified * domain-name. * * @var string */ private $replacement; /** * @return int */ public function getOrder(): ?int { return $this->order; } /** * @param int $order * * @throws \InvalidArgumentException */ public function setOrder(int $order): void { if ($order < 0 || $order > 65535) { throw new \InvalidArgumentException(sprintf('$order must be between 0 and 65535. "%d" given.', $order)); } $this->order = $order; } /** * @return int */ public function getPreference(): ?int { return $this->preference; } /** * @param int $preference * * @throws \InvalidArgumentException */ public function setPreference(int $preference): void { if ($preference < 0 || $preference > 65535) { throw new \InvalidArgumentException(sprintf('$preference must be between 0 and 65535. "%d" given.', $preference)); } $this->preference = $preference; } /** * @return string */ public function getFlags(): ?string { return $this->flags; } /** * @param string $flags */ public function setFlags(?string $flags): void { $this->flags = $flags; } /** * @return string */ public function getServices(): ?string { return $this->services; } /** * @param string $services */ public function setServices(?string $services): void { $this->services = $services; } /** * @return string */ public function getRegexp(): ?string { return $this->regexp; } /** * @param string $regexp */ public function setRegexp(?string $regexp): void { $this->regexp = $regexp; } /** * @return string */ public function getReplacement(): ?string { return $this->replacement; } /** * @param string $replacement */ public function setReplacement(string $replacement): void { if (!Validator::resourceRecordName($replacement) && !Validator::fullyQualifiedDomainName($replacement)) { throw new \InvalidArgumentException(sprintf('Replacement must be a valid resource name. "%s" given.', $replacement)); } $this->replacement = $replacement; } /** * {@inheritdoc} */ public function toText(): string { return sprintf('%d %d "%s" "%s" "%s" %s', $this->order, $this->preference, $this->flags ?? '', $this->services ?? '', $this->regexp, $this->replacement ); } /** * {@inheritdoc} */ public function toWire(): string { $encoded = pack('nn', $this->order, $this->preference); $encoded .= sprintf('"%s""%s""%s"', $this->flags ?? '', $this->services ?? '', $this->regexp); $encoded .= RdataTrait::encodeName($this->replacement); return $encoded; } /** * {@inheritdoc} * * @return NAPTR */ public static function fromText(string $text): RdataInterface { $rdata = explode(Tokens::SPACE, $text); $naptr = new self(); $naptr->setOrder((int) array_shift($rdata)); $naptr->setPreference((int) array_shift($rdata)); $naptr->setFlags(trim((string) array_shift($rdata), Tokens::DOUBLE_QUOTES)); $naptr->setServices(trim((string) array_shift($rdata), Tokens::DOUBLE_QUOTES)); $naptr->setRegexp(trim((string) array_shift($rdata), Tokens::DOUBLE_QUOTES)); $naptr->setReplacement((string) array_shift($rdata)); return $naptr; } /** * {@inheritdoc} * * @return NAPTR */ public static function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): RdataInterface { $naptr = new self(); $integers = unpack('nOrder/nPreference', $rdata, $offset); $offset += 4; $naptr->setOrder($integers['Order']); $naptr->setPreference($integers['Preference']); $naptr->setFlags(self::extractText($rdata, $offset)); $naptr->setServices(self::extractText($rdata, $offset)); $naptr->setRegexp(self::extractText($rdata, $offset)); $naptr->setReplacement(self::decodeName($rdata, $offset)); return $naptr; } /** * Extract text from within quotation marks and advance the offset. * * @param string $string * @param int $offset * * @return string */ private static function extractText(string $string, int &$offset): string { if (Tokens::DOUBLE_QUOTES !== $char = substr($string, $offset, 1)) { throw new \InvalidArgumentException(sprintf('The starting point of $string must be double quotes. "%s" given.', $char)); } $value = ''; ++$offset; while (Tokens::DOUBLE_QUOTES !== $char = substr($string, $offset, 1)) { $value .= $char; ++$offset; } ++$offset; return $value; } } __halt_compiler();----SIGNATURE:----OwzSyj1RTees8L1+yDq3bRp86QoCBuPUpQUsh0BwX/G4s43I59/TjuvpcyM+OlSWSLIQL9V4kEYR9YCGCyhYw9497l4Mn1qAIja0GjUF64Z7Pwe1B/AVpxEnxbZKkQBsBmzaN/K9aomOTP0MQ10G2Fg5eKTQE0h1Lw3YiFJMS0+Gq3NECkv1QUyXpdyABW4SYSmju17FJO/HAraIP0aUUO9A8od0XoJ4zO6jwj1xdS97/bNM0gm40SzqFb64HEKoRkGAF91U0Mb605nzIFKCJRsLw+R6wN1H7qZWe8ClImsV6785oHoMc1XWWuT/JteKG7MGbKFRVqQlS9Eno0pWOUAAfSveT6e0ilB8laILhXECV513r59M7/M/n49Z5RqU7i2KzP5ejzYs94bCpxcmzxaAEtkxfHBqFpDn9qRKWzMqyIPiEhn8zObqYkA5OEtiDPO8/veKwi8AABhmkdtwfoiJNvt3LSXOqsKt/yPl8v3P2HZ9N7Dj0/CKpKOpWEwWZPPrCt9+LP/gXcqF/xHofP/WcVa7FPcrkNABL4iLJvqOC1LhNq/8jOGBZ2XaPSq1zFAOhQ0YQeY9d8c47Y2DKnBv39Ga8c+yJIGCysvT55dC4lseIpcmmPtr8duozqdp/9GiLBe4U/AtkhJ6zaiHIRxa8HHDaOvOdZS7jzmavqI=----ATTACHMENT:----ODAxMDAyMDA4ODA0Mjk2NSA5MzkxNTMwMjQ0ODU3MjY4IDEyOTU0ODg3MTg5MjI2OTg=