Merge pull request #9416 from thinkerou/update_method_property_visibility

PHP: Update the visibility property  of method
pull/9482/head
Stanley Cheung 8 years ago committed by GitHub
commit de78a21579
  1. 4
      src/php/lib/Grpc/AbstractCall.php
  2. 24
      src/php/lib/Grpc/BaseStub.php
  3. 4
      src/php/lib/Grpc/BidiStreamingCall.php
  4. 4
      src/php/lib/Grpc/ClientStreamingCall.php
  5. 4
      src/php/lib/Grpc/ServerStreamingCall.php
  6. 4
      src/php/lib/Grpc/UnaryCall.php

@ -126,7 +126,7 @@ abstract class AbstractCall
* *
* @return string The protobuf binary format * @return string The protobuf binary format
*/ */
protected function serializeMessage($data) protected function _serializeMessage($data)
{ {
// Proto3 implementation // Proto3 implementation
if (method_exists($data, 'encode')) { if (method_exists($data, 'encode')) {
@ -144,7 +144,7 @@ abstract class AbstractCall
* *
* @return mixed The deserialized value * @return mixed The deserialized value
*/ */
protected function deserializeResponse($value) protected function _deserializeResponse($value)
{ {
if ($value === null) { if ($value === null) {
return; return;

@ -145,6 +145,14 @@ class BaseStub
return $this->_checkConnectivityState($new_state); return $this->_checkConnectivityState($new_state);
} }
/**
* Close the communication channel associated with this stub.
*/
public function close()
{
$this->channel->close();
}
/** /**
* @param $new_state Connect state * @param $new_state Connect state
* *
@ -163,14 +171,6 @@ class BaseStub
return false; return false;
} }
/**
* Close the communication channel associated with this stub.
*/
public function close()
{
$this->channel->close();
}
/** /**
* constructs the auth uri for the jwt. * constructs the auth uri for the jwt.
* *
@ -235,7 +235,7 @@ class BaseStub
* *
* @return SimpleSurfaceActiveCall The active call object * @return SimpleSurfaceActiveCall The active call object
*/ */
public function _simpleRequest($method, protected function _simpleRequest($method,
$argument, $argument,
$deserialize, $deserialize,
array $metadata = [], array $metadata = [],
@ -270,7 +270,7 @@ class BaseStub
* *
* @return ClientStreamingSurfaceActiveCall The active call object * @return ClientStreamingSurfaceActiveCall The active call object
*/ */
public function _clientStreamRequest($method, protected function _clientStreamRequest($method,
$deserialize, $deserialize,
array $metadata = [], array $metadata = [],
array $options = []) array $options = [])
@ -305,7 +305,7 @@ class BaseStub
* *
* @return ServerStreamingSurfaceActiveCall The active call object * @return ServerStreamingSurfaceActiveCall The active call object
*/ */
public function _serverStreamRequest($method, protected function _serverStreamRequest($method,
$argument, $argument,
$deserialize, $deserialize,
array $metadata = [], array $metadata = [],
@ -339,7 +339,7 @@ class BaseStub
* *
* @return BidiStreamingSurfaceActiveCall The active call object * @return BidiStreamingSurfaceActiveCall The active call object
*/ */
public function _bidiRequest($method, protected function _bidiRequest($method,
$deserialize, $deserialize,
array $metadata = [], array $metadata = [],
array $options = []) array $options = [])

@ -69,7 +69,7 @@ class BidiStreamingCall extends AbstractCall
$this->metadata = $read_event->metadata; $this->metadata = $read_event->metadata;
} }
return $this->deserializeResponse($read_event->message); return $this->_deserializeResponse($read_event->message);
} }
/** /**
@ -82,7 +82,7 @@ class BidiStreamingCall extends AbstractCall
*/ */
public function write($data, array $options = []) public function write($data, array $options = [])
{ {
$message_array = ['message' => $this->serializeMessage($data)]; $message_array = ['message' => $this->_serializeMessage($data)];
if (array_key_exists('flags', $options)) { if (array_key_exists('flags', $options)) {
$message_array['flags'] = $options['flags']; $message_array['flags'] = $options['flags'];
} }

@ -63,7 +63,7 @@ class ClientStreamingCall extends AbstractCall
*/ */
public function write($data, array $options = []) public function write($data, array $options = [])
{ {
$message_array = ['message' => $this->serializeMessage($data)]; $message_array = ['message' => $this->_serializeMessage($data)];
if (array_key_exists('flags', $options)) { if (array_key_exists('flags', $options)) {
$message_array['flags'] = $options['flags']; $message_array['flags'] = $options['flags'];
} }
@ -90,6 +90,6 @@ class ClientStreamingCall extends AbstractCall
$status = $event->status; $status = $event->status;
$this->trailing_metadata = $status->metadata; $this->trailing_metadata = $status->metadata;
return [$this->deserializeResponse($event->message), $status]; return [$this->_deserializeResponse($event->message), $status];
} }
} }

@ -51,7 +51,7 @@ class ServerStreamingCall extends AbstractCall
*/ */
public function start($data, array $metadata = [], array $options = []) public function start($data, array $metadata = [], array $options = [])
{ {
$message_array = ['message' => $this->serializeMessage($data)]; $message_array = ['message' => $this->_serializeMessage($data)];
if (array_key_exists('flags', $options)) { if (array_key_exists('flags', $options)) {
$message_array['flags'] = $options['flags']; $message_array['flags'] = $options['flags'];
} }
@ -73,7 +73,7 @@ class ServerStreamingCall extends AbstractCall
OP_RECV_MESSAGE => true, OP_RECV_MESSAGE => true,
])->message; ])->message;
while ($response !== null) { while ($response !== null) {
yield $this->deserializeResponse($response); yield $this->_deserializeResponse($response);
$response = $this->call->startBatch([ $response = $this->call->startBatch([
OP_RECV_MESSAGE => true, OP_RECV_MESSAGE => true,
])->message; ])->message;

@ -51,7 +51,7 @@ class UnaryCall extends AbstractCall
*/ */
public function start($data, array $metadata = [], array $options = []) public function start($data, array $metadata = [], array $options = [])
{ {
$message_array = ['message' => $this->serializeMessage($data)]; $message_array = ['message' => $this->_serializeMessage($data)];
if (isset($options['flags'])) { if (isset($options['flags'])) {
$message_array['flags'] = $options['flags']; $message_array['flags'] = $options['flags'];
} }
@ -79,6 +79,6 @@ class UnaryCall extends AbstractCall
$status = $event->status; $status = $event->status;
$this->trailing_metadata = $status->metadata; $this->trailing_metadata = $status->metadata;
return [$this->deserializeResponse($event->message), $status]; return [$this->_deserializeResponse($event->message), $status];
} }
} }

Loading…
Cancel
Save