aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src/Google/Protobuf/Internal/Message.php
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-03-08 14:31:34 -0800
committerGravatar GitHub <noreply@github.com>2017-03-08 14:31:34 -0800
commitdd8d5f57d7068080283c2c03af01d806efbe6cf4 (patch)
treecbb2cb26804889ddfe61094044faaa6be4a47a12 /php/src/Google/Protobuf/Internal/Message.php
parent2b7430d96aeff2bb624c8d52182ff5e4b9f7f18a (diff)
Rename encode/decode to serializeToString/mergeFromString (#2795)
This better shows the semantic of the API. For already setted fields, mergeFromString do replacement for singular fields and appending for repeated fields.
Diffstat (limited to 'php/src/Google/Protobuf/Internal/Message.php')
-rw-r--r--php/src/Google/Protobuf/Internal/Message.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php
index 17ef8536..ca4fde02 100644
--- a/php/src/Google/Protobuf/Internal/Message.php
+++ b/php/src/Google/Protobuf/Internal/Message.php
@@ -562,12 +562,14 @@ class Message
* Parses a protocol buffer contained in a string.
*
* This function takes a string in the (non-human-readable) binary wire
- * format, matching the encoding output by encode().
+ * format, matching the encoding output by serializeToString().
+ * See mergeFrom() for merging behavior, if the field is already set in the
+ * specified message.
*
* @param string $data Binary protobuf data.
* @return bool Return true on success.
*/
- public function decode($data)
+ public function mergeFromString($data)
{
$input = new InputStream($data);
$this->parseFromStream($input);
@@ -714,7 +716,7 @@ class Message
* Serialize the message to string.
* @return string Serialized binary protobuf data.
*/
- public function encode()
+ public function serializeToString()
{
$output = new OutputStream($this->byteSize());
$this->serializeToStream($output);