Merge pull request #316 from murgatroid99/master

Updated PHP library to handle generated code without explicit references to grpc
pull/317/head
Tim Emiola 10 years ago
commit 7448d3d69e
  1. 30
      src/php/lib/Grpc/BaseStub.php
  2. 2
      src/php/tests/interop/empty.php
  3. 11
      src/php/tests/interop/interop_client.php
  4. 2
      src/php/tests/interop/messages.php
  5. 28
      src/php/tests/interop/test.php

@ -33,10 +33,10 @@ class BaseStub {
* @param array $metadata A metadata map to send to the server * @param array $metadata A metadata map to send to the server
* @return SimpleSurfaceActiveCall The active call object * @return SimpleSurfaceActiveCall The active call object
*/ */
protected function _simpleRequest($method, public function _simpleRequest($method,
$argument, $argument,
callable $deserialize, callable $deserialize,
$metadata = array()) { $metadata = array()) {
return new SimpleSurfaceActiveCall($this->channel, return new SimpleSurfaceActiveCall($this->channel,
$method, $method,
$deserialize, $deserialize,
@ -55,10 +55,10 @@ class BaseStub {
* @param array $metadata A metadata map to send to the server * @param array $metadata A metadata map to send to the server
* @return ClientStreamingSurfaceActiveCall The active call object * @return ClientStreamingSurfaceActiveCall The active call object
*/ */
protected function _clientStreamRequest($method, public function _clientStreamRequest($method,
$arguments, $arguments,
callable $deserialize, callable $deserialize,
$metadata = array()) { $metadata = array()) {
return new ClientStreamingSurfaceActiveCall($this->channel, return new ClientStreamingSurfaceActiveCall($this->channel,
$method, $method,
$deserialize, $deserialize,
@ -76,10 +76,10 @@ class BaseStub {
* @param array $metadata A metadata map to send to the server * @param array $metadata A metadata map to send to the server
* @return ServerStreamingSurfaceActiveCall The active call object * @return ServerStreamingSurfaceActiveCall The active call object
*/ */
protected function _serverStreamRequest($method, public function _serverStreamRequest($method,
$argument, $argument,
callable $deserialize, callable $deserialize,
$metadata = array()) { $metadata = array()) {
return new ServerStreamingSurfaceActiveCall($this->channel, return new ServerStreamingSurfaceActiveCall($this->channel,
$method, $method,
$deserialize, $deserialize,
@ -95,9 +95,9 @@ class BaseStub {
* @param array $metadata A metadata map to send to the server * @param array $metadata A metadata map to send to the server
* @return BidiStreamingSurfaceActiveCall The active call object * @return BidiStreamingSurfaceActiveCall The active call object
*/ */
protected function _bidiRequest($method, public function _bidiRequest($method,
callable $deserialize, callable $deserialize,
$metadata = array()) { $metadata = array()) {
return new BidiStreamingSurfaceActiveCall($this->channel, return new BidiStreamingSurfaceActiveCall($this->channel,
$method, $method,
$deserialize, $deserialize,

@ -1,7 +1,7 @@
<?php <?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0 // DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: test/cpp/interop/empty.proto // Source: test/cpp/interop/empty.proto
// Date: 2015-01-30 21:44:54 // Date: 2015-01-30 23:30:46
namespace grpc\testing { namespace grpc\testing {

@ -161,11 +161,12 @@ $server_address = $args['server_host'] . ':' . $args['server_port'];
$credentials = Grpc\Credentials::createSsl( $credentials = Grpc\Credentials::createSsl(
file_get_contents(dirname(__FILE__) . '/../data/ca.pem')); file_get_contents(dirname(__FILE__) . '/../data/ca.pem'));
$stub = new grpc\testing\TestServiceClient( $stub = new grpc\testing\TestServiceClient(
$server_address, new Grpc\BaseStub(
[ $server_address,
'grpc.ssl_target_name_override' => 'foo.test.google.com', [
'credentials' => $credentials 'grpc.ssl_target_name_override' => 'foo.test.google.com',
]); 'credentials' => $credentials
]));
echo "Connecting to $server_address\n"; echo "Connecting to $server_address\n";
echo "Running test case $args[test_case]\n"; echo "Running test case $args[test_case]\n";

@ -1,7 +1,7 @@
<?php <?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0 // DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: test/cpp/interop/messages.proto // Source: test/cpp/interop/messages.proto
// Date: 2015-01-30 21:44:54 // Date: 2015-01-30 23:30:46
namespace grpc\testing { namespace grpc\testing {

@ -1,52 +1,52 @@
<?php <?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0 // DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: test/cpp/interop/test.proto // Source: test/cpp/interop/test.proto
// Date: 2015-01-30 21:44:54 // Date: 2015-01-30 23:30:46
namespace grpc\testing { namespace grpc\testing {
class TestServiceClient extends \Grpc\BaseStub { class TestServiceClient{
private $rpc_impl;
public function __construct($rpc_impl) {
$this->rpc_impl = $rpc_impl;
}
/** /**
* @param grpc\testing\EmptyMessage $input * @param grpc\testing\EmptyMessage $input
* @return grpc\testing\EmptyMessage
*/ */
public function EmptyCall(\grpc\testing\EmptyMessage $argument, $metadata = array()) { public function EmptyCall(\grpc\testing\EmptyMessage $argument, $metadata = array()) {
return $this->_simpleRequest('/grpc.testing.TestService/EmptyCall', $argument, '\grpc\testing\EmptyMessage::deserialize', $metadata); return $this->rpc_impl->_simpleRequest('/grpc.testing.TestService/EmptyCall', $argument, '\grpc\testing\EmptyMessage::deserialize', $metadata);
} }
/** /**
* @param grpc\testing\SimpleRequest $input * @param grpc\testing\SimpleRequest $input
* @return grpc\testing\SimpleResponse
*/ */
public function UnaryCall(\grpc\testing\SimpleRequest $argument, $metadata = array()) { public function UnaryCall(\grpc\testing\SimpleRequest $argument, $metadata = array()) {
return $this->_simpleRequest('/grpc.testing.TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata); return $this->rpc_impl->_simpleRequest('/grpc.testing.TestService/UnaryCall', $argument, '\grpc\testing\SimpleResponse::deserialize', $metadata);
} }
/** /**
* @param grpc\testing\StreamingOutputCallRequest $input * @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/ */
public function StreamingOutputCall($argument, $metadata = array()) { public function StreamingOutputCall($argument, $metadata = array()) {
return $this->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); return $this->rpc_impl->_serverStreamRequest('/grpc.testing.TestService/StreamingOutputCall', $argument, '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
} }
/** /**
* @param grpc\testing\StreamingInputCallRequest $input * @param grpc\testing\StreamingInputCallRequest $input
* @return grpc\testing\StreamingInputCallResponse
*/ */
public function StreamingInputCall($arguments, $metadata = array()) { public function StreamingInputCall($arguments, $metadata = array()) {
return $this->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata); return $this->rpc_impl->_clientStreamRequest('/grpc.testing.TestService/StreamingInputCall', $arguments, '\grpc\testing\StreamingInputCallResponse::deserialize', $metadata);
} }
/** /**
* @param grpc\testing\StreamingOutputCallRequest $input * @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/ */
public function FullDuplexCall($metadata = array()) { public function FullDuplexCall($metadata = array()) {
return $this->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); return $this->rpc_impl->_bidiRequest('/grpc.testing.TestService/FullDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
} }
/** /**
* @param grpc\testing\StreamingOutputCallRequest $input * @param grpc\testing\StreamingOutputCallRequest $input
* @return grpc\testing\StreamingOutputCallResponse
*/ */
public function HalfDuplexCall($metadata = array()) { public function HalfDuplexCall($metadata = array()) {
return $this->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata); return $this->rpc_impl->_bidiRequest('/grpc.testing.TestService/HalfDuplexCall', '\grpc\testing\StreamingOutputCallResponse::deserialize', $metadata);
} }
} }
} }

Loading…
Cancel
Save