181 行
4.0 KiB
PHP
181 行
4.0 KiB
PHP
<?php
|
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
# source: demo1/proto/user.proto
|
|
|
|
namespace Proto;
|
|
|
|
use Google\Protobuf\Internal\GPBType;
|
|
use Google\Protobuf\Internal\RepeatedField;
|
|
use Google\Protobuf\Internal\GPBUtil;
|
|
|
|
/**
|
|
* 定义 Response 消息, 包含 code, msg, data 三个字段
|
|
* 其中 data 字段使用 oneof 关键字, 表示 data 字段只能有一个字段被赋值
|
|
*
|
|
* Generated from protobuf message <code>proto.Response</code>
|
|
*/
|
|
class Response extends \Google\Protobuf\Internal\Message
|
|
{
|
|
/**
|
|
* Generated from protobuf field <code>int32 code = 1;</code>
|
|
*/
|
|
protected $code = 0;
|
|
/**
|
|
* Generated from protobuf field <code>string msg = 2;</code>
|
|
*/
|
|
protected $msg = '';
|
|
/**
|
|
* Generated from protobuf field <code>map<string, string> info = 5;</code>
|
|
*/
|
|
private $info;
|
|
protected $data;
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param array $data {
|
|
* Optional. Data for populating the Message object.
|
|
*
|
|
* @type int $code
|
|
* @type string $msg
|
|
* @type string $token
|
|
* @type string $message
|
|
* @type array|\Google\Protobuf\Internal\MapField $info
|
|
* }
|
|
*/
|
|
public function __construct($data = NULL) {
|
|
\GPBMetadata\Demo1\Proto\User::initOnce();
|
|
parent::__construct($data);
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>int32 code = 1;</code>
|
|
* @return int
|
|
*/
|
|
public function getCode()
|
|
{
|
|
return $this->code;
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>int32 code = 1;</code>
|
|
* @param int $var
|
|
* @return $this
|
|
*/
|
|
public function setCode($var)
|
|
{
|
|
GPBUtil::checkInt32($var);
|
|
$this->code = $var;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>string msg = 2;</code>
|
|
* @return string
|
|
*/
|
|
public function getMsg()
|
|
{
|
|
return $this->msg;
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>string msg = 2;</code>
|
|
* @param string $var
|
|
* @return $this
|
|
*/
|
|
public function setMsg($var)
|
|
{
|
|
GPBUtil::checkString($var, True);
|
|
$this->msg = $var;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>string token = 3;</code>
|
|
* @return string
|
|
*/
|
|
public function getToken()
|
|
{
|
|
return $this->readOneof(3);
|
|
}
|
|
|
|
public function hasToken()
|
|
{
|
|
return $this->hasOneof(3);
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>string token = 3;</code>
|
|
* @param string $var
|
|
* @return $this
|
|
*/
|
|
public function setToken($var)
|
|
{
|
|
GPBUtil::checkString($var, True);
|
|
$this->writeOneof(3, $var);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>string message = 4;</code>
|
|
* @return string
|
|
*/
|
|
public function getMessage()
|
|
{
|
|
return $this->readOneof(4);
|
|
}
|
|
|
|
public function hasMessage()
|
|
{
|
|
return $this->hasOneof(4);
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>string message = 4;</code>
|
|
* @param string $var
|
|
* @return $this
|
|
*/
|
|
public function setMessage($var)
|
|
{
|
|
GPBUtil::checkString($var, True);
|
|
$this->writeOneof(4, $var);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>map<string, string> info = 5;</code>
|
|
* @return \Google\Protobuf\Internal\MapField
|
|
*/
|
|
public function getInfo()
|
|
{
|
|
return $this->info;
|
|
}
|
|
|
|
/**
|
|
* Generated from protobuf field <code>map<string, string> info = 5;</code>
|
|
* @param array|\Google\Protobuf\Internal\MapField $var
|
|
* @return $this
|
|
*/
|
|
public function setInfo($var)
|
|
{
|
|
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
|
|
$this->info = $arr;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getData()
|
|
{
|
|
return $this->whichOneof("data");
|
|
}
|
|
|
|
}
|
|
|