/** * Decode a Char field * * @param \LibDNS\Decoder\DecodingContext $decodingContext * @param \LibDNS\Records\Types\Char $char The object to populate with the result * @return int The number of packet bytes consumed by the operation * @throws \UnexpectedValueException When the packet data is invalid */ private function decodeChar(DecodingContext $decodingContext, Char $char) { $value = unpack('C', $this->readDataFromPacket($decodingContext->getPacket(), 1))[1]; $char->setValue($value); return 1; }
/** * Encode a Char field * * @param \LibDNS\Records\Types\Char $char * @return string */ private function encodeChar(Char $char) { return chr($char->getValue()); }