diff options
author | Stanley Cheung <stanleycheung@google.com> | 2015-10-27 13:27:05 -0700 |
---|---|---|
committer | Stanley Cheung <stanleycheung@google.com> | 2015-10-27 13:27:05 -0700 |
commit | d5b20566f2517eae9373b930e82b45cf2f407d9e (patch) | |
tree | a8ecf17061d12aaf94ed3518c4117869f4e2b0fb /src/php/lib/Grpc/UnaryCall.php | |
parent | 21ca91a6a41195ccee1cfde0e5f048cc9ec5d42d (diff) |
php: ran php-cs-fixer to comply with php coding standard
Diffstat (limited to 'src/php/lib/Grpc/UnaryCall.php')
-rw-r--r-- | src/php/lib/Grpc/UnaryCall.php | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index 821c31013f..b57903d6d0 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -31,41 +31,50 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + namespace Grpc; /** * Represents an active call that sends a single message and then gets a single * response. */ -class UnaryCall extends AbstractCall { - /** - * Start the call - * @param $data The data to send - * @param array $metadata Metadata to send with the call, if applicable - * @param array $options an array of options, possible keys: - * 'flags' => a number - */ - public function start($data, $metadata = [], $options = []) { - $message_array = ['message' => $data->serialize()]; - if (isset($options['flags'])) { - $message_array['flags'] = $options['flags']; +class UnaryCall extends AbstractCall +{ + /** + * Start the call. + * + * @param $data The data to send + * @param array $metadata Metadata to send with the call, if applicable + * @param array $options an array of options, possible keys: + * 'flags' => a number + */ + public function start($data, $metadata = [], $options = []) + { + $message_array = ['message' => $data->serialize()]; + if (isset($options['flags'])) { + $message_array['flags'] = $options['flags']; + } + $event = $this->call->startBatch([ + OP_SEND_INITIAL_METADATA => $metadata, + OP_RECV_INITIAL_METADATA => true, + OP_SEND_MESSAGE => $message_array, + OP_SEND_CLOSE_FROM_CLIENT => true, + ]); + $this->metadata = $event->metadata; } - $event = $this->call->startBatch([ - OP_SEND_INITIAL_METADATA => $metadata, - OP_RECV_INITIAL_METADATA => true, - OP_SEND_MESSAGE => $message_array, - OP_SEND_CLOSE_FROM_CLIENT => true]); - $this->metadata = $event->metadata; - } - /** - * Wait for the server to respond with data and a status - * @return [response data, status] - */ - public function wait() { - $event = $this->call->startBatch([ - OP_RECV_MESSAGE => true, - OP_RECV_STATUS_ON_CLIENT => true]); - return [$this->deserializeResponse($event->message), $event->status]; - } + /** + * Wait for the server to respond with data and a status. + * + * @return [response data, status] + */ + public function wait() + { + $event = $this->call->startBatch([ + OP_RECV_MESSAGE => true, + OP_RECV_STATUS_ON_CLIENT => true, + ]); + + return [$this->deserializeResponse($event->message), $event->status]; + } } |