Skip to content

Commit

Permalink
Merge pull request #137 from clue-labs/executor-docs
Browse files Browse the repository at this point in the history
API documentation for ExecutorInterface
  • Loading branch information
jsor authored Jul 11, 2019
2 parents 9f38d49 + 309ab96 commit 808d08c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/Query/ExecutorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,40 @@

interface ExecutorInterface
{
/**
* Executes a query and will return a response message
*
* It returns a Promise which either fulfills with a response
* `React\Dns\Model\Message` on success or rejects with an `Exception` if
* the query is not successful. A response message may indicate an error
* condition in its `rcode`, but this is considered a valid response message.
*
* ```php
* $executor->query($query)->then(
* function (React\Dns\Model\Message $response) {
* // response message successfully received
* var_dump($response->rcode, $response->answers);
* },
* function (Exception $error) {
* // failed to query due to $error
* }
* );
* ```
*
* The returned Promise MUST be implemented in such a way that it can be
* cancelled when it is still pending. Cancelling a pending promise MUST
* reject its value with an Exception. It SHOULD clean up any underlying
* resources and references as applicable.
*
* ```php
* $promise = $executor->query($query);
*
* $promise->cancel();
* ```
*
* @param Query $query
* @return \React\Promise\PromiseInterface<\React\Dns\Model\Message,\Exception>
* resolves with response message on success or rejects with an Exception on error
*/
public function query(Query $query);
}

0 comments on commit 808d08c

Please sign in to comment.