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/AbstractCall.php | |
parent | 21ca91a6a41195ccee1cfde0e5f048cc9ec5d42d (diff) |
php: ran php-cs-fixer to comply with php coding standard
Diffstat (limited to 'src/php/lib/Grpc/AbstractCall.php')
-rw-r--r-- | src/php/lib/Grpc/AbstractCall.php | 116 |
1 files changed, 65 insertions, 51 deletions
diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php index a3c7a9e017..53849d51fc 100644 --- a/src/php/lib/Grpc/AbstractCall.php +++ b/src/php/lib/Grpc/AbstractCall.php @@ -31,65 +31,79 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + namespace Grpc; -abstract class AbstractCall { +abstract class AbstractCall +{ + protected $call; + protected $deserialize; + protected $metadata; - protected $call; - protected $deserialize; - protected $metadata; + /** + * Create a new Call wrapper object. + * + * @param Channel $channel The channel to communicate on + * @param string $method The method to call on the + * remote server + * @param callback $deserialize A callback function to deserialize + * the response + * @param (optional) long $timeout Timeout in microseconds + */ + public function __construct(Channel $channel, + $method, + $deserialize, + $timeout = false) + { + if ($timeout) { + $now = Timeval::now(); + $delta = new Timeval($timeout); + $deadline = $now->add($delta); + } else { + $deadline = Timeval::infFuture(); + } + $this->call = new Call($channel, $method, $deadline); + $this->deserialize = $deserialize; + $this->metadata = null; + } - /** - * Create a new Call wrapper object. - * @param Channel $channel The channel to communicate on - * @param string $method The method to call on the remote server - * @param callback $deserialize A callback function to deserialize - * the response - * @param (optional) long $timeout Timeout in microseconds - */ - public function __construct(Channel $channel, $method, $deserialize, $timeout = false) { - if ($timeout) { - $now = Timeval::now(); - $delta = new Timeval($timeout); - $deadline = $now->add($delta); - } else { - $deadline = Timeval::infFuture(); + /** + * @return The metadata sent by the server. + */ + public function getMetadata() + { + return $this->metadata; } - $this->call = new Call($channel, $method, $deadline); - $this->deserialize = $deserialize; - $this->metadata = null; - } - /** - * @return The metadata sent by the server. - */ - public function getMetadata() { - return $this->metadata; - } + /** + * @return string The URI of the endpoint. + */ + public function getPeer() + { + return $this->call->getPeer(); + } - /** - * @return string The URI of the endpoint. - */ - public function getPeer() { - return $this->call->getPeer(); - } + /** + * Cancels the call. + */ + public function cancel() + { + $this->call->cancel(); + } - /** - * Cancels the call - */ - public function cancel() { - $this->call->cancel(); - } + /** + * Deserialize a response value to an object. + * + * @param string $value The binary value to deserialize + * + * @return The deserialized value + */ + protected function deserializeResponse($value) + { + if ($value === null) { + return; + } - /** - * Deserialize a response value to an object. - * @param string $value The binary value to deserialize - * @return The deserialized value - */ - protected function deserializeResponse($value) { - if ($value === null) { - return null; + return call_user_func($this->deserialize, $value); } - return call_user_func($this->deserialize, $value); - } } |