Skip to content
Snippets Groups Projects
Commit 9a669b64 authored by thinkerou's avatar thinkerou
Browse files

update php style

parent 2a15a313
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
namespace Grpc; namespace Grpc;
/** /**
* Class AbstractCall * Class AbstractCall.
* @package Grpc * @package Grpc
*/ */
abstract class AbstractCall abstract class AbstractCall
...@@ -121,13 +121,14 @@ abstract class AbstractCall ...@@ -121,13 +121,14 @@ abstract class AbstractCall
} }
/** /**
* Serialize a message to the protobuf binary format * Serialize a message to the protobuf binary format.
* *
* @param mixed $data The Protobuf message * @param mixed $data The Protobuf message
* *
* @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')) {
return $data->encode(); return $data->encode();
...@@ -155,6 +156,7 @@ abstract class AbstractCall ...@@ -155,6 +156,7 @@ abstract class AbstractCall
list($className, $deserializeFunc) = $this->deserialize; list($className, $deserializeFunc) = $this->deserialize;
$obj = new $className(); $obj = new $className();
$obj->$deserializeFunc($value); $obj->$deserializeFunc($value);
return $obj; return $obj;
} }
......
...@@ -94,7 +94,7 @@ class CallTest extends PHPUnit_Framework_TestCase ...@@ -94,7 +94,7 @@ class CallTest extends PHPUnit_Framework_TestCase
$batch = [ $batch = [
Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1'], Grpc\OP_SEND_INITIAL_METADATA => ['key1' => ['value1'],
'key2' => ['value2', 'key2' => ['value2',
'value3'], ], 'value3', ], ],
]; ];
$result = $this->call->startBatch($batch); $result = $this->call->startBatch($batch);
$this->assertTrue($result->send_metadata); $this->assertTrue($result->send_metadata);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment