Ejemplo n.º 1
0
 private function buildResponse(Query $query, array $cachedRecords) : Message
 {
     $response = new Message();
     $response->header->set('id', $this->generateId());
     $response->header->set('qr', 1);
     $response->header->set('opcode', Message::OPCODE_QUERY);
     $response->header->set('rd', 1);
     $response->header->set('rcode', Message::RCODE_OK);
     $response->questions[] = new Record($query->getName(), $query->getType(), $query->getClass());
     foreach ($cachedRecords as $record) {
         $response->answers[] = $record;
     }
     $response->prepare();
     return $response;
 }
Ejemplo n.º 2
0
 private function serializeQueryToIdentity(Query $query)
 {
     return $query->getName() . ':' . $query->getType() . ':' . $query->getClass();
 }