Commit 77f64bb7 authored by Paul Yang's avatar Paul Yang Committed by GitHub

Add well known types to php runtime. (#3697)

* Add well known types to php runtime.

* Fix php7.0 tests

* No longer generate empty.proto in test as it has been included in
runtime.

* Fix zts build

* Clean code

* Rename g_p_b_empty to empty.

* Don't generate code for empty.proto in compatibility test

* Fix 32-bit

* Fix mac build

* Fix Makefile.am to add new files
parent cd5f49d0
This diff is collapsed.
This diff is collapsed.
......@@ -256,9 +256,37 @@ static PHP_MINIT_FUNCTION(protobuf) {
repeated_field_init(TSRMLS_C);
repeated_field_iter_init(TSRMLS_C);
util_init(TSRMLS_C);
any_init(TSRMLS_C);
api_init(TSRMLS_C);
bool_value_init(TSRMLS_C);
bytes_value_init(TSRMLS_C);
double_value_init(TSRMLS_C);
duration_init(TSRMLS_C);
enum_init(TSRMLS_C);
enum_value_init(TSRMLS_C);
field_cardinality_init(TSRMLS_C);
field_init(TSRMLS_C);
field_kind_init(TSRMLS_C);
field_mask_init(TSRMLS_C);
float_value_init(TSRMLS_C);
empty_init(TSRMLS_C);
int32_value_init(TSRMLS_C);
int64_value_init(TSRMLS_C);
list_value_init(TSRMLS_C);
method_init(TSRMLS_C);
mixin_init(TSRMLS_C);
null_value_init(TSRMLS_C);
option_init(TSRMLS_C);
source_context_init(TSRMLS_C);
string_value_init(TSRMLS_C);
struct_init(TSRMLS_C);
syntax_init(TSRMLS_C);
timestamp_init(TSRMLS_C);
type_init(TSRMLS_C);
u_int32_value_init(TSRMLS_C);
u_int64_value_init(TSRMLS_C);
value_init(TSRMLS_C);
return 0;
}
......
This diff is collapsed.
......@@ -856,12 +856,41 @@ void layout_set(MessageLayout* layout, MessageHeader* header,
zval* property_ptr = CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory);
if (EXPECTED(property_ptr != val)) {
zend_class_entry *subce = NULL;
zval converted_value;
if (upb_fielddef_ismap(field)) {
const upb_msgdef* mapmsg = upb_fielddef_msgsubdef(field);
const upb_fielddef* keyfield = upb_msgdef_ntof(mapmsg, "key", 3);
const upb_fielddef* valuefield = upb_msgdef_ntof(mapmsg, "value", 5);
if (upb_fielddef_descriptortype(valuefield) ==
UPB_DESCRIPTOR_TYPE_MESSAGE) {
const upb_msgdef* submsg = upb_fielddef_msgsubdef(valuefield);
Descriptor* subdesc =
UNBOX_HASHTABLE_VALUE(Descriptor, get_def_obj(submsg));
subce = subdesc->klass;
}
check_map_field(subce, upb_fielddef_descriptortype(keyfield),
upb_fielddef_descriptortype(valuefield), val,
&converted_value);
} else {
if (upb_fielddef_type(field) == UPB_TYPE_MESSAGE) {
const upb_msgdef* submsg = upb_fielddef_msgsubdef(field);
Descriptor* subdesc =
UNBOX_HASHTABLE_VALUE(Descriptor, get_def_obj(submsg));
subce = subdesc->klass;
}
check_repeated_field(subce, upb_fielddef_descriptortype(field), val,
&converted_value);
}
#if PHP_MAJOR_VERSION < 7
REPLACE_ZVAL_VALUE((zval**)memory, val, 1);
REPLACE_ZVAL_VALUE((zval**)memory, &converted_value, 1);
#else
php_proto_zval_ptr_dtor(property_ptr);
ZVAL_ZVAL(property_ptr, val, 1, 0);
php_proto_zval_ptr_dtor(property_ptr);
ZVAL_ZVAL(property_ptr, &converted_value, 1, 0);
#endif
zval_dtor(&converted_value);
}
} else {
upb_fieldtype_t type = upb_fielddef_type(field);
......
......@@ -428,21 +428,15 @@ PHP_METHOD(Util, checkMessage) {
RETURN_ZVAL(val, 1, 0);
}
PHP_METHOD(Util, checkRepeatedField) {
zval* val;
PHP_PROTO_LONG type;
const zend_class_entry* klass = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|C", &val, &type,
&klass) == FAILURE) {
return;
}
void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type,
zval* val, zval* return_value) {
#if PHP_MAJOR_VERSION >= 7
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
#endif
TSRMLS_FETCH();
if (Z_TYPE_P(val) == IS_ARRAY) {
HashTable* table = HASH_OF(val);
HashPosition pointer;
......@@ -492,24 +486,28 @@ PHP_METHOD(Util, checkRepeatedField) {
zend_error(E_USER_ERROR, "Incorrect repeated field type.");
return;
}
}
PHP_METHOD(Util, checkMapField) {
PHP_METHOD(Util, checkRepeatedField) {
zval* val;
PHP_PROTO_LONG key_type, value_type;
PHP_PROTO_LONG type;
const zend_class_entry* klass = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll|C", &val, &key_type,
&value_type, &klass) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|C", &val, &type,
&klass) == FAILURE) {
return;
}
RETURN_ZVAL(val, 1, 0);
}
void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type,
PHP_PROTO_LONG value_type, zval* val, zval* return_value) {
#if PHP_MAJOR_VERSION >= 7
if (Z_ISREF_P(val)) {
ZVAL_DEREF(val);
}
#endif
TSRMLS_FETCH();
if (Z_TYPE_P(val) == IS_ARRAY) {
HashTable* table = Z_ARRVAL_P(val);
HashPosition pointer;
......@@ -565,3 +563,14 @@ PHP_METHOD(Util, checkMapField) {
return;
}
}
PHP_METHOD(Util, checkMapField) {
zval* val;
PHP_PROTO_LONG key_type, value_type;
const zend_class_entry* klass = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll|C", &val, &key_type,
&value_type, &klass) == FAILURE) {
return;
}
RETURN_ZVAL(val, 1, 0);
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/api.proto
namespace GPBMetadata\Google\Protobuf;
class Api
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\Google\Protobuf\SourceContext::initOnce();
\GPBMetadata\Google\Protobuf\Type::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0ac8050a19676f6f676c652f70726f746f6275662f6170692e70726f746f" .
"120f676f6f676c652e70726f746f6275661a1a676f6f676c652f70726f74" .
"6f6275662f747970652e70726f746f2281020a03417069120c0a046e616d" .
"6518012001280912280a076d6574686f647318022003280b32172e676f6f" .
"676c652e70726f746f6275662e4d6574686f6412280a076f7074696f6e73" .
"18032003280b32172e676f6f676c652e70726f746f6275662e4f7074696f" .
"6e120f0a0776657273696f6e18042001280912360a0e736f757263655f63" .
"6f6e7465787418052001280b321e2e676f6f676c652e70726f746f627566" .
"2e536f75726365436f6e7465787412260a066d6978696e7318062003280b" .
"32162e676f6f676c652e70726f746f6275662e4d6978696e12270a067379" .
"6e74617818072001280e32172e676f6f676c652e70726f746f6275662e53" .
"796e74617822d5010a064d6574686f64120c0a046e616d65180120012809" .
"12180a10726571756573745f747970655f75726c18022001280912190a11" .
"726571756573745f73747265616d696e6718032001280812190a11726573" .
"706f6e73655f747970655f75726c180420012809121a0a12726573706f6e" .
"73655f73747265616d696e6718052001280812280a076f7074696f6e7318" .
"062003280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e" .
"12270a0673796e74617818072001280e32172e676f6f676c652e70726f74" .
"6f6275662e53796e74617822230a054d6978696e120c0a046e616d651801" .
"20012809120c0a04726f6f7418022001280942750a13636f6d2e676f6f67" .
"6c652e70726f746f627566420841706950726f746f50015a2b676f6f676c" .
"652e676f6c616e672e6f72672f67656e70726f746f2f70726f746f627566" .
"2f6170693b617069a20203475042aa021e476f6f676c652e50726f746f62" .
"75662e57656c6c4b6e6f776e5479706573620670726f746f33"
));
static::$is_initialized = true;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/field_mask.proto
namespace GPBMetadata\Google\Protobuf;
class FieldMask
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0ae3010a20676f6f676c652f70726f746f6275662f6669656c645f6d6173" .
"6b2e70726f746f120f676f6f676c652e70726f746f627566221a0a094669" .
"656c644d61736b120d0a0570617468731801200328094289010a13636f6d" .
"2e676f6f676c652e70726f746f627566420e4669656c644d61736b50726f" .
"746f50015a39676f6f676c652e676f6c616e672e6f72672f67656e70726f" .
"746f2f70726f746f6275662f6669656c645f6d61736b3b6669656c645f6d" .
"61736ba20203475042aa021e476f6f676c652e50726f746f6275662e5765" .
"6c6c4b6e6f776e5479706573620670726f746f33"
));
static::$is_initialized = true;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/empty.proto
namespace GPBMetadata\Google\Protobuf;
class GPBEmpty
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0ab7010a1b676f6f676c652f70726f746f6275662f656d7074792e70726f" .
"746f120f676f6f676c652e70726f746f62756622070a05456d7074794276" .
"0a13636f6d2e676f6f676c652e70726f746f627566420a456d7074795072" .
"6f746f50015a276769746875622e636f6d2f676f6c616e672f70726f746f" .
"6275662f7074797065732f656d707479f80101a20203475042aa021e476f" .
"6f676c652e50726f746f6275662e57656c6c4b6e6f776e54797065736206" .
"70726f746f33"
));
static::$is_initialized = true;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/source_context.proto
namespace GPBMetadata\Google\Protobuf;
class SourceContext
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0afb010a24676f6f676c652f70726f746f6275662f736f757263655f636f" .
"6e746578742e70726f746f120f676f6f676c652e70726f746f6275662222" .
"0a0d536f75726365436f6e7465787412110a0966696c655f6e616d651801" .
"200128094295010a13636f6d2e676f6f676c652e70726f746f6275664212" .
"536f75726365436f6e7465787450726f746f50015a41676f6f676c652e67" .
"6f6c616e672e6f72672f67656e70726f746f2f70726f746f6275662f736f" .
"757263655f636f6e746578743b736f757263655f636f6e74657874a20203" .
"475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f77" .
"6e5479706573620670726f746f33"
));
static::$is_initialized = true;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/struct.proto
namespace GPBMetadata\Google\Protobuf;
class Struct
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0a81050a1c676f6f676c652f70726f746f6275662f7374727563742e7072" .
"6f746f120f676f6f676c652e70726f746f6275662284010a065374727563" .
"7412330a066669656c647318012003280b32232e676f6f676c652e70726f" .
"746f6275662e5374727563742e4669656c6473456e7472791a450a0b4669" .
"656c6473456e747279120b0a036b657918012001280912250a0576616c75" .
"6518022001280b32162e676f6f676c652e70726f746f6275662e56616c75" .
"653a02380122ea010a0556616c756512300a0a6e756c6c5f76616c756518" .
"012001280e321a2e676f6f676c652e70726f746f6275662e4e756c6c5661" .
"6c7565480012160a0c6e756d6265725f76616c7565180220012801480012" .
"160a0c737472696e675f76616c7565180320012809480012140a0a626f6f" .
"6c5f76616c75651804200128084800122f0a0c7374727563745f76616c75" .
"6518052001280b32172e676f6f676c652e70726f746f6275662e53747275" .
"6374480012300a0a6c6973745f76616c756518062001280b321a2e676f6f" .
"676c652e70726f746f6275662e4c69737456616c7565480042060a046b69" .
"6e6422330a094c69737456616c756512260a0676616c7565731801200328" .
"0b32162e676f6f676c652e70726f746f6275662e56616c75652a1b0a094e" .
"756c6c56616c7565120e0a0a4e554c4c5f56414c554510004281010a1363" .
"6f6d2e676f6f676c652e70726f746f627566420b53747275637450726f74" .
"6f50015a316769746875622e636f6d2f676f6c616e672f70726f746f6275" .
"662f7074797065732f7374727563743b7374727563747062f80101a20203" .
"475042aa021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f77" .
"6e5479706573620670726f746f33"
));
static::$is_initialized = true;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace GPBMetadata\Google\Protobuf;
class Type
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\Google\Protobuf\Any::initOnce();
\GPBMetadata\Google\Protobuf\SourceContext::initOnce();
$pool->internalAddGeneratedFile(hex2bin(
"0a9f0c0a1a676f6f676c652f70726f746f6275662f747970652e70726f74" .
"6f120f676f6f676c652e70726f746f6275661a24676f6f676c652f70726f" .
"746f6275662f736f757263655f636f6e746578742e70726f746f22d7010a" .
"0454797065120c0a046e616d6518012001280912260a066669656c647318" .
"022003280b32162e676f6f676c652e70726f746f6275662e4669656c6412" .
"0e0a066f6e656f667318032003280912280a076f7074696f6e7318042003" .
"280b32172e676f6f676c652e70726f746f6275662e4f7074696f6e12360a" .
"0e736f757263655f636f6e7465787418052001280b321e2e676f6f676c65" .
"2e70726f746f6275662e536f75726365436f6e7465787412270a0673796e" .
"74617818062001280e32172e676f6f676c652e70726f746f6275662e5379" .
"6e74617822d5050a054669656c6412290a046b696e6418012001280e321b" .
"2e676f6f676c652e70726f746f6275662e4669656c642e4b696e6412370a" .
"0b63617264696e616c69747918022001280e32222e676f6f676c652e7072" .
"6f746f6275662e4669656c642e43617264696e616c697479120e0a066e75" .
"6d626572180320012805120c0a046e616d6518042001280912100a087479" .
"70655f75726c18062001280912130a0b6f6e656f665f696e646578180720" .
"012805120e0a067061636b656418082001280812280a076f7074696f6e73" .
"18092003280b32172e676f6f676c652e70726f746f6275662e4f7074696f" .
"6e12110a096a736f6e5f6e616d65180a2001280912150a0d64656661756c" .
"745f76616c7565180b2001280922c8020a044b696e6412100a0c54595045" .
"5f554e4b4e4f574e1000120f0a0b545950455f444f55424c451001120e0a" .
"0a545950455f464c4f41541002120e0a0a545950455f494e543634100312" .
"0f0a0b545950455f55494e5436341004120e0a0a545950455f494e543332" .
"100512100a0c545950455f46495845443634100612100a0c545950455f46" .
"4958454433321007120d0a09545950455f424f4f4c1008120f0a0b545950" .
"455f535452494e471009120e0a0a545950455f47524f5550100a12100a0c" .
"545950455f4d455353414745100b120e0a0a545950455f4259544553100c" .
"120f0a0b545950455f55494e543332100d120d0a09545950455f454e554d" .
"100e12110a0d545950455f5346495845443332100f12110a0d545950455f" .
"53464958454436341010120f0a0b545950455f53494e5433321011120f0a" .
"0b545950455f53494e543634101222740a0b43617264696e616c69747912" .
"170a1343415244494e414c4954595f554e4b4e4f574e100012180a144341" .
"5244494e414c4954595f4f5054494f4e414c100112180a1443415244494e" .
"414c4954595f5245515549524544100212180a1443415244494e414c4954" .
"595f5245504541544544100322ce010a04456e756d120c0a046e616d6518" .
"0120012809122d0a09656e756d76616c756518022003280b321a2e676f6f" .
"676c652e70726f746f6275662e456e756d56616c756512280a076f707469" .
"6f6e7318032003280b32172e676f6f676c652e70726f746f6275662e4f70" .
"74696f6e12360a0e736f757263655f636f6e7465787418042001280b321e" .
"2e676f6f676c652e70726f746f6275662e536f75726365436f6e74657874" .
"12270a0673796e74617818052001280e32172e676f6f676c652e70726f74" .
"6f6275662e53796e74617822530a09456e756d56616c7565120c0a046e61" .
"6d65180120012809120e0a066e756d62657218022001280512280a076f70" .
"74696f6e7318032003280b32172e676f6f676c652e70726f746f6275662e" .
"4f7074696f6e223b0a064f7074696f6e120c0a046e616d65180120012809" .
"12230a0576616c756518022001280b32142e676f6f676c652e70726f746f" .
"6275662e416e792a2e0a0653796e74617812110a0d53594e5441585f5052" .
"4f544f32100012110a0d53594e5441585f50524f544f331001427d0a1363" .
"6f6d2e676f6f676c652e70726f746f62756642095479706550726f746f50" .
"015a2f676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f" .
"70726f746f6275662f70747970653b7074797065f80101a20203475042aa" .
"021e476f6f676c652e50726f746f6275662e57656c6c4b6e6f776e547970" .
"6573620670726f746f33"
));
static::$is_initialized = true;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace GPBMetadata\Google\Protobuf;
class Wrappers
{
public static $is_initialized = false;
public static function initOnce() {
$pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
$pool->internalAddGeneratedFile(hex2bin(
"0abf030a1e676f6f676c652f70726f746f6275662f77726170706572732e" .
"70726f746f120f676f6f676c652e70726f746f627566221c0a0b446f7562" .
"6c6556616c7565120d0a0576616c7565180120012801221b0a0a466c6f61" .
"7456616c7565120d0a0576616c7565180120012802221b0a0a496e743634" .
"56616c7565120d0a0576616c7565180120012803221c0a0b55496e743634" .
"56616c7565120d0a0576616c7565180120012804221b0a0a496e74333256" .
"616c7565120d0a0576616c7565180120012805221c0a0b55496e74333256" .
"616c7565120d0a0576616c756518012001280d221a0a09426f6f6c56616c" .
"7565120d0a0576616c7565180120012808221c0a0b537472696e6756616c" .
"7565120d0a0576616c7565180120012809221b0a0a427974657356616c75" .
"65120d0a0576616c756518012001280c427c0a13636f6d2e676f6f676c65" .
"2e70726f746f627566420d577261707065727350726f746f50015a2a6769" .
"746875622e636f6d2f676f6c616e672f70726f746f6275662f7074797065" .
"732f7772617070657273f80101a20203475042aa021e476f6f676c652e50" .
"726f746f6275662e57656c6c4b6e6f776e5479706573620670726f746f33"
));
static::$is_initialized = true;
}
}
This diff is collapsed.
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Wrapper message for `bool`.
* The JSON representation for `BoolValue` is JSON `true` and `false`.
*
* Generated from protobuf message <code>google.protobuf.BoolValue</code>
*/
class BoolValue extends \Google\Protobuf\Internal\Message
{
/**
* The bool value.
*
* Generated from protobuf field <code>bool value = 1;</code>
*/
private $value = false;
public function __construct() {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
parent::__construct();
}
/**
* The bool value.
*
* Generated from protobuf field <code>bool value = 1;</code>
* @return bool
*/
public function getValue()
{
return $this->value;
}
/**
* The bool value.
*
* Generated from protobuf field <code>bool value = 1;</code>
* @param bool $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkBool($var);
$this->value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Wrapper message for `bytes`.
* The JSON representation for `BytesValue` is JSON string.
*
* Generated from protobuf message <code>google.protobuf.BytesValue</code>
*/
class BytesValue extends \Google\Protobuf\Internal\Message
{
/**
* The bytes value.
*
* Generated from protobuf field <code>bytes value = 1;</code>
*/
private $value = '';
public function __construct() {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
parent::__construct();
}
/**
* The bytes value.
*
* Generated from protobuf field <code>bytes value = 1;</code>
* @return string
*/
public function getValue()
{
return $this->value;
}
/**
* The bytes value.
*
* Generated from protobuf field <code>bytes value = 1;</code>
* @param string $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkString($var, False);
$this->value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Wrapper message for `double`.
* The JSON representation for `DoubleValue` is JSON number.
*
* Generated from protobuf message <code>google.protobuf.DoubleValue</code>
*/
class DoubleValue extends \Google\Protobuf\Internal\Message
{
/**
* The double value.
*
* Generated from protobuf field <code>double value = 1;</code>
*/
private $value = 0.0;
public function __construct() {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
parent::__construct();
}
/**
* The double value.
*
* Generated from protobuf field <code>double value = 1;</code>
* @return float
*/
public function getValue()
{
return $this->value;
}
/**
* The double value.
*
* Generated from protobuf field <code>double value = 1;</code>
* @param float $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkDouble($var);
$this->value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Enum type definition.
*
* Generated from protobuf message <code>google.protobuf.Enum</code>
*/
class Enum extends \Google\Protobuf\Internal\Message
{
/**
* Enum type name.
*
* Generated from protobuf field <code>string name = 1;</code>
*/
private $name = '';
/**
* Enum value definitions.
*
* Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
*/
private $enumvalue;
/**
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
*/
private $options;
/**
* The source context.
*
* Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
*/
private $source_context = null;
/**
* The source syntax.
*
* Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
*/
private $syntax = 0;
public function __construct() {
\GPBMetadata\Google\Protobuf\Type::initOnce();
parent::__construct();
}
/**
* Enum type name.
*
* Generated from protobuf field <code>string name = 1;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Enum type name.
*
* Generated from protobuf field <code>string name = 1;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* Enum value definitions.
*
* Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getEnumvalue()
{
return $this->enumvalue;
}
/**
* Enum value definitions.
*
* Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
* @param \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setEnumvalue($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\EnumValue::class);
$this->enumvalue = $arr;
return $this;
}
/**
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getOptions()
{
return $this->options;
}
/**
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
$this->options = $arr;
return $this;
}
/**
* The source context.
*
* Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
* @return \Google\Protobuf\SourceContext
*/
public function getSourceContext()
{
return $this->source_context;
}
/**
* The source context.
*
* Generated from protobuf field <code>.google.protobuf.SourceContext source_context = 4;</code>
* @param \Google\Protobuf\SourceContext $var
* @return $this
*/
public function setSourceContext($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\SourceContext::class);
$this->source_context = $var;
return $this;
}
/**
* The source syntax.
*
* Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
* @return int
*/
public function getSyntax()
{
return $this->syntax;
}
/**
* The source syntax.
*
* Generated from protobuf field <code>.google.protobuf.Syntax syntax = 5;</code>
* @param int $var
* @return $this
*/
public function setSyntax($var)
{
GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class);
$this->syntax = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Enum value definition.
*
* Generated from protobuf message <code>google.protobuf.EnumValue</code>
*/
class EnumValue extends \Google\Protobuf\Internal\Message
{
/**
* Enum value name.
*
* Generated from protobuf field <code>string name = 1;</code>
*/
private $name = '';
/**
* Enum value number.
*
* Generated from protobuf field <code>int32 number = 2;</code>
*/
private $number = 0;
/**
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
*/
private $options;
public function __construct() {
\GPBMetadata\Google\Protobuf\Type::initOnce();
parent::__construct();
}
/**
* Enum value name.
*
* Generated from protobuf field <code>string name = 1;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Enum value name.
*
* Generated from protobuf field <code>string name = 1;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* Enum value number.
*
* Generated from protobuf field <code>int32 number = 2;</code>
* @return int
*/
public function getNumber()
{
return $this->number;
}
/**
* Enum value number.
*
* Generated from protobuf field <code>int32 number = 2;</code>
* @param int $var
* @return $this
*/
public function setNumber($var)
{
GPBUtil::checkInt32($var);
$this->number = $var;
return $this;
}
/**
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getOptions()
{
return $this->options;
}
/**
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
$this->options = $arr;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A single field of a message type.
*
* Generated from protobuf message <code>google.protobuf.Field</code>
*/
class Field extends \Google\Protobuf\Internal\Message
{
/**
* The field type.
*
* Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
*/
private $kind = 0;
/**
* The field cardinality.
*
* Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
*/
private $cardinality = 0;
/**
* The field number.
*
* Generated from protobuf field <code>int32 number = 3;</code>
*/
private $number = 0;
/**
* The field name.
*
* Generated from protobuf field <code>string name = 4;</code>
*/
private $name = '';
/**
* The field type URL, without the scheme, for message or enumeration
* types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
*
* Generated from protobuf field <code>string type_url = 6;</code>
*/
private $type_url = '';
/**
* The index of the field type in `Type.oneofs`, for message or enumeration
* types. The first type has index 1; zero means the type is not in the list.
*
* Generated from protobuf field <code>int32 oneof_index = 7;</code>
*/
private $oneof_index = 0;
/**
* Whether to use alternative packed wire representation.
*
* Generated from protobuf field <code>bool packed = 8;</code>
*/
private $packed = false;
/**
* The protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
*/
private $options;
/**
* The field JSON name.
*
* Generated from protobuf field <code>string json_name = 10;</code>
*/
private $json_name = '';
/**
* The string value of the default value of this field. Proto2 syntax only.
*
* Generated from protobuf field <code>string default_value = 11;</code>
*/
private $default_value = '';
public function __construct() {
\GPBMetadata\Google\Protobuf\Type::initOnce();
parent::__construct();
}
/**
* The field type.
*
* Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
* @return int
*/
public function getKind()
{
return $this->kind;
}
/**
* The field type.
*
* Generated from protobuf field <code>.google.protobuf.Field.Kind kind = 1;</code>
* @param int $var
* @return $this
*/
public function setKind($var)
{
GPBUtil::checkEnum($var, \Google\Protobuf\Field_Kind::class);
$this->kind = $var;
return $this;
}
/**
* The field cardinality.
*
* Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
* @return int
*/
public function getCardinality()
{
return $this->cardinality;
}
/**
* The field cardinality.
*
* Generated from protobuf field <code>.google.protobuf.Field.Cardinality cardinality = 2;</code>
* @param int $var
* @return $this
*/
public function setCardinality($var)
{
GPBUtil::checkEnum($var, \Google\Protobuf\Field_Cardinality::class);
$this->cardinality = $var;
return $this;
}
/**
* The field number.
*
* Generated from protobuf field <code>int32 number = 3;</code>
* @return int
*/
public function getNumber()
{
return $this->number;
}
/**
* The field number.
*
* Generated from protobuf field <code>int32 number = 3;</code>
* @param int $var
* @return $this
*/
public function setNumber($var)
{
GPBUtil::checkInt32($var);
$this->number = $var;
return $this;
}
/**
* The field name.
*
* Generated from protobuf field <code>string name = 4;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The field name.
*
* Generated from protobuf field <code>string name = 4;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The field type URL, without the scheme, for message or enumeration
* types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
*
* Generated from protobuf field <code>string type_url = 6;</code>
* @return string
*/
public function getTypeUrl()
{
return $this->type_url;
}
/**
* The field type URL, without the scheme, for message or enumeration
* types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
*
* Generated from protobuf field <code>string type_url = 6;</code>
* @param string $var
* @return $this
*/
public function setTypeUrl($var)
{
GPBUtil::checkString($var, True);
$this->type_url = $var;
return $this;
}
/**
* The index of the field type in `Type.oneofs`, for message or enumeration
* types. The first type has index 1; zero means the type is not in the list.
*
* Generated from protobuf field <code>int32 oneof_index = 7;</code>
* @return int
*/
public function getOneofIndex()
{
return $this->oneof_index;
}
/**
* The index of the field type in `Type.oneofs`, for message or enumeration
* types. The first type has index 1; zero means the type is not in the list.
*
* Generated from protobuf field <code>int32 oneof_index = 7;</code>
* @param int $var
* @return $this
*/
public function setOneofIndex($var)
{
GPBUtil::checkInt32($var);
$this->oneof_index = $var;
return $this;
}
/**
* Whether to use alternative packed wire representation.
*
* Generated from protobuf field <code>bool packed = 8;</code>
* @return bool
*/
public function getPacked()
{
return $this->packed;
}
/**
* Whether to use alternative packed wire representation.
*
* Generated from protobuf field <code>bool packed = 8;</code>
* @param bool $var
* @return $this
*/
public function setPacked($var)
{
GPBUtil::checkBool($var);
$this->packed = $var;
return $this;
}
/**
* The protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getOptions()
{
return $this->options;
}
/**
* The protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
$this->options = $arr;
return $this;
}
/**
* The field JSON name.
*
* Generated from protobuf field <code>string json_name = 10;</code>
* @return string
*/
public function getJsonName()
{
return $this->json_name;
}
/**
* The field JSON name.
*
* Generated from protobuf field <code>string json_name = 10;</code>
* @param string $var
* @return $this
*/
public function setJsonName($var)
{
GPBUtil::checkString($var, True);
$this->json_name = $var;
return $this;
}
/**
* The string value of the default value of this field. Proto2 syntax only.
*
* Generated from protobuf field <code>string default_value = 11;</code>
* @return string
*/
public function getDefaultValue()
{
return $this->default_value;
}
/**
* The string value of the default value of this field. Proto2 syntax only.
*
* Generated from protobuf field <code>string default_value = 11;</code>
* @param string $var
* @return $this
*/
public function setDefaultValue($var)
{
GPBUtil::checkString($var, True);
$this->default_value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/field_mask.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* `FieldMask` represents a set of symbolic field paths, for example:
* paths: "f.a"
* paths: "f.b.d"
* Here `f` represents a field in some root message, `a` and `b`
* fields in the message found in `f`, and `d` a field found in the
* message in `f.b`.
* Field masks are used to specify a subset of fields that should be
* returned by a get operation or modified by an update operation.
* Field masks also have a custom JSON encoding (see below).
* # Field Masks in Projections
* When used in the context of a projection, a response message or
* sub-message is filtered by the API to only contain those fields as
* specified in the mask. For example, if the mask in the previous
* example is applied to a response message as follows:
* f {
* a : 22
* b {
* d : 1
* x : 2
* }
* y : 13
* }
* z: 8
* The result will not contain specific values for fields x,y and z
* (their value will be set to the default, and omitted in proto text
* output):
* f {
* a : 22
* b {
* d : 1
* }
* }
* A repeated field is not allowed except at the last position of a
* paths string.
* If a FieldMask object is not present in a get operation, the
* operation applies to all fields (as if a FieldMask of all fields
* had been specified).
* Note that a field mask does not necessarily apply to the
* top-level response message. In case of a REST get operation, the
* field mask applies directly to the response, but in case of a REST
* list operation, the mask instead applies to each individual message
* in the returned resource list. In case of a REST custom method,
* other definitions may be used. Where the mask applies will be
* clearly documented together with its declaration in the API. In
* any case, the effect on the returned resource/resources is required
* behavior for APIs.
* # Field Masks in Update Operations
* A field mask in update operations specifies which fields of the
* targeted resource are going to be updated. The API is required
* to only change the values of the fields as specified in the mask
* and leave the others untouched. If a resource is passed in to
* describe the updated values, the API ignores the values of all
* fields not covered by the mask.
* If a repeated field is specified for an update operation, the existing
* repeated values in the target resource will be overwritten by the new values.
* Note that a repeated field is only allowed in the last position of a `paths`
* string.
* If a sub-message is specified in the last position of the field mask for an
* update operation, then the existing sub-message in the target resource is
* overwritten. Given the target message:
* f {
* b {
* d : 1
* x : 2
* }
* c : 1
* }
* And an update message:
* f {
* b {
* d : 10
* }
* }
* then if the field mask is:
* paths: "f.b"
* then the result will be:
* f {
* b {
* d : 10
* }
* c : 1
* }
* However, if the update mask was:
* paths: "f.b.d"
* then the result would be:
* f {
* b {
* d : 10
* x : 2
* }
* c : 1
* }
* In order to reset a field's value to the default, the field must
* be in the mask and set to the default value in the provided resource.
* Hence, in order to reset all fields of a resource, provide a default
* instance of the resource and set all fields in the mask, or do
* not provide a mask as described below.
* If a field mask is not present on update, the operation applies to
* all fields (as if a field mask of all fields has been specified).
* Note that in the presence of schema evolution, this may mean that
* fields the client does not know and has therefore not filled into
* the request will be reset to their default. If this is unwanted
* behavior, a specific service may require a client to always specify
* a field mask, producing an error if not.
* As with get operations, the location of the resource which
* describes the updated values in the request message depends on the
* operation kind. In any case, the effect of the field mask is
* required to be honored by the API.
* ## Considerations for HTTP REST
* The HTTP kind of an update operation which uses a field mask must
* be set to PATCH instead of PUT in order to satisfy HTTP semantics
* (PUT must only be used for full updates).
* # JSON Encoding of Field Masks
* In JSON, a field mask is encoded as a single string where paths are
* separated by a comma. Fields name in each path are converted
* to/from lower-camel naming conventions.
* As an example, consider the following message declarations:
* message Profile {
* User user = 1;
* Photo photo = 2;
* }
* message User {
* string display_name = 1;
* string address = 2;
* }
* In proto a field mask for `Profile` may look as such:
* mask {
* paths: "user.display_name"
* paths: "photo"
* }
* In JSON, the same mask is represented as below:
* {
* mask: "user.displayName,photo"
* }
* # Field Masks and Oneof Fields
* Field masks treat fields in oneofs just as regular fields. Consider the
* following message:
* message SampleMessage {
* oneof test_oneof {
* string name = 4;
* SubMessage sub_message = 9;
* }
* }
* The field mask can be:
* mask {
* paths: "name"
* }
* Or:
* mask {
* paths: "sub_message"
* }
* Note that oneof type names ("test_oneof" in this case) cannot be used in
* paths.
*
* Generated from protobuf message <code>google.protobuf.FieldMask</code>
*/
class FieldMask extends \Google\Protobuf\Internal\Message
{
/**
* The set of field mask paths.
*
* Generated from protobuf field <code>repeated string paths = 1;</code>
*/
private $paths;
public function __construct() {
\GPBMetadata\Google\Protobuf\FieldMask::initOnce();
parent::__construct();
}
/**
* The set of field mask paths.
*
* Generated from protobuf field <code>repeated string paths = 1;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getPaths()
{
return $this->paths;
}
/**
* The set of field mask paths.
*
* Generated from protobuf field <code>repeated string paths = 1;</code>
* @param string[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setPaths($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->paths = $arr;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace Google\Protobuf;
/**
* Whether a field is optional, required, or repeated.
*
* Protobuf enum <code>Google\Protobuf\Field\Cardinality</code>
*/
class Field_Cardinality
{
/**
* For fields with unknown cardinality.
*
* Generated from protobuf enum <code>CARDINALITY_UNKNOWN = 0;</code>
*/
const CARDINALITY_UNKNOWN = 0;
/**
* For optional fields.
*
* Generated from protobuf enum <code>CARDINALITY_OPTIONAL = 1;</code>
*/
const CARDINALITY_OPTIONAL = 1;
/**
* For required fields. Proto2 syntax only.
*
* Generated from protobuf enum <code>CARDINALITY_REQUIRED = 2;</code>
*/
const CARDINALITY_REQUIRED = 2;
/**
* For repeated fields.
*
* Generated from protobuf enum <code>CARDINALITY_REPEATED = 3;</code>
*/
const CARDINALITY_REPEATED = 3;
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace Google\Protobuf;
/**
* Basic field types.
*
* Protobuf enum <code>Google\Protobuf\Field\Kind</code>
*/
class Field_Kind
{
/**
* Field type unknown.
*
* Generated from protobuf enum <code>TYPE_UNKNOWN = 0;</code>
*/
const TYPE_UNKNOWN = 0;
/**
* Field type double.
*
* Generated from protobuf enum <code>TYPE_DOUBLE = 1;</code>
*/
const TYPE_DOUBLE = 1;
/**
* Field type float.
*
* Generated from protobuf enum <code>TYPE_FLOAT = 2;</code>
*/
const TYPE_FLOAT = 2;
/**
* Field type int64.
*
* Generated from protobuf enum <code>TYPE_INT64 = 3;</code>
*/
const TYPE_INT64 = 3;
/**
* Field type uint64.
*
* Generated from protobuf enum <code>TYPE_UINT64 = 4;</code>
*/
const TYPE_UINT64 = 4;
/**
* Field type int32.
*
* Generated from protobuf enum <code>TYPE_INT32 = 5;</code>
*/
const TYPE_INT32 = 5;
/**
* Field type fixed64.
*
* Generated from protobuf enum <code>TYPE_FIXED64 = 6;</code>
*/
const TYPE_FIXED64 = 6;
/**
* Field type fixed32.
*
* Generated from protobuf enum <code>TYPE_FIXED32 = 7;</code>
*/
const TYPE_FIXED32 = 7;
/**
* Field type bool.
*
* Generated from protobuf enum <code>TYPE_BOOL = 8;</code>
*/
const TYPE_BOOL = 8;
/**
* Field type string.
*
* Generated from protobuf enum <code>TYPE_STRING = 9;</code>
*/
const TYPE_STRING = 9;
/**
* Field type group. Proto2 syntax only, and deprecated.
*
* Generated from protobuf enum <code>TYPE_GROUP = 10;</code>
*/
const TYPE_GROUP = 10;
/**
* Field type message.
*
* Generated from protobuf enum <code>TYPE_MESSAGE = 11;</code>
*/
const TYPE_MESSAGE = 11;
/**
* Field type bytes.
*
* Generated from protobuf enum <code>TYPE_BYTES = 12;</code>
*/
const TYPE_BYTES = 12;
/**
* Field type uint32.
*
* Generated from protobuf enum <code>TYPE_UINT32 = 13;</code>
*/
const TYPE_UINT32 = 13;
/**
* Field type enum.
*
* Generated from protobuf enum <code>TYPE_ENUM = 14;</code>
*/
const TYPE_ENUM = 14;
/**
* Field type sfixed32.
*
* Generated from protobuf enum <code>TYPE_SFIXED32 = 15;</code>
*/
const TYPE_SFIXED32 = 15;
/**
* Field type sfixed64.
*
* Generated from protobuf enum <code>TYPE_SFIXED64 = 16;</code>
*/
const TYPE_SFIXED64 = 16;
/**
* Field type sint32.
*
* Generated from protobuf enum <code>TYPE_SINT32 = 17;</code>
*/
const TYPE_SINT32 = 17;
/**
* Field type sint64.
*
* Generated from protobuf enum <code>TYPE_SINT64 = 18;</code>
*/
const TYPE_SINT64 = 18;
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Wrapper message for `float`.
* The JSON representation for `FloatValue` is JSON number.
*
* Generated from protobuf message <code>google.protobuf.FloatValue</code>
*/
class FloatValue extends \Google\Protobuf\Internal\Message
{
/**
* The float value.
*
* Generated from protobuf field <code>float value = 1;</code>
*/
private $value = 0.0;
public function __construct() {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
parent::__construct();
}
/**
* The float value.
*
* Generated from protobuf field <code>float value = 1;</code>
* @return float
*/
public function getValue()
{
return $this->value;
}
/**
* The float value.
*
* Generated from protobuf field <code>float value = 1;</code>
* @param float $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkFloat($var);
$this->value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/empty.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A generic empty message that you can re-use to avoid defining duplicated
* empty messages in your APIs. A typical example is to use it as the request
* or the response type of an API method. For instance:
* service Foo {
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
* }
* The JSON representation for `Empty` is empty JSON object `{}`.
*
* Generated from protobuf message <code>google.protobuf.Empty</code>
*/
class GPBEmpty extends \Google\Protobuf\Internal\Message
{
public function __construct() {
\GPBMetadata\Google\Protobuf\GPBEmpty::initOnce();
parent::__construct();
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Wrapper message for `int32`.
* The JSON representation for `Int32Value` is JSON number.
*
* Generated from protobuf message <code>google.protobuf.Int32Value</code>
*/
class Int32Value extends \Google\Protobuf\Internal\Message
{
/**
* The int32 value.
*
* Generated from protobuf field <code>int32 value = 1;</code>
*/
private $value = 0;
public function __construct() {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
parent::__construct();
}
/**
* The int32 value.
*
* Generated from protobuf field <code>int32 value = 1;</code>
* @return int
*/
public function getValue()
{
return $this->value;
}
/**
* The int32 value.
*
* Generated from protobuf field <code>int32 value = 1;</code>
* @param int $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkInt32($var);
$this->value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Wrapper message for `int64`.
* The JSON representation for `Int64Value` is JSON string.
*
* Generated from protobuf message <code>google.protobuf.Int64Value</code>
*/
class Int64Value extends \Google\Protobuf\Internal\Message
{
/**
* The int64 value.
*
* Generated from protobuf field <code>int64 value = 1;</code>
*/
private $value = 0;
public function __construct() {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
parent::__construct();
}
/**
* The int64 value.
*
* Generated from protobuf field <code>int64 value = 1;</code>
* @return int|string
*/
public function getValue()
{
return $this->value;
}
/**
* The int64 value.
*
* Generated from protobuf field <code>int64 value = 1;</code>
* @param int|string $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkInt64($var);
$this->value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/struct.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* `ListValue` is a wrapper around a repeated field of values.
* The JSON representation for `ListValue` is JSON array.
*
* Generated from protobuf message <code>google.protobuf.ListValue</code>
*/
class ListValue extends \Google\Protobuf\Internal\Message
{
/**
* Repeated field of dynamically typed values.
*
* Generated from protobuf field <code>repeated .google.protobuf.Value values = 1;</code>
*/
private $values;
public function __construct() {
\GPBMetadata\Google\Protobuf\Struct::initOnce();
parent::__construct();
}
/**
* Repeated field of dynamically typed values.
*
* Generated from protobuf field <code>repeated .google.protobuf.Value values = 1;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getValues()
{
return $this->values;
}
/**
* Repeated field of dynamically typed values.
*
* Generated from protobuf field <code>repeated .google.protobuf.Value values = 1;</code>
* @param \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setValues($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class);
$this->values = $arr;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/api.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Method represents a method of an API interface.
*
* Generated from protobuf message <code>google.protobuf.Method</code>
*/
class Method extends \Google\Protobuf\Internal\Message
{
/**
* The simple name of this method.
*
* Generated from protobuf field <code>string name = 1;</code>
*/
private $name = '';
/**
* A URL of the input message type.
*
* Generated from protobuf field <code>string request_type_url = 2;</code>
*/
private $request_type_url = '';
/**
* If true, the request is streamed.
*
* Generated from protobuf field <code>bool request_streaming = 3;</code>
*/
private $request_streaming = false;
/**
* The URL of the output message type.
*
* Generated from protobuf field <code>string response_type_url = 4;</code>
*/
private $response_type_url = '';
/**
* If true, the response is streamed.
*
* Generated from protobuf field <code>bool response_streaming = 5;</code>
*/
private $response_streaming = false;
/**
* Any metadata attached to the method.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 6;</code>
*/
private $options;
/**
* The source syntax of this method.
*
* Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
*/
private $syntax = 0;
public function __construct() {
\GPBMetadata\Google\Protobuf\Api::initOnce();
parent::__construct();
}
/**
* The simple name of this method.
*
* Generated from protobuf field <code>string name = 1;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The simple name of this method.
*
* Generated from protobuf field <code>string name = 1;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* A URL of the input message type.
*
* Generated from protobuf field <code>string request_type_url = 2;</code>
* @return string
*/
public function getRequestTypeUrl()
{
return $this->request_type_url;
}
/**
* A URL of the input message type.
*
* Generated from protobuf field <code>string request_type_url = 2;</code>
* @param string $var
* @return $this
*/
public function setRequestTypeUrl($var)
{
GPBUtil::checkString($var, True);
$this->request_type_url = $var;
return $this;
}
/**
* If true, the request is streamed.
*
* Generated from protobuf field <code>bool request_streaming = 3;</code>
* @return bool
*/
public function getRequestStreaming()
{
return $this->request_streaming;
}
/**
* If true, the request is streamed.
*
* Generated from protobuf field <code>bool request_streaming = 3;</code>
* @param bool $var
* @return $this
*/
public function setRequestStreaming($var)
{
GPBUtil::checkBool($var);
$this->request_streaming = $var;
return $this;
}
/**
* The URL of the output message type.
*
* Generated from protobuf field <code>string response_type_url = 4;</code>
* @return string
*/
public function getResponseTypeUrl()
{
return $this->response_type_url;
}
/**
* The URL of the output message type.
*
* Generated from protobuf field <code>string response_type_url = 4;</code>
* @param string $var
* @return $this
*/
public function setResponseTypeUrl($var)
{
GPBUtil::checkString($var, True);
$this->response_type_url = $var;
return $this;
}
/**
* If true, the response is streamed.
*
* Generated from protobuf field <code>bool response_streaming = 5;</code>
* @return bool
*/
public function getResponseStreaming()
{
return $this->response_streaming;
}
/**
* If true, the response is streamed.
*
* Generated from protobuf field <code>bool response_streaming = 5;</code>
* @param bool $var
* @return $this
*/
public function setResponseStreaming($var)
{
GPBUtil::checkBool($var);
$this->response_streaming = $var;
return $this;
}
/**
* Any metadata attached to the method.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 6;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getOptions()
{
return $this->options;
}
/**
* Any metadata attached to the method.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 6;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class);
$this->options = $arr;
return $this;
}
/**
* The source syntax of this method.
*
* Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
* @return int
*/
public function getSyntax()
{
return $this->syntax;
}
/**
* The source syntax of this method.
*
* Generated from protobuf field <code>.google.protobuf.Syntax syntax = 7;</code>
* @param int $var
* @return $this
*/
public function setSyntax($var)
{
GPBUtil::checkEnum($var, \Google\Protobuf\Syntax::class);
$this->syntax = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/api.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Declares an API Interface to be included in this interface. The including
* interface must redeclare all the methods from the included interface, but
* documentation and options are inherited as follows:
* - If after comment and whitespace stripping, the documentation
* string of the redeclared method is empty, it will be inherited
* from the original method.
* - Each annotation belonging to the service config (http,
* visibility) which is not set in the redeclared method will be
* inherited.
* - If an http annotation is inherited, the path pattern will be
* modified as follows. Any version prefix will be replaced by the
* version of the including interface plus the [root][] path if
* specified.
* Example of a simple mixin:
* package google.acl.v1;
* service AccessControl {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v1/{resource=**}:getAcl";
* }
* }
* package google.storage.v2;
* service Storage {
* rpc GetAcl(GetAclRequest) returns (Acl);
* // Get a data record.
* rpc GetData(GetDataRequest) returns (Data) {
* option (google.api.http).get = "/v2/{resource=**}";
* }
* }
* Example of a mixin configuration:
* apis:
* - name: google.storage.v2.Storage
* mixins:
* - name: google.acl.v1.AccessControl
* The mixin construct implies that all methods in `AccessControl` are
* also declared with same name and request/response types in
* `Storage`. A documentation generator or annotation processor will
* see the effective `Storage.GetAcl` method after inherting
* documentation and annotations as follows:
* service Storage {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v2/{resource=**}:getAcl";
* }
* ...
* }
* Note how the version in the path pattern changed from `v1` to `v2`.
* If the `root` field in the mixin is specified, it should be a
* relative path under which inherited HTTP paths are placed. Example:
* apis:
* - name: google.storage.v2.Storage
* mixins:
* - name: google.acl.v1.AccessControl
* root: acls
* This implies the following inherited HTTP annotation:
* service Storage {
* // Get the underlying ACL object.
* rpc GetAcl(GetAclRequest) returns (Acl) {
* option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
* }
* ...
* }
*
* Generated from protobuf message <code>google.protobuf.Mixin</code>
*/
class Mixin extends \Google\Protobuf\Internal\Message
{
/**
* The fully qualified name of the interface which is included.
*
* Generated from protobuf field <code>string name = 1;</code>
*/
private $name = '';
/**
* If non-empty specifies a path under which inherited HTTP paths
* are rooted.
*
* Generated from protobuf field <code>string root = 2;</code>
*/
private $root = '';
public function __construct() {
\GPBMetadata\Google\Protobuf\Api::initOnce();
parent::__construct();
}
/**
* The fully qualified name of the interface which is included.
*
* Generated from protobuf field <code>string name = 1;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The fully qualified name of the interface which is included.
*
* Generated from protobuf field <code>string name = 1;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* If non-empty specifies a path under which inherited HTTP paths
* are rooted.
*
* Generated from protobuf field <code>string root = 2;</code>
* @return string
*/
public function getRoot()
{
return $this->root;
}
/**
* If non-empty specifies a path under which inherited HTTP paths
* are rooted.
*
* Generated from protobuf field <code>string root = 2;</code>
* @param string $var
* @return $this
*/
public function setRoot($var)
{
GPBUtil::checkString($var, True);
$this->root = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/struct.proto
namespace Google\Protobuf;
/**
* `NullValue` is a singleton enumeration to represent the null value for the
* `Value` type union.
* The JSON representation for `NullValue` is JSON `null`.
*
* Protobuf enum <code>Google\Protobuf\NullValue</code>
*/
class NullValue
{
/**
* Null value.
*
* Generated from protobuf enum <code>NULL_VALUE = 0;</code>
*/
const NULL_VALUE = 0;
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A protocol buffer option, which can be attached to a message, field,
* enumeration, etc.
*
* Generated from protobuf message <code>google.protobuf.Option</code>
*/
class Option extends \Google\Protobuf\Internal\Message
{
/**
* The option's name. For protobuf built-in options (options defined in
* descriptor.proto), this is the short name. For example, `"map_entry"`.
* For custom options, it should be the fully-qualified name. For example,
* `"google.api.http"`.
*
* Generated from protobuf field <code>string name = 1;</code>
*/
private $name = '';
/**
* The option's value packed in an Any message. If the value is a primitive,
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
* should be used. If the value is an enum, it should be stored as an int32
* value using the google.protobuf.Int32Value type.
*
* Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
*/
private $value = null;
public function __construct() {
\GPBMetadata\Google\Protobuf\Type::initOnce();
parent::__construct();
}
/**
* The option's name. For protobuf built-in options (options defined in
* descriptor.proto), this is the short name. For example, `"map_entry"`.
* For custom options, it should be the fully-qualified name. For example,
* `"google.api.http"`.
*
* Generated from protobuf field <code>string name = 1;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The option's name. For protobuf built-in options (options defined in
* descriptor.proto), this is the short name. For example, `"map_entry"`.
* For custom options, it should be the fully-qualified name. For example,
* `"google.api.http"`.
*
* Generated from protobuf field <code>string name = 1;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The option's value packed in an Any message. If the value is a primitive,
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
* should be used. If the value is an enum, it should be stored as an int32
* value using the google.protobuf.Int32Value type.
*
* Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
* @return \Google\Protobuf\Any
*/
public function getValue()
{
return $this->value;
}
/**
* The option's value packed in an Any message. If the value is a primitive,
* the corresponding wrapper type defined in google/protobuf/wrappers.proto
* should be used. If the value is an enum, it should be stored as an int32
* value using the google.protobuf.Int32Value type.
*
* Generated from protobuf field <code>.google.protobuf.Any value = 2;</code>
* @param \Google\Protobuf\Any $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkMessage($var, \Google\Protobuf\Any::class);
$this->value = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/source_context.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* `SourceContext` represents information about the source of a
* protobuf element, like the file in which it is defined.
*
* Generated from protobuf message <code>google.protobuf.SourceContext</code>
*/
class SourceContext extends \Google\Protobuf\Internal\Message
{
/**
* The path-qualified name of the .proto file that contained the associated
* protobuf element. For example: `"google/protobuf/source_context.proto"`.
*
* Generated from protobuf field <code>string file_name = 1;</code>
*/
private $file_name = '';
public function __construct() {
\GPBMetadata\Google\Protobuf\SourceContext::initOnce();
parent::__construct();
}
/**
* The path-qualified name of the .proto file that contained the associated
* protobuf element. For example: `"google/protobuf/source_context.proto"`.
*
* Generated from protobuf field <code>string file_name = 1;</code>
* @return string
*/
public function getFileName()
{
return $this->file_name;
}
/**
* The path-qualified name of the .proto file that contained the associated
* protobuf element. For example: `"google/protobuf/source_context.proto"`.
*
* Generated from protobuf field <code>string file_name = 1;</code>
* @param string $var
* @return $this
*/
public function setFileName($var)
{
GPBUtil::checkString($var, True);
$this->file_name = $var;
return $this;
}
}
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/wrappers.proto
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Wrapper message for `string`.
* The JSON representation for `StringValue` is JSON string.
*
* Generated from protobuf message <code>google.protobuf.StringValue</code>
*/
class StringValue extends \Google\Protobuf\Internal\Message
{
/**
* The string value.
*
* Generated from protobuf field <code>string value = 1;</code>
*/
private $value = '';
public function __construct() {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
parent::__construct();
}
/**
* The string value.
*
* Generated from protobuf field <code>string value = 1;</code>
* @return string
*/
public function getValue()
{
return $this->value;
}
/**
* The string value.
*
* Generated from protobuf field <code>string value = 1;</code>
* @param string $var
* @return $this
*/
public function setValue($var)
{
GPBUtil::checkString($var, True);
$this->value = $var;
return $this;
}
}
This diff is collapsed.
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/type.proto
namespace Google\Protobuf;
/**
* The syntax in which a protocol buffer element is defined.
*
* Protobuf enum <code>Google\Protobuf\Syntax</code>
*/
class Syntax
{
/**
* Syntax `proto2`.
*
* Generated from protobuf enum <code>SYNTAX_PROTO2 = 0;</code>
*/
const SYNTAX_PROTO2 = 0;
/**
* Syntax `proto3`.
*
* Generated from protobuf enum <code>SYNTAX_PROTO3 = 1;</code>
*/
const SYNTAX_PROTO3 = 1;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -20,7 +20,6 @@ function generate_proto() {
$PROTOC1 --php_out=generated proto/test_include.proto
$PROTOC2 --php_out=generated proto/test.proto proto/test_no_namespace.proto proto/test_prefix.proto
pushd ../../src
$PROTOC2 --php_out=../php/tests/generated google/protobuf/empty.proto
$PROTOC2 --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
popd
}
......
This diff is collapsed.
......@@ -358,7 +358,6 @@ generate_php_test_proto() {
proto/test_service_namespace.proto \
proto/test_descriptors.proto
pushd ../../src
./protoc --php_out=../php/tests/generated google/protobuf/empty.proto
./protoc --php_out=../php/tests/generated -I../php/tests -I. ../php/tests/proto/test_import_descriptor_proto.proto
popd
popd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment