<commit_before><?php

namespace React\Dns;

use React\Socket\Connection;

class Resolver
{
    public function resolve($domain, $callback)
    {
        $nameserver = '8.8.8.8';
        $query = new Query($domain, 'A', 'IN');

        $this->query($nameserver, $query, function (Message $response) use ($callback) {
            $answer = $response->answer[array_rand($response->answer)]->data->address;
            $callback($address);
        });
    }

    public function query($nameserver, Query $query, $callback)
    {
        $dumper = new BinaryDumper();
        $parser = new Parser();

        $message = new Message();
        $message->header = array(
            $query...
        );
        $message->question = array(
            $query...
        );

        $response = new Message();

        $conn = new Connection(fopen("udp://$nameserver:53"), $this->loop);
        $conn->on('data', function ($data) use ($conn, $response, $callback) {
            if ($parser->parseChunk($data, $response)) {
                $conn->end();
                $callback($response);
            }
        });
        $conn->write($dumper->toBinary($message));
    }
}<commit_msg>[Dns] Fix parse errors in resolver stub<commit_after><?php

namespace React\Dns;

use React\Socket\Connection;

class Resolver
{
    public function resolve($domain, $callback)
    {
        $nameserver = '8.8.8.8';
        $query = new Query($domain, 'A', 'IN');

        $this->query($nameserver, $query, function (Message $response) use ($callback) {
            $answer = $response->answer[array_rand($response->answer)]->data->address;
            $callback($address);
        });
    }

    public function query($nameserver, Query $query, $callback)
    {
        $dumper = new BinaryDumper();
        $parser = new Parser();

        $message = new Message();
        $message->header = array(
            // $query...
        );
        $message->question = array(
            // $query...
        );

        $response = new Message();

        $conn = new Connection(fopen("udp://$nameserver:53"), $this->loop);
        $conn->on('data', function ($data) use ($conn, $response, $callback) {
            if ($parser->parseChunk($data, $response)) {
                $conn->end();
                $callback($response);
            }
        });
        $conn->write($dumper->toBinary($message));
    }
}
{'fraction_non_alphanumeric': 0.17322175732217573, 'fraction_numerical': 0.00502092050209205, 'mean_word_length': 2.0693196405648266, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1045570', 'n_tokens_mistral': 701, 'n_tokens_neox': 674, 'n_words': 144}