aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/lib/Grpc/ServerStreamingCall.php
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanleycheung@google.com>2015-10-27 13:27:05 -0700
committerGravatar Stanley Cheung <stanleycheung@google.com>2015-10-27 13:27:05 -0700
commitd5b20566f2517eae9373b930e82b45cf2f407d9e (patch)
treea8ecf17061d12aaf94ed3518c4117869f4e2b0fb /src/php/lib/Grpc/ServerStreamingCall.php
parent21ca91a6a41195ccee1cfde0e5f048cc9ec5d42d (diff)
php: ran php-cs-fixer to comply with php coding standard
Diffstat (limited to 'src/php/lib/Grpc/ServerStreamingCall.php')
-rw-r--r--src/php/lib/Grpc/ServerStreamingCall.php93
1 files changed, 53 insertions, 40 deletions
diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php
index f18ad2c22a..da48523717 100644
--- a/src/php/lib/Grpc/ServerStreamingCall.php
+++ b/src/php/lib/Grpc/ServerStreamingCall.php
@@ -31,53 +31,66 @@
* 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 stream
- * of reponses
+ * of reponses.
*/
-class ServerStreamingCall 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 ServerStreamingCall 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;
- }
- /**
- * @return An iterator of response values
- */
- public function responses() {
- $response = $this->call->startBatch([OP_RECV_MESSAGE => true])->message;
- while($response !== null) {
- yield $this->deserializeResponse($response);
- $response = $this->call->startBatch([OP_RECV_MESSAGE => true])->message;
+ /**
+ * @return An iterator of response values
+ */
+ public function responses()
+ {
+ $response = $this->call->startBatch([
+ OP_RECV_MESSAGE => true,
+ ])->message;
+ while ($response !== null) {
+ yield $this->deserializeResponse($response);
+ $response = $this->call->startBatch([
+ OP_RECV_MESSAGE => true,
+ ])->message;
+ }
}
- }
- /**
- * Wait for the server to send the status, and return it.
- * @return object The status object, with integer $code, string $details,
- * and array $metadata members
- */
- public function getStatus() {
- $status_event = $this->call->startBatch([
- OP_RECV_STATUS_ON_CLIENT => true
- ]);
- return $status_event->status;
- }
+ /**
+ * Wait for the server to send the status, and return it.
+ *
+ * @return object The status object, with integer $code, string $details,
+ * and array $metadata members
+ */
+ public function getStatus()
+ {
+ $status_event = $this->call->startBatch([
+ OP_RECV_STATUS_ON_CLIENT => true,
+ ]);
+
+ return $status_event->status;
+ }
}