Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
 
3
namespace React\Dns\Query;
4
 
5
interface ExecutorInterface
6
{
7
    /**
8
     * Executes a query and will return a response message
9
     *
10
     * It returns a Promise which either fulfills with a response
11
     * `React\Dns\Model\Message` on success or rejects with an `Exception` if
12
     * the query is not successful. A response message may indicate an error
13
     * condition in its `rcode`, but this is considered a valid response message.
14
     *
15
     * ```php
16
     * $executor->query($query)->then(
17
     *     function (React\Dns\Model\Message $response) {
18
     *         // response message successfully received
19
     *         var_dump($response->rcode, $response->answers);
20
     *     },
21
     *     function (Exception $error) {
22
     *         // failed to query due to $error
23
     *     }
24
     * );
25
     * ```
26
     *
27
     * The returned Promise MUST be implemented in such a way that it can be
28
     * cancelled when it is still pending. Cancelling a pending promise MUST
29
     * reject its value with an Exception. It SHOULD clean up any underlying
30
     * resources and references as applicable.
31
     *
32
     * ```php
33
     * $promise = $executor->query($query);
34
     *
35
     * $promise->cancel();
36
     * ```
37
     *
38
     * @param Query $query
39
     * @return \React\Promise\PromiseInterface<\React\Dns\Model\Message,\Exception>
40
     *     resolves with response message on success or rejects with an Exception on error
41
     */
42
    public function query(Query $query);
43
}