src/ServiceClient.php
private function createCommandHandler()
    {
        return function (CommandInterface $command) {
            return Promise\coroutine(function () use ($command) {
                // Prepare the HTTP options.
                $opts = $command['@http'] ?: [];
                unset($command['@http']);

                try {
                    // Prepare the request from the command and send it.
                    $request = $this->transformCommandToRequest($command);
                    $promise = $this->httpClient->sendAsync($request, $opts);

                    // Create a result from the response.
                    $response = (yield $promise);
                    yield $this->transformResponseToResult($response, $request, $command);
                } catch (\Exception $e) {
                    throw CommandException::fromPrevious($command, $e);
                }
            });
        };
    }
private function createCommandHandler()
    {
        return function (CommandInterface $command) {
            return Promise\coroutine(function () use ($command) {
                // Prepare the HTTP options.
                $opts = $command['@http'] ?: [];
                unset($command['@http']);

                try {
                    // Prepare the request from the command and send it.
                    $request = $this->transformCommandToRequest($command);
                    $promise = $this->httpClient->sendAsync($request, $opts);

                    // Create a result from the response.
                    $response = (yield $promise);
                    yield $this->transformResponseToResult($response, $request, $command);
                } catch (\Exception $e) {
                    throw CommandException::fromPrevious($command, $e);
                }
            });
        };
    }
private function createCommandHandler ( ) { return function ( CommandInterface $ command ) { return Promise \ coroutine ( function ( ) use ( $ command ) { // Prepare the HTTP options. $ opts = $ command [ '@http' ] ? : [ ] ; unset ( $ command [ '@http' ] ) ; try { // Prepare the request from the command and send it. $ request = $ this -> transformCommandToRequest ( $ command ) ; $ promise = $ this -> httpClient -> sendAsync ( $ request , $ opts ) ; // Create a result from the response. $ response = ( yield $ promise ) ; yield $ this -> transformResponseToResult ( $ response , $ request , $ command ) ; } catch ( \ Exception $ e ) { throw CommandException :: fromPrevious ( $ command , $ e ) ; } } ) ; } ; }
Defines the main handler for commands that uses the HTTP client.

@return callable
Defines the main handler for commands that uses the HTTP client .