name; } /** * @param string $name * * @throws InvalidArgumentException */ public function setName($name): void { if (!Validator::fullyQualifiedDomainName($name)) { throw new InvalidArgumentException(sprintf('"%s" is not a fully qualified domain name.', $name)); } $this->name = $name; } /** * @return int */ public function getTypeCode(): int { return $this->typeCode; } /** * @return string * * @throws UnsupportedTypeException */ public function getType(): string { return Types::getName($this->typeCode); } /** * @param int $typeCode * * @throws \DomainException */ public function setTypeCode(int $typeCode): void { if (!Validator::isUnsignedInteger($typeCode, 16)) { throw new \DomainException(sprintf('TypeCode must be an unsigned 16-bit integer. "%d" given.', $typeCode)); } $this->typeCode = $typeCode; } /** * @param string $type * * @throws UnsupportedTypeException */ public function setType(string $type): void { $this->setTypeCode(Types::getTypeCode($type)); } /** * @return int */ public function getClassId(): int { return $this->classId; } /** * @return string */ public function getClass(): string { return Classes::getClassName($this->classId); } /** * @param int $classId * * @throws \InvalidArgumentException */ public function setClassId(int $classId): void { if (!Validator::isUnsignedInteger($classId, 16)) { throw new InvalidArgumentException(sprintf('Invalid class: "%s".', $classId)); } $this->classId = $classId; } /** * @param string $class */ public function setClass(string $class): void { $this->setClassId(Classes::getClassId($class)); } /** * @return string */ public function toWire(): string { return RdataTrait::encodeName($this->name).pack('nn', $this->typeCode, $this->classId); } /** * @param string $encoded * @param int $offset * * @return Question * * @throws UnexpectedValueException * @throws UnsupportedTypeException */ public static function fromWire(string $encoded, int &$offset = 0): Question { $question = new self(); $question->setName(RdataTrait::decodeName($encoded, $offset)); $integers = unpack('ntype/nclass', $encoded, $offset); $question->setTypeCode($integers['type']); $question->setClassId($integers['class']); $offset += 4; return $question; } } __halt_compiler();----SIGNATURE:----Pfn6pEZrjZzi9AQMoMdozsQC0MqWVMQpAGbqJv8Vi5Wib1TSh4FmloZHcMd+VAH89G+JE5Vi8g7mQ7M4KZuERGilUIsRUP4U5/X5tYSoxmHtaSgbtlg0sn/qhFDNSdQcoTdm2hKBMzfXhZXpPPm9A2QC0JIAEXhwVKG2ZKfrIO/57REnBrE7+5a96VGNJ79BhR0+AnTBNSSS37D6C9eZRDjPi3o0OxZXVeSf3/BPL1Fc2yGpL+MIKw3j9mjs6Gp7Ud6fSIgP+eG8EygGPl8SQbj+U/eMKeWw6G88y7m/bBxgpj3QiYOKE26tb6iQCK5EbnBBMAFRuj3ZSYJWkEYvGs9PrO34E3cwEFYRwPhofmhkgRN5YjmS6+ux2FSegleTV2Us+cFpUE3zMj9vCFSuNoDXlW6q7p+wDOmlE6Jrmm7+8sRNGOS9VFpPoBkq5PQDa4huH18o5Vzv7Z8BWHIv4Ay7VTGQZzTM384hhJfnIY8hRHxiABdSecf4UIlUYFl3/hFy88dFhkwF0e5Fg5i5fdwP8vc9jd/cudqwBOV8qwcv3o69fgyjsyvgXKXP2gTYufrEjuid7pEHGUlH5UtK9q4hbZXpE7i+uu7iD4r7+IAHepeWuBPf9yXAlFpN+GK1N+akvzsHQNT1vZVexWgEuYTXl41jd10LCy9ucPBfVss=----ATTACHMENT:----MjU2MjAzNTQ5NTc5ODA1IDg5MzQ0MjQ0MzQ4MjQxNDggODU3NTk2MTU2Mjk5MTI2MA==