├── LICENSE ├── README.md ├── composer.json └── src ├── GPBMetadata └── Google │ └── Protobuf │ ├── Any.php │ ├── Api.php │ ├── Duration.php │ ├── FieldMask.php │ ├── GPBEmpty.php │ ├── Internal │ └── Descriptor.php │ ├── SourceContext.php │ ├── Struct.php │ ├── Timestamp.php │ ├── Type.php │ └── Wrappers.php ├── Google └── Protobuf │ ├── Any.php │ ├── Api.php │ ├── BoolValue.php │ ├── BytesValue.php │ ├── Descriptor.php │ ├── DescriptorPool.php │ ├── DoubleValue.php │ ├── Duration.php │ ├── Enum.php │ ├── EnumDescriptor.php │ ├── EnumValue.php │ ├── EnumValueDescriptor.php │ ├── Field.php │ ├── Field │ ├── Cardinality.php │ └── Kind.php │ ├── FieldDescriptor.php │ ├── FieldMask.php │ ├── Field_Cardinality.php │ ├── Field_Kind.php │ ├── FloatValue.php │ ├── GPBEmpty.php │ ├── Int32Value.php │ ├── Int64Value.php │ ├── Internal │ ├── AnyBase.php │ ├── CodedInputStream.php │ ├── CodedOutputStream.php │ ├── Descriptor.php │ ├── DescriptorPool.php │ ├── DescriptorProto.php │ ├── DescriptorProto │ │ ├── ExtensionRange.php │ │ └── ReservedRange.php │ ├── Edition.php │ ├── EnumBuilderContext.php │ ├── EnumDescriptor.php │ ├── EnumDescriptorProto.php │ ├── EnumDescriptorProto │ │ └── EnumReservedRange.php │ ├── EnumOptions.php │ ├── EnumValueDescriptorProto.php │ ├── EnumValueOptions.php │ ├── ExtensionRangeOptions.php │ ├── ExtensionRangeOptions │ │ ├── Declaration.php │ │ └── VerificationState.php │ ├── FeatureSet.php │ ├── FeatureSet │ │ ├── EnforceNamingStyle.php │ │ ├── EnumType.php │ │ ├── FieldPresence.php │ │ ├── JsonFormat.php │ │ ├── MessageEncoding.php │ │ ├── RepeatedFieldEncoding.php │ │ ├── Utf8Validation.php │ │ ├── VisibilityFeature.php │ │ └── VisibilityFeature │ │ │ └── DefaultSymbolVisibility.php │ ├── FeatureSetDefaults.php │ ├── FeatureSetDefaults │ │ └── FeatureSetEditionDefault.php │ ├── FieldDescriptor.php │ ├── FieldDescriptorProto.php │ ├── FieldDescriptorProto │ │ ├── Label.php │ │ └── Type.php │ ├── FieldOptions.php │ ├── FieldOptions │ │ ├── CType.php │ │ ├── EditionDefault.php │ │ ├── FeatureSupport.php │ │ ├── JSType.php │ │ ├── OptionRetention.php │ │ └── OptionTargetType.php │ ├── FileDescriptor.php │ ├── FileDescriptorProto.php │ ├── FileDescriptorSet.php │ ├── FileOptions.php │ ├── FileOptions │ │ └── OptimizeMode.php │ ├── GPBDecodeException.php │ ├── GPBJsonWire.php │ ├── GPBLabel.php │ ├── GPBType.php │ ├── GPBUtil.php │ ├── GPBWire.php │ ├── GPBWireType.php │ ├── GeneratedCodeInfo.php │ ├── GeneratedCodeInfo │ │ ├── Annotation.php │ │ └── Annotation │ │ │ └── Semantic.php │ ├── GetPublicDescriptorTrait.php │ ├── HasPublicDescriptorTrait.php │ ├── MapEntry.php │ ├── MapField.php │ ├── MapFieldIter.php │ ├── Message.php │ ├── MessageBuilderContext.php │ ├── MessageOptions.php │ ├── MethodDescriptorProto.php │ ├── MethodOptions.php │ ├── MethodOptions │ │ └── IdempotencyLevel.php │ ├── OneofDescriptor.php │ ├── OneofDescriptorProto.php │ ├── OneofField.php │ ├── OneofOptions.php │ ├── RawInputStream.php │ ├── RepeatedField.php │ ├── RepeatedFieldIter.php │ ├── ServiceDescriptorProto.php │ ├── ServiceOptions.php │ ├── SourceCodeInfo.php │ ├── SourceCodeInfo │ │ └── Location.php │ ├── SymbolVisibility.php │ ├── TimestampBase.php │ ├── UninterpretedOption.php │ └── UninterpretedOption │ │ └── NamePart.php │ ├── ListValue.php │ ├── Method.php │ ├── Mixin.php │ ├── NullValue.php │ ├── OneofDescriptor.php │ ├── Option.php │ ├── PrintOptions.php │ ├── RepeatedField.php │ ├── SourceContext.php │ ├── StringValue.php │ ├── Struct.php │ ├── Syntax.php │ ├── Timestamp.php │ ├── Type.php │ ├── UInt32Value.php │ ├── UInt64Value.php │ └── Value.php └── phpdoc.dist.xml /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Protocol Buffers 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # protobuf-php 2 | This repository contains only PHP files to support Composer installation. This repository is a mirror of [protobuf](https://github.com/protocolbuffers/protobuf). Any support requests, bug reports, or development contributions should be directed to that project. To install protobuf for PHP, please see https://github.com/protocolbuffers/protobuf/tree/master/php 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google/protobuf", 3 | "type": "library", 4 | "description": "proto library for PHP", 5 | "keywords": ["proto"], 6 | "homepage": "https://developers.google.com/protocol-buffers/", 7 | "license": "BSD-3-Clause", 8 | "require": { 9 | "php": ">=7.0.0" 10 | }, 11 | "require-dev": { 12 | "phpunit/phpunit": ">=5.0.0" 13 | }, 14 | "suggest": { 15 | "ext-bcmath": "Need to support JSON deserialization" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "Google\\Protobuf\\": "src/Google/Protobuf", 20 | "GPBMetadata\\Google\\Protobuf\\": "src/GPBMetadata/Google/Protobuf" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/Any.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xD4\x01\x0A\x19google/protobuf/any.proto\x12\x0Fgoogle.protobuf\"&\x0A\x03Any\x12\x10\x0A\x08type_url\x18\x01 \x01(\x09\x12\x0D\x0A\x05value\x18\x02 \x01(\x0CBv\x0A\x13com.google.protobufB\x08AnyProtoP\x01Z,google.golang.org/protobuf/types/known/anypb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/Api.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 21 | "\x0A\xC9\x05\x0A\x19google/protobuf/api.proto\x12\x0Fgoogle.protobuf\x1A\x1Agoogle/protobuf/type.proto\"\x81\x02\x0A\x03Api\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12(\x0A\x07methods\x18\x02 \x03(\x0B2\x17.google.protobuf.Method\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\x12\x0F\x0A\x07version\x18\x04 \x01(\x09\x126\x0A\x0Esource_context\x18\x05 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12&\x0A\x06mixins\x18\x06 \x03(\x0B2\x16.google.protobuf.Mixin\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"\xD5\x01\x0A\x06Method\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x18\x0A\x10request_type_url\x18\x02 \x01(\x09\x12\x19\x0A\x11request_streaming\x18\x03 \x01(\x08\x12\x19\x0A\x11response_type_url\x18\x04 \x01(\x09\x12\x1A\x0A\x12response_streaming\x18\x05 \x01(\x08\x12(\x0A\x07options\x18\x06 \x03(\x0B2\x17.google.protobuf.Option\x12'\x0A\x06syntax\x18\x07 \x01(\x0E2\x17.google.protobuf.Syntax\"#\x0A\x05Mixin\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x0C\x0A\x04root\x18\x02 \x01(\x09Bv\x0A\x13com.google.protobufB\x08ApiProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 22 | , true); 23 | 24 | static::$is_initialized = true; 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/Duration.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xEB\x01\x0A\x1Egoogle/protobuf/duration.proto\x12\x0Fgoogle.protobuf\"*\x0A\x08Duration\x12\x0F\x0A\x07seconds\x18\x01 \x01(\x03\x12\x0D\x0A\x05nanos\x18\x02 \x01(\x05B\x83\x01\x0A\x13com.google.protobufB\x0DDurationProtoP\x01Z1google.golang.org/protobuf/types/known/durationpb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/FieldMask.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xDF\x01\x0A google/protobuf/field_mask.proto\x12\x0Fgoogle.protobuf\"\x1A\x0A\x09FieldMask\x12\x0D\x0A\x05paths\x18\x01 \x03(\x09B\x85\x01\x0A\x13com.google.protobufB\x0EFieldMaskProtoP\x01Z2google.golang.org/protobuf/types/known/fieldmaskpb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/GPBEmpty.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xBE\x01\x0A\x1Bgoogle/protobuf/empty.proto\x12\x0Fgoogle.protobuf\"\x07\x0A\x05EmptyB}\x0A\x13com.google.protobufB\x0AEmptyProtoP\x01Z.google.golang.org/protobuf/types/known/emptypb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/SourceContext.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xF0\x01\x0A\$google/protobuf/source_context.proto\x12\x0Fgoogle.protobuf\"\"\x0A\x0DSourceContext\x12\x11\x0A\x09file_name\x18\x01 \x01(\x09B\x8A\x01\x0A\x13com.google.protobufB\x12SourceContextProtoP\x01Z6google.golang.org/protobuf/types/known/sourcecontextpb\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/Struct.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xFE\x04\x0A\x1Cgoogle/protobuf/struct.proto\x12\x0Fgoogle.protobuf\"\x84\x01\x0A\x06Struct\x123\x0A\x06fields\x18\x01 \x03(\x0B2#.google.protobuf.Struct.FieldsEntry\x1AE\x0A\x0BFieldsEntry\x12\x0B\x0A\x03key\x18\x01 \x01(\x09\x12%\x0A\x05value\x18\x02 \x01(\x0B2\x16.google.protobuf.Value:\x028\x01\"\xEA\x01\x0A\x05Value\x120\x0A\x0Anull_value\x18\x01 \x01(\x0E2\x1A.google.protobuf.NullValueH\x00\x12\x16\x0A\x0Cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\x0A\x0Cstring_value\x18\x03 \x01(\x09H\x00\x12\x14\x0A\x0Abool_value\x18\x04 \x01(\x08H\x00\x12/\x0A\x0Cstruct_value\x18\x05 \x01(\x0B2\x17.google.protobuf.StructH\x00\x120\x0A\x0Alist_value\x18\x06 \x01(\x0B2\x1A.google.protobuf.ListValueH\x00B\x06\x0A\x04kind\"3\x0A\x09ListValue\x12&\x0A\x06values\x18\x01 \x03(\x0B2\x16.google.protobuf.Value*\x1B\x0A\x09NullValue\x12\x0E\x0A\x0ANULL_VALUE\x10\x00B\x7F\x0A\x13com.google.protobufB\x0BStructProtoP\x01Z/google.golang.org/protobuf/types/known/structpb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/Timestamp.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xEF\x01\x0A\x1Fgoogle/protobuf/timestamp.proto\x12\x0Fgoogle.protobuf\"+\x0A\x09Timestamp\x12\x0F\x0A\x07seconds\x18\x01 \x01(\x03\x12\x0D\x0A\x05nanos\x18\x02 \x01(\x05B\x85\x01\x0A\x13com.google.protobufB\x0ETimestampProtoP\x01Z2google.golang.org/protobuf/types/known/timestamppb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/Type.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 21 | "\x0A\xD4\x0C\x0A\x1Agoogle/protobuf/type.proto\x12\x0Fgoogle.protobuf\x1A\$google/protobuf/source_context.proto\"\xE8\x01\x0A\x04Type\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12&\x0A\x06fields\x18\x02 \x03(\x0B2\x16.google.protobuf.Field\x12\x0E\x0A\x06oneofs\x18\x03 \x03(\x09\x12(\x0A\x07options\x18\x04 \x03(\x0B2\x17.google.protobuf.Option\x126\x0A\x0Esource_context\x18\x05 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12'\x0A\x06syntax\x18\x06 \x01(\x0E2\x17.google.protobuf.Syntax\x12\x0F\x0A\x07edition\x18\x07 \x01(\x09\"\xD5\x05\x0A\x05Field\x12)\x0A\x04kind\x18\x01 \x01(\x0E2\x1B.google.protobuf.Field.Kind\x127\x0A\x0Bcardinality\x18\x02 \x01(\x0E2\".google.protobuf.Field.Cardinality\x12\x0E\x0A\x06number\x18\x03 \x01(\x05\x12\x0C\x0A\x04name\x18\x04 \x01(\x09\x12\x10\x0A\x08type_url\x18\x06 \x01(\x09\x12\x13\x0A\x0Boneof_index\x18\x07 \x01(\x05\x12\x0E\x0A\x06packed\x18\x08 \x01(\x08\x12(\x0A\x07options\x18\x09 \x03(\x0B2\x17.google.protobuf.Option\x12\x11\x0A\x09json_name\x18\x0A \x01(\x09\x12\x15\x0A\x0Ddefault_value\x18\x0B \x01(\x09\"\xC8\x02\x0A\x04Kind\x12\x10\x0A\x0CTYPE_UNKNOWN\x10\x00\x12\x0F\x0A\x0BTYPE_DOUBLE\x10\x01\x12\x0E\x0A\x0ATYPE_FLOAT\x10\x02\x12\x0E\x0A\x0ATYPE_INT64\x10\x03\x12\x0F\x0A\x0BTYPE_UINT64\x10\x04\x12\x0E\x0A\x0ATYPE_INT32\x10\x05\x12\x10\x0A\x0CTYPE_FIXED64\x10\x06\x12\x10\x0A\x0CTYPE_FIXED32\x10\x07\x12\x0D\x0A\x09TYPE_BOOL\x10\x08\x12\x0F\x0A\x0BTYPE_STRING\x10\x09\x12\x0E\x0A\x0ATYPE_GROUP\x10\x0A\x12\x10\x0A\x0CTYPE_MESSAGE\x10\x0B\x12\x0E\x0A\x0ATYPE_BYTES\x10\x0C\x12\x0F\x0A\x0BTYPE_UINT32\x10\x0D\x12\x0D\x0A\x09TYPE_ENUM\x10\x0E\x12\x11\x0A\x0DTYPE_SFIXED32\x10\x0F\x12\x11\x0A\x0DTYPE_SFIXED64\x10\x10\x12\x0F\x0A\x0BTYPE_SINT32\x10\x11\x12\x0F\x0A\x0BTYPE_SINT64\x10\x12\"t\x0A\x0BCardinality\x12\x17\x0A\x13CARDINALITY_UNKNOWN\x10\x00\x12\x18\x0A\x14CARDINALITY_OPTIONAL\x10\x01\x12\x18\x0A\x14CARDINALITY_REQUIRED\x10\x02\x12\x18\x0A\x14CARDINALITY_REPEATED\x10\x03\"\xDF\x01\x0A\x04Enum\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12-\x0A\x09enumvalue\x18\x02 \x03(\x0B2\x1A.google.protobuf.EnumValue\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\x126\x0A\x0Esource_context\x18\x04 \x01(\x0B2\x1E.google.protobuf.SourceContext\x12'\x0A\x06syntax\x18\x05 \x01(\x0E2\x17.google.protobuf.Syntax\x12\x0F\x0A\x07edition\x18\x06 \x01(\x09\"S\x0A\x09EnumValue\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12\x0E\x0A\x06number\x18\x02 \x01(\x05\x12(\x0A\x07options\x18\x03 \x03(\x0B2\x17.google.protobuf.Option\";\x0A\x06Option\x12\x0C\x0A\x04name\x18\x01 \x01(\x09\x12#\x0A\x05value\x18\x02 \x01(\x0B2\x14.google.protobuf.Any*C\x0A\x06Syntax\x12\x11\x0A\x0DSYNTAX_PROTO2\x10\x00\x12\x11\x0A\x0DSYNTAX_PROTO3\x10\x01\x12\x13\x0A\x0FSYNTAX_EDITIONS\x10\x02B{\x0A\x13com.google.protobufB\x09TypeProtoP\x01Z-google.golang.org/protobuf/types/known/typepb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 22 | , true); 23 | 24 | static::$is_initialized = true; 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/GPBMetadata/Google/Protobuf/Wrappers.php: -------------------------------------------------------------------------------- 1 | internalAddGeneratedFile( 19 | "\x0A\xC7\x03\x0A\x1Egoogle/protobuf/wrappers.proto\x12\x0Fgoogle.protobuf\"\x1C\x0A\x0BDoubleValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x01\"\x1B\x0A\x0AFloatValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x02\"\x1B\x0A\x0AInt64Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x03\"\x1C\x0A\x0BUInt64Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x04\"\x1B\x0A\x0AInt32Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x05\"\x1C\x0A\x0BUInt32Value\x12\x0D\x0A\x05value\x18\x01 \x01(\x0D\"\x1A\x0A\x09BoolValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x08\"\x1C\x0A\x0BStringValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x09\"\x1B\x0A\x0ABytesValue\x12\x0D\x0A\x05value\x18\x01 \x01(\x0CB\x83\x01\x0A\x13com.google.protobufB\x0DWrappersProtoP\x01Z1google.golang.org/protobuf/types/known/wrapperspb\xF8\x01\x01\xA2\x02\x03GPB\xAA\x02\x1EGoogle.Protobuf.WellKnownTypesb\x06proto3" 20 | , true); 21 | 22 | static::$is_initialized = true; 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/Google/Protobuf/BoolValue.php: -------------------------------------------------------------------------------- 1 | google.protobuf.BoolValue 19 | */ 20 | class BoolValue extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The bool value. 24 | * 25 | * Generated from protobuf field bool value = 1; 26 | */ 27 | protected $value = false; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type bool $value 36 | * The bool value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The bool value. 46 | * 47 | * Generated from protobuf field bool value = 1; 48 | * @return bool 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The bool value. 57 | * 58 | * Generated from protobuf field bool value = 1; 59 | * @param bool $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkBool($var); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/BytesValue.php: -------------------------------------------------------------------------------- 1 | google.protobuf.BytesValue 19 | */ 20 | class BytesValue extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The bytes value. 24 | * 25 | * Generated from protobuf field bytes value = 1; 26 | */ 27 | protected $value = ''; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type string $value 36 | * The bytes value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The bytes value. 46 | * 47 | * Generated from protobuf field bytes value = 1; 48 | * @return string 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The bytes value. 57 | * 58 | * Generated from protobuf field bytes value = 1; 59 | * @param string $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkString($var, False); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Descriptor.php: -------------------------------------------------------------------------------- 1 | internal_desc = $internal_desc; 26 | } 27 | 28 | /** 29 | * @return string Full protobuf message name 30 | */ 31 | public function getFullName() 32 | { 33 | return trim($this->internal_desc->getFullName(), "."); 34 | } 35 | 36 | /** 37 | * @return string PHP class name 38 | */ 39 | public function getClass() 40 | { 41 | return $this->internal_desc->getClass(); 42 | } 43 | 44 | /** 45 | * @param int $index Must be >= 0 and < getFieldCount() 46 | * @return FieldDescriptor 47 | */ 48 | public function getField($index) 49 | { 50 | return $this->getPublicDescriptor($this->internal_desc->getFieldByIndex($index)); 51 | } 52 | 53 | /** 54 | * @return int Number of fields in message 55 | */ 56 | public function getFieldCount() 57 | { 58 | return count($this->internal_desc->getField()); 59 | } 60 | 61 | /** 62 | * @param int $index Must be >= 0 and < getOneofDeclCount() 63 | * @return OneofDescriptor 64 | */ 65 | public function getOneofDecl($index) 66 | { 67 | return $this->getPublicDescriptor($this->internal_desc->getOneofDecl()[$index]); 68 | } 69 | 70 | /** 71 | * @return int Number of oneofs in message 72 | */ 73 | public function getOneofDeclCount() 74 | { 75 | return count($this->internal_desc->getOneofDecl()); 76 | } 77 | 78 | /** 79 | * @return int Number of real oneofs in message 80 | */ 81 | public function getRealOneofDeclCount() 82 | { 83 | return $this->internal_desc->getRealOneofDeclCount(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Google/Protobuf/DescriptorPool.php: -------------------------------------------------------------------------------- 1 | internal_pool = $internal_pool; 32 | } 33 | 34 | /** 35 | * @param string $className A fully qualified protobuf class name 36 | * @return Descriptor 37 | */ 38 | public function getDescriptorByClassName($className) 39 | { 40 | $desc = $this->internal_pool->getDescriptorByClassName($className); 41 | return is_null($desc) ? null : $desc->getPublicDescriptor(); 42 | } 43 | 44 | /** 45 | * @param string $className A fully qualified protobuf class name 46 | * @return EnumDescriptor 47 | */ 48 | public function getEnumDescriptorByClassName($className) 49 | { 50 | $desc = $this->internal_pool->getEnumDescriptorByClassName($className); 51 | return is_null($desc) ? null : $desc->getPublicDescriptor(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Google/Protobuf/DoubleValue.php: -------------------------------------------------------------------------------- 1 | google.protobuf.DoubleValue 19 | */ 20 | class DoubleValue extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The double value. 24 | * 25 | * Generated from protobuf field double value = 1; 26 | */ 27 | protected $value = 0.0; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type float $value 36 | * The double value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The double value. 46 | * 47 | * Generated from protobuf field double value = 1; 48 | * @return float 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The double value. 57 | * 58 | * Generated from protobuf field double value = 1; 59 | * @param float $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkDouble($var); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/EnumDescriptor.php: -------------------------------------------------------------------------------- 1 | internal_desc = $internal_desc; 22 | } 23 | 24 | /** 25 | * @return string Full protobuf message name 26 | */ 27 | public function getFullName() 28 | { 29 | return $this->internal_desc->getFullName(); 30 | } 31 | 32 | /** 33 | * @return string PHP class name 34 | */ 35 | public function getClass() 36 | { 37 | return $this->internal_desc->getClass(); 38 | } 39 | 40 | /** 41 | * @param int $index Must be >= 0 and < getValueCount() 42 | * @return EnumValueDescriptor 43 | */ 44 | public function getValue($index) 45 | { 46 | return $this->internal_desc->getValueDescriptorByIndex($index); 47 | } 48 | 49 | /** 50 | * @return int Number of values in enum 51 | */ 52 | public function getValueCount() 53 | { 54 | return $this->internal_desc->getValueCount(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Google/Protobuf/EnumValue.php: -------------------------------------------------------------------------------- 1 | google.protobuf.EnumValue 16 | */ 17 | class EnumValue extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Enum value name. 21 | * 22 | * Generated from protobuf field string name = 1; 23 | */ 24 | protected $name = ''; 25 | /** 26 | * Enum value number. 27 | * 28 | * Generated from protobuf field int32 number = 2; 29 | */ 30 | protected $number = 0; 31 | /** 32 | * Protocol buffer options. 33 | * 34 | * Generated from protobuf field repeated .google.protobuf.Option options = 3; 35 | */ 36 | private $options; 37 | 38 | /** 39 | * Constructor. 40 | * 41 | * @param array $data { 42 | * Optional. Data for populating the Message object. 43 | * 44 | * @type string $name 45 | * Enum value name. 46 | * @type int $number 47 | * Enum value number. 48 | * @type \Google\Protobuf\Option[] $options 49 | * Protocol buffer options. 50 | * } 51 | */ 52 | public function __construct($data = NULL) { 53 | \GPBMetadata\Google\Protobuf\Type::initOnce(); 54 | parent::__construct($data); 55 | } 56 | 57 | /** 58 | * Enum value name. 59 | * 60 | * Generated from protobuf field string name = 1; 61 | * @return string 62 | */ 63 | public function getName() 64 | { 65 | return $this->name; 66 | } 67 | 68 | /** 69 | * Enum value name. 70 | * 71 | * Generated from protobuf field string name = 1; 72 | * @param string $var 73 | * @return $this 74 | */ 75 | public function setName($var) 76 | { 77 | GPBUtil::checkString($var, True); 78 | $this->name = $var; 79 | 80 | return $this; 81 | } 82 | 83 | /** 84 | * Enum value number. 85 | * 86 | * Generated from protobuf field int32 number = 2; 87 | * @return int 88 | */ 89 | public function getNumber() 90 | { 91 | return $this->number; 92 | } 93 | 94 | /** 95 | * Enum value number. 96 | * 97 | * Generated from protobuf field int32 number = 2; 98 | * @param int $var 99 | * @return $this 100 | */ 101 | public function setNumber($var) 102 | { 103 | GPBUtil::checkInt32($var); 104 | $this->number = $var; 105 | 106 | return $this; 107 | } 108 | 109 | /** 110 | * Protocol buffer options. 111 | * 112 | * Generated from protobuf field repeated .google.protobuf.Option options = 3; 113 | * @return RepeatedField<\Google\Protobuf\Option> 114 | */ 115 | public function getOptions() 116 | { 117 | return $this->options; 118 | } 119 | 120 | /** 121 | * Protocol buffer options. 122 | * 123 | * Generated from protobuf field repeated .google.protobuf.Option options = 3; 124 | * @param \Google\Protobuf\Option[] $var 125 | * @return $this 126 | */ 127 | public function setOptions($var) 128 | { 129 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Option::class); 130 | $this->options = $arr; 131 | 132 | return $this; 133 | } 134 | 135 | } 136 | 137 | -------------------------------------------------------------------------------- /src/Google/Protobuf/EnumValueDescriptor.php: -------------------------------------------------------------------------------- 1 | name = $name; 23 | $this->number = $number; 24 | } 25 | 26 | /** 27 | * @return string 28 | */ 29 | public function getName() 30 | { 31 | return $this->name; 32 | } 33 | 34 | /** 35 | * @return int 36 | */ 37 | public function getNumber() 38 | { 39 | return $this->number; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Field/Cardinality.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Field.Cardinality 14 | */ 15 | class Cardinality 16 | { 17 | /** 18 | * For fields with unknown cardinality. 19 | * 20 | * Generated from protobuf enum CARDINALITY_UNKNOWN = 0; 21 | */ 22 | const CARDINALITY_UNKNOWN = 0; 23 | /** 24 | * For optional fields. 25 | * 26 | * Generated from protobuf enum CARDINALITY_OPTIONAL = 1; 27 | */ 28 | const CARDINALITY_OPTIONAL = 1; 29 | /** 30 | * For required fields. Proto2 syntax only. 31 | * 32 | * Generated from protobuf enum CARDINALITY_REQUIRED = 2; 33 | */ 34 | const CARDINALITY_REQUIRED = 2; 35 | /** 36 | * For repeated fields. 37 | * 38 | * Generated from protobuf enum CARDINALITY_REPEATED = 3; 39 | */ 40 | const CARDINALITY_REPEATED = 3; 41 | 42 | private static $valueToName = [ 43 | self::CARDINALITY_UNKNOWN => 'CARDINALITY_UNKNOWN', 44 | self::CARDINALITY_OPTIONAL => 'CARDINALITY_OPTIONAL', 45 | self::CARDINALITY_REQUIRED => 'CARDINALITY_REQUIRED', 46 | self::CARDINALITY_REPEATED => 'CARDINALITY_REPEATED', 47 | ]; 48 | 49 | public static function name($value) 50 | { 51 | if (!isset(self::$valueToName[$value])) { 52 | throw new UnexpectedValueException(sprintf( 53 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 54 | } 55 | return self::$valueToName[$value]; 56 | } 57 | 58 | 59 | public static function value($name) 60 | { 61 | $const = __CLASS__ . '::' . strtoupper($name); 62 | if (!defined($const)) { 63 | throw new UnexpectedValueException(sprintf( 64 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 65 | } 66 | return constant($const); 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Field/Kind.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Field.Kind 14 | */ 15 | class Kind 16 | { 17 | /** 18 | * Field type unknown. 19 | * 20 | * Generated from protobuf enum TYPE_UNKNOWN = 0; 21 | */ 22 | const TYPE_UNKNOWN = 0; 23 | /** 24 | * Field type double. 25 | * 26 | * Generated from protobuf enum TYPE_DOUBLE = 1; 27 | */ 28 | const TYPE_DOUBLE = 1; 29 | /** 30 | * Field type float. 31 | * 32 | * Generated from protobuf enum TYPE_FLOAT = 2; 33 | */ 34 | const TYPE_FLOAT = 2; 35 | /** 36 | * Field type int64. 37 | * 38 | * Generated from protobuf enum TYPE_INT64 = 3; 39 | */ 40 | const TYPE_INT64 = 3; 41 | /** 42 | * Field type uint64. 43 | * 44 | * Generated from protobuf enum TYPE_UINT64 = 4; 45 | */ 46 | const TYPE_UINT64 = 4; 47 | /** 48 | * Field type int32. 49 | * 50 | * Generated from protobuf enum TYPE_INT32 = 5; 51 | */ 52 | const TYPE_INT32 = 5; 53 | /** 54 | * Field type fixed64. 55 | * 56 | * Generated from protobuf enum TYPE_FIXED64 = 6; 57 | */ 58 | const TYPE_FIXED64 = 6; 59 | /** 60 | * Field type fixed32. 61 | * 62 | * Generated from protobuf enum TYPE_FIXED32 = 7; 63 | */ 64 | const TYPE_FIXED32 = 7; 65 | /** 66 | * Field type bool. 67 | * 68 | * Generated from protobuf enum TYPE_BOOL = 8; 69 | */ 70 | const TYPE_BOOL = 8; 71 | /** 72 | * Field type string. 73 | * 74 | * Generated from protobuf enum TYPE_STRING = 9; 75 | */ 76 | const TYPE_STRING = 9; 77 | /** 78 | * Field type group. Proto2 syntax only, and deprecated. 79 | * 80 | * Generated from protobuf enum TYPE_GROUP = 10; 81 | */ 82 | const TYPE_GROUP = 10; 83 | /** 84 | * Field type message. 85 | * 86 | * Generated from protobuf enum TYPE_MESSAGE = 11; 87 | */ 88 | const TYPE_MESSAGE = 11; 89 | /** 90 | * Field type bytes. 91 | * 92 | * Generated from protobuf enum TYPE_BYTES = 12; 93 | */ 94 | const TYPE_BYTES = 12; 95 | /** 96 | * Field type uint32. 97 | * 98 | * Generated from protobuf enum TYPE_UINT32 = 13; 99 | */ 100 | const TYPE_UINT32 = 13; 101 | /** 102 | * Field type enum. 103 | * 104 | * Generated from protobuf enum TYPE_ENUM = 14; 105 | */ 106 | const TYPE_ENUM = 14; 107 | /** 108 | * Field type sfixed32. 109 | * 110 | * Generated from protobuf enum TYPE_SFIXED32 = 15; 111 | */ 112 | const TYPE_SFIXED32 = 15; 113 | /** 114 | * Field type sfixed64. 115 | * 116 | * Generated from protobuf enum TYPE_SFIXED64 = 16; 117 | */ 118 | const TYPE_SFIXED64 = 16; 119 | /** 120 | * Field type sint32. 121 | * 122 | * Generated from protobuf enum TYPE_SINT32 = 17; 123 | */ 124 | const TYPE_SINT32 = 17; 125 | /** 126 | * Field type sint64. 127 | * 128 | * Generated from protobuf enum TYPE_SINT64 = 18; 129 | */ 130 | const TYPE_SINT64 = 18; 131 | 132 | private static $valueToName = [ 133 | self::TYPE_UNKNOWN => 'TYPE_UNKNOWN', 134 | self::TYPE_DOUBLE => 'TYPE_DOUBLE', 135 | self::TYPE_FLOAT => 'TYPE_FLOAT', 136 | self::TYPE_INT64 => 'TYPE_INT64', 137 | self::TYPE_UINT64 => 'TYPE_UINT64', 138 | self::TYPE_INT32 => 'TYPE_INT32', 139 | self::TYPE_FIXED64 => 'TYPE_FIXED64', 140 | self::TYPE_FIXED32 => 'TYPE_FIXED32', 141 | self::TYPE_BOOL => 'TYPE_BOOL', 142 | self::TYPE_STRING => 'TYPE_STRING', 143 | self::TYPE_GROUP => 'TYPE_GROUP', 144 | self::TYPE_MESSAGE => 'TYPE_MESSAGE', 145 | self::TYPE_BYTES => 'TYPE_BYTES', 146 | self::TYPE_UINT32 => 'TYPE_UINT32', 147 | self::TYPE_ENUM => 'TYPE_ENUM', 148 | self::TYPE_SFIXED32 => 'TYPE_SFIXED32', 149 | self::TYPE_SFIXED64 => 'TYPE_SFIXED64', 150 | self::TYPE_SINT32 => 'TYPE_SINT32', 151 | self::TYPE_SINT64 => 'TYPE_SINT64', 152 | ]; 153 | 154 | public static function name($value) 155 | { 156 | if (!isset(self::$valueToName[$value])) { 157 | throw new UnexpectedValueException(sprintf( 158 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 159 | } 160 | return self::$valueToName[$value]; 161 | } 162 | 163 | 164 | public static function value($name) 165 | { 166 | $const = __CLASS__ . '::' . strtoupper($name); 167 | if (!defined($const)) { 168 | throw new UnexpectedValueException(sprintf( 169 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 170 | } 171 | return constant($const); 172 | } 173 | } 174 | 175 | -------------------------------------------------------------------------------- /src/Google/Protobuf/FieldDescriptor.php: -------------------------------------------------------------------------------- 1 | internal_desc = $internal_desc; 28 | } 29 | 30 | /** 31 | * @return string Field name 32 | */ 33 | public function getName() 34 | { 35 | return $this->internal_desc->getName(); 36 | } 37 | 38 | /** 39 | * @return int Protobuf field number 40 | */ 41 | public function getNumber() 42 | { 43 | return $this->internal_desc->getNumber(); 44 | } 45 | 46 | /** 47 | * @deprecated Use isRepeated() or isRequired() instead. 48 | * 49 | * @return int 50 | */ 51 | public function getLabel() 52 | { 53 | return $this->internal_desc->getLabel(); 54 | } 55 | 56 | /** 57 | * @return boolean 58 | */ 59 | public function isRequired() 60 | { 61 | return $this->internal_desc->isRequired(); 62 | } 63 | 64 | /** 65 | * @return boolean 66 | */ 67 | public function isRepeated() 68 | { 69 | return $this->internal_desc->isRepeated(); 70 | } 71 | 72 | /** 73 | * @return int 74 | */ 75 | public function getType() 76 | { 77 | return $this->internal_desc->getType(); 78 | } 79 | 80 | /** 81 | * @return OneofDescriptor 82 | */ 83 | public function getContainingOneof() 84 | { 85 | return $this->getPublicDescriptor($this->internal_desc->getContainingOneof()); 86 | } 87 | 88 | /** 89 | * Gets the field's containing oneof, only if non-synthetic. 90 | * 91 | * @return null|OneofDescriptor 92 | */ 93 | public function getRealContainingOneof() 94 | { 95 | return $this->getPublicDescriptor($this->internal_desc->getRealContainingOneof()); 96 | } 97 | 98 | /** 99 | * @return boolean 100 | */ 101 | public function hasOptionalKeyword() 102 | { 103 | return $this->internal_desc->hasOptionalKeyword(); 104 | } 105 | 106 | /** 107 | * @return Descriptor Returns a descriptor for the field type if the field type is a message, otherwise throws \Exception 108 | * @throws \Exception 109 | */ 110 | public function getMessageType() 111 | { 112 | if ($this->getType() == GPBType::MESSAGE) { 113 | return $this->getPublicDescriptor($this->internal_desc->getMessageType()); 114 | } else { 115 | throw new \Exception("Cannot get message type for non-message field '" . $this->getName() . "'"); 116 | } 117 | } 118 | 119 | /** 120 | * @return EnumDescriptor Returns an enum descriptor if the field type is an enum, otherwise throws \Exception 121 | * @throws \Exception 122 | */ 123 | public function getEnumType() 124 | { 125 | if ($this->getType() == GPBType::ENUM) { 126 | return $this->getPublicDescriptor($this->internal_desc->getEnumType()); 127 | } else { 128 | throw new \Exception("Cannot get enum type for non-enum field '" . $this->getName() . "'"); 129 | } 130 | } 131 | 132 | /** 133 | * @return boolean 134 | */ 135 | public function isMap() 136 | { 137 | return $this->internal_desc->isMap(); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Field_Cardinality.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FloatValue 19 | */ 20 | class FloatValue extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The float value. 24 | * 25 | * Generated from protobuf field float value = 1; 26 | */ 27 | protected $value = 0.0; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type float $value 36 | * The float value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The float value. 46 | * 47 | * Generated from protobuf field float value = 1; 48 | * @return float 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The float value. 57 | * 58 | * Generated from protobuf field float value = 1; 59 | * @param float $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkFloat($var); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/GPBEmpty.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Empty 21 | */ 22 | class GPBEmpty extends \Google\Protobuf\Internal\Message 23 | { 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param array $data { 29 | * Optional. Data for populating the Message object. 30 | * 31 | * } 32 | */ 33 | public function __construct($data = NULL) { 34 | \GPBMetadata\Google\Protobuf\GPBEmpty::initOnce(); 35 | parent::__construct($data); 36 | } 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Int32Value.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Int32Value 19 | */ 20 | class Int32Value extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The int32 value. 24 | * 25 | * Generated from protobuf field int32 value = 1; 26 | */ 27 | protected $value = 0; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type int $value 36 | * The int32 value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The int32 value. 46 | * 47 | * Generated from protobuf field int32 value = 1; 48 | * @return int 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The int32 value. 57 | * 58 | * Generated from protobuf field int32 value = 1; 59 | * @param int $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkInt32($var); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Int64Value.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Int64Value 19 | */ 20 | class Int64Value extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The int64 value. 24 | * 25 | * Generated from protobuf field int64 value = 1; 26 | */ 27 | protected $value = 0; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type int|string $value 36 | * The int64 value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The int64 value. 46 | * 47 | * Generated from protobuf field int64 value = 1; 48 | * @return int|string 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The int64 value. 57 | * 58 | * Generated from protobuf field int64 value = 1; 59 | * @param int|string $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkInt64($var); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/AnyBase.php: -------------------------------------------------------------------------------- 1 | type_url, 0, $url_prifix_len) != 28 | GPBUtil::TYPE_URL_PREFIX) { 29 | throw new \Exception( 30 | "Type url needs to be type.googleapis.com/fully-qulified"); 31 | } 32 | $fully_qualified_name = 33 | substr($this->type_url, $url_prifix_len); 34 | 35 | // Create message according to fully qualified name. 36 | $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); 37 | $desc = $pool->getDescriptorByProtoName($fully_qualified_name); 38 | if (is_null($desc)) { 39 | throw new \Exception("Class ".$fully_qualified_name 40 | ." hasn't been added to descriptor pool"); 41 | } 42 | $klass = $desc->getClass(); 43 | $msg = new $klass(); 44 | 45 | // Merge data into message. 46 | $msg->mergeFromString($this->value); 47 | return $msg; 48 | } 49 | 50 | /** 51 | * The type_url will be created according to the given message’s type and 52 | * the value is encoded data from the given message.. 53 | * @param Message $msg A proto message. 54 | */ 55 | public function pack($msg) 56 | { 57 | if (!$msg instanceof Message) { 58 | trigger_error("Given parameter is not a message instance.", 59 | E_USER_ERROR); 60 | return; 61 | } 62 | 63 | // Set value using serialized message. 64 | $this->value = $msg->serializeToString(); 65 | 66 | // Set type url. 67 | $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); 68 | $desc = $pool->getDescriptorByClassName(get_class($msg)); 69 | $fully_qualified_name = $desc->getFullName(); 70 | $this->type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualified_name; 71 | } 72 | 73 | /** 74 | * This method returns whether the type_url in any_message is corresponded 75 | * to the given class. 76 | * @param string $klass The fully qualified PHP class name of a proto message type. 77 | */ 78 | public function is($klass) 79 | { 80 | $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool(); 81 | $desc = $pool->getDescriptorByClassName($klass); 82 | $fully_qualified_name = $desc->getFullName(); 83 | $type_url = GPBUtil::TYPE_URL_PREFIX . $fully_qualified_name; 84 | return $this->type_url === $type_url; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/CodedOutputStream.php: -------------------------------------------------------------------------------- 1 | current = 0; 25 | $this->buffer_size = $size; 26 | $this->buffer = str_repeat(chr(0), $this->buffer_size); 27 | $this->options = $options; 28 | } 29 | 30 | public function getData() 31 | { 32 | return $this->buffer; 33 | } 34 | 35 | public function getOptions() 36 | { 37 | return $this->options; 38 | } 39 | 40 | public function writeVarint32($value, $trim) 41 | { 42 | $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES); 43 | $size = self::writeVarintToArray($value, $bytes, $trim); 44 | return $this->writeRaw($bytes, $size); 45 | } 46 | 47 | public function writeVarint64($value) 48 | { 49 | $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES); 50 | $size = self::writeVarintToArray($value, $bytes); 51 | return $this->writeRaw($bytes, $size); 52 | } 53 | 54 | public function writeLittleEndian32($value) 55 | { 56 | $bytes = str_repeat(chr(0), 4); 57 | $size = self::writeLittleEndian32ToArray($value, $bytes); 58 | return $this->writeRaw($bytes, $size); 59 | } 60 | 61 | public function writeLittleEndian64($value) 62 | { 63 | $bytes = str_repeat(chr(0), 8); 64 | $size = self::writeLittleEndian64ToArray($value, $bytes); 65 | return $this->writeRaw($bytes, $size); 66 | } 67 | 68 | public function writeTag($tag) 69 | { 70 | return $this->writeVarint32($tag, true); 71 | } 72 | 73 | public function writeRaw($data, $size) 74 | { 75 | if ($this->buffer_size < $size) { 76 | trigger_error("Output stream doesn't have enough buffer."); 77 | return false; 78 | } 79 | 80 | for ($i = 0; $i < $size; $i++) { 81 | $this->buffer[$this->current] = $data[$i]; 82 | $this->current++; 83 | $this->buffer_size--; 84 | } 85 | return true; 86 | } 87 | 88 | public static function writeVarintToArray($value, &$buffer, $trim = false) 89 | { 90 | $current = 0; 91 | 92 | $high = 0; 93 | $low = 0; 94 | if (PHP_INT_SIZE == 4) { 95 | GPBUtil::divideInt64ToInt32($value, $high, $low, $trim); 96 | } else { 97 | $low = $value; 98 | } 99 | 100 | while (($low >= 0x80 || $low < 0) || $high != 0) { 101 | $buffer[$current] = chr($low | 0x80); 102 | $value = ($value >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); 103 | $carry = ($high & 0x7F) << ((PHP_INT_SIZE << 3) - 7); 104 | $high = ($high >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)); 105 | $low = (($low >> 7) & ~(0x7F << ((PHP_INT_SIZE << 3) - 7)) | $carry); 106 | $current++; 107 | } 108 | $buffer[$current] = chr($low); 109 | return $current + 1; 110 | } 111 | 112 | private static function writeLittleEndian32ToArray($value, &$buffer) 113 | { 114 | $buffer[0] = chr($value & 0x000000FF); 115 | $buffer[1] = chr(($value >> 8) & 0x000000FF); 116 | $buffer[2] = chr(($value >> 16) & 0x000000FF); 117 | $buffer[3] = chr(($value >> 24) & 0x000000FF); 118 | return 4; 119 | } 120 | 121 | private static function writeLittleEndian64ToArray($value, &$buffer) 122 | { 123 | $high = 0; 124 | $low = 0; 125 | if (PHP_INT_SIZE == 4) { 126 | GPBUtil::divideInt64ToInt32($value, $high, $low); 127 | } else { 128 | $low = $value & 0xFFFFFFFF; 129 | $high = ($value >> 32) & 0xFFFFFFFF; 130 | } 131 | 132 | $buffer[0] = chr($low & 0x000000FF); 133 | $buffer[1] = chr(($low >> 8) & 0x000000FF); 134 | $buffer[2] = chr(($low >> 16) & 0x000000FF); 135 | $buffer[3] = chr(($low >> 24) & 0x000000FF); 136 | $buffer[4] = chr($high & 0x000000FF); 137 | $buffer[5] = chr(($high >> 8) & 0x000000FF); 138 | $buffer[6] = chr(($high >> 16) & 0x000000FF); 139 | $buffer[7] = chr(($high >> 24) & 0x000000FF); 140 | return 8; 141 | } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/Descriptor.php: -------------------------------------------------------------------------------- 1 | public_desc = new \Google\Protobuf\Descriptor($this); 32 | } 33 | 34 | public function addOneofDecl($oneof) 35 | { 36 | $this->oneof_decl[] = $oneof; 37 | } 38 | 39 | public function getOneofDecl() 40 | { 41 | return $this->oneof_decl; 42 | } 43 | 44 | public function setFullName($full_name) 45 | { 46 | $this->full_name = $full_name; 47 | } 48 | 49 | public function getFullName() 50 | { 51 | return $this->full_name; 52 | } 53 | 54 | public function addField($field) 55 | { 56 | $this->field[$field->getNumber()] = $field; 57 | $this->json_to_field[$field->getJsonName()] = $field; 58 | $this->name_to_field[$field->getName()] = $field; 59 | $this->index_to_field[] = $field; 60 | } 61 | 62 | public function getField() 63 | { 64 | return $this->field; 65 | } 66 | 67 | public function addNestedType($desc) 68 | { 69 | $this->nested_type[] = $desc; 70 | } 71 | 72 | public function getNestedType() 73 | { 74 | return $this->nested_type; 75 | } 76 | 77 | public function addEnumType($desc) 78 | { 79 | $this->enum_type[] = $desc; 80 | } 81 | 82 | public function getEnumType() 83 | { 84 | return $this->enum_type; 85 | } 86 | 87 | public function getFieldByNumber($number) 88 | { 89 | if (!isset($this->field[$number])) { 90 | return NULL; 91 | } else { 92 | return $this->field[$number]; 93 | } 94 | } 95 | 96 | public function getFieldByJsonName($json_name) 97 | { 98 | if (!isset($this->json_to_field[$json_name])) { 99 | return NULL; 100 | } else { 101 | return $this->json_to_field[$json_name]; 102 | } 103 | } 104 | 105 | public function getFieldByName($name) 106 | { 107 | if (!isset($this->name_to_field[$name])) { 108 | return NULL; 109 | } else { 110 | return $this->name_to_field[$name]; 111 | } 112 | } 113 | 114 | public function getFieldByIndex($index) 115 | { 116 | if (count($this->index_to_field) <= $index) { 117 | return NULL; 118 | } else { 119 | return $this->index_to_field[$index]; 120 | } 121 | } 122 | 123 | public function setClass($klass) 124 | { 125 | $this->klass = $klass; 126 | } 127 | 128 | public function getClass() 129 | { 130 | return $this->klass; 131 | } 132 | 133 | public function setLegacyClass($klass) 134 | { 135 | $this->legacy_klass = $klass; 136 | } 137 | 138 | public function getLegacyClass() 139 | { 140 | return $this->legacy_klass; 141 | } 142 | 143 | public function setPreviouslyUnreservedClass($klass) 144 | { 145 | $this->previous_klass = $klass; 146 | } 147 | 148 | public function getPreviouslyUnreservedClass() 149 | { 150 | return $this->previous_klass; 151 | } 152 | 153 | public function setOptions($options) 154 | { 155 | $this->options = $options; 156 | } 157 | 158 | public function getOptions() 159 | { 160 | return $this->options; 161 | } 162 | 163 | public static function buildFromProto($proto, $file_proto, $containing) 164 | { 165 | $desc = new Descriptor(); 166 | 167 | $message_name_without_package = ""; 168 | $classname = ""; 169 | $legacy_classname = ""; 170 | $previous_classname = ""; 171 | $fullname = ""; 172 | GPBUtil::getFullClassName( 173 | $proto, 174 | $containing, 175 | $file_proto, 176 | $message_name_without_package, 177 | $classname, 178 | $legacy_classname, 179 | $fullname, 180 | $previous_classname); 181 | $desc->setFullName($fullname); 182 | $desc->setClass($classname); 183 | $desc->setLegacyClass($legacy_classname); 184 | $desc->setPreviouslyUnreservedClass($previous_classname); 185 | $desc->setOptions($proto->getOptions()); 186 | 187 | foreach ($proto->getField() as $field_proto) { 188 | $desc->addField(FieldDescriptor::buildFromProto($field_proto)); 189 | } 190 | 191 | // Handle nested types. 192 | foreach ($proto->getNestedType() as $nested_proto) { 193 | $desc->addNestedType(Descriptor::buildFromProto( 194 | $nested_proto, $file_proto, $message_name_without_package)); 195 | } 196 | 197 | // Handle nested enum. 198 | foreach ($proto->getEnumType() as $enum_proto) { 199 | $desc->addEnumType(EnumDescriptor::buildFromProto( 200 | $enum_proto, $file_proto, $message_name_without_package)); 201 | } 202 | 203 | // Handle oneof fields. 204 | $index = 0; 205 | foreach ($proto->getOneofDecl() as $oneof_proto) { 206 | $desc->addOneofDecl( 207 | OneofDescriptor::buildFromProto($oneof_proto, $desc, $index)); 208 | $index++; 209 | } 210 | 211 | return $desc; 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php: -------------------------------------------------------------------------------- 1 | google.protobuf.DescriptorProto.ExtensionRange 16 | */ 17 | class ExtensionRange extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Inclusive. 21 | * 22 | * Generated from protobuf field optional int32 start = 1; 23 | */ 24 | protected $start = null; 25 | /** 26 | * Exclusive. 27 | * 28 | * Generated from protobuf field optional int32 end = 2; 29 | */ 30 | protected $end = null; 31 | /** 32 | * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; 33 | */ 34 | protected $options = null; 35 | 36 | /** 37 | * Constructor. 38 | * 39 | * @param array $data { 40 | * Optional. Data for populating the Message object. 41 | * 42 | * @type int $start 43 | * Inclusive. 44 | * @type int $end 45 | * Exclusive. 46 | * @type \Google\Protobuf\Internal\ExtensionRangeOptions $options 47 | * } 48 | */ 49 | public function __construct($data = NULL) { 50 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 51 | parent::__construct($data); 52 | } 53 | 54 | /** 55 | * Inclusive. 56 | * 57 | * Generated from protobuf field optional int32 start = 1; 58 | * @return int 59 | */ 60 | public function getStart() 61 | { 62 | return isset($this->start) ? $this->start : 0; 63 | } 64 | 65 | public function hasStart() 66 | { 67 | return isset($this->start); 68 | } 69 | 70 | public function clearStart() 71 | { 72 | unset($this->start); 73 | } 74 | 75 | /** 76 | * Inclusive. 77 | * 78 | * Generated from protobuf field optional int32 start = 1; 79 | * @param int $var 80 | * @return $this 81 | */ 82 | public function setStart($var) 83 | { 84 | GPBUtil::checkInt32($var); 85 | $this->start = $var; 86 | 87 | return $this; 88 | } 89 | 90 | /** 91 | * Exclusive. 92 | * 93 | * Generated from protobuf field optional int32 end = 2; 94 | * @return int 95 | */ 96 | public function getEnd() 97 | { 98 | return isset($this->end) ? $this->end : 0; 99 | } 100 | 101 | public function hasEnd() 102 | { 103 | return isset($this->end); 104 | } 105 | 106 | public function clearEnd() 107 | { 108 | unset($this->end); 109 | } 110 | 111 | /** 112 | * Exclusive. 113 | * 114 | * Generated from protobuf field optional int32 end = 2; 115 | * @param int $var 116 | * @return $this 117 | */ 118 | public function setEnd($var) 119 | { 120 | GPBUtil::checkInt32($var); 121 | $this->end = $var; 122 | 123 | return $this; 124 | } 125 | 126 | /** 127 | * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; 128 | * @return \Google\Protobuf\Internal\ExtensionRangeOptions|null 129 | */ 130 | public function getOptions() 131 | { 132 | return $this->options; 133 | } 134 | 135 | public function hasOptions() 136 | { 137 | return isset($this->options); 138 | } 139 | 140 | public function clearOptions() 141 | { 142 | unset($this->options); 143 | } 144 | 145 | /** 146 | * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; 147 | * @param \Google\Protobuf\Internal\ExtensionRangeOptions $var 148 | * @return $this 149 | */ 150 | public function setOptions($var) 151 | { 152 | GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ExtensionRangeOptions::class); 153 | $this->options = $var; 154 | 155 | return $this; 156 | } 157 | 158 | } 159 | 160 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php: -------------------------------------------------------------------------------- 1 | google.protobuf.DescriptorProto.ReservedRange 20 | */ 21 | class ReservedRange extends \Google\Protobuf\Internal\Message 22 | { 23 | /** 24 | * Inclusive. 25 | * 26 | * Generated from protobuf field optional int32 start = 1; 27 | */ 28 | protected $start = null; 29 | /** 30 | * Exclusive. 31 | * 32 | * Generated from protobuf field optional int32 end = 2; 33 | */ 34 | protected $end = null; 35 | 36 | /** 37 | * Constructor. 38 | * 39 | * @param array $data { 40 | * Optional. Data for populating the Message object. 41 | * 42 | * @type int $start 43 | * Inclusive. 44 | * @type int $end 45 | * Exclusive. 46 | * } 47 | */ 48 | public function __construct($data = NULL) { 49 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 50 | parent::__construct($data); 51 | } 52 | 53 | /** 54 | * Inclusive. 55 | * 56 | * Generated from protobuf field optional int32 start = 1; 57 | * @return int 58 | */ 59 | public function getStart() 60 | { 61 | return isset($this->start) ? $this->start : 0; 62 | } 63 | 64 | public function hasStart() 65 | { 66 | return isset($this->start); 67 | } 68 | 69 | public function clearStart() 70 | { 71 | unset($this->start); 72 | } 73 | 74 | /** 75 | * Inclusive. 76 | * 77 | * Generated from protobuf field optional int32 start = 1; 78 | * @param int $var 79 | * @return $this 80 | */ 81 | public function setStart($var) 82 | { 83 | GPBUtil::checkInt32($var); 84 | $this->start = $var; 85 | 86 | return $this; 87 | } 88 | 89 | /** 90 | * Exclusive. 91 | * 92 | * Generated from protobuf field optional int32 end = 2; 93 | * @return int 94 | */ 95 | public function getEnd() 96 | { 97 | return isset($this->end) ? $this->end : 0; 98 | } 99 | 100 | public function hasEnd() 101 | { 102 | return isset($this->end); 103 | } 104 | 105 | public function clearEnd() 106 | { 107 | unset($this->end); 108 | } 109 | 110 | /** 111 | * Exclusive. 112 | * 113 | * Generated from protobuf field optional int32 end = 2; 114 | * @param int $var 115 | * @return $this 116 | */ 117 | public function setEnd($var) 118 | { 119 | GPBUtil::checkInt32($var); 120 | $this->end = $var; 121 | 122 | return $this; 123 | } 124 | 125 | } 126 | 127 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/Edition.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Edition 14 | */ 15 | class Edition 16 | { 17 | /** 18 | * A placeholder for an unknown edition value. 19 | * 20 | * Generated from protobuf enum EDITION_UNKNOWN = 0; 21 | */ 22 | const EDITION_UNKNOWN = 0; 23 | /** 24 | * A placeholder edition for specifying default behaviors *before* a feature 25 | * was first introduced. This is effectively an "infinite past". 26 | * 27 | * Generated from protobuf enum EDITION_LEGACY = 900; 28 | */ 29 | const EDITION_LEGACY = 900; 30 | /** 31 | * Legacy syntax "editions". These pre-date editions, but behave much like 32 | * distinct editions. These can't be used to specify the edition of proto 33 | * files, but feature definitions must supply proto2/proto3 defaults for 34 | * backwards compatibility. 35 | * 36 | * Generated from protobuf enum EDITION_PROTO2 = 998; 37 | */ 38 | const EDITION_PROTO2 = 998; 39 | /** 40 | * Generated from protobuf enum EDITION_PROTO3 = 999; 41 | */ 42 | const EDITION_PROTO3 = 999; 43 | /** 44 | * Editions that have been released. The specific values are arbitrary and 45 | * should not be depended on, but they will always be time-ordered for easy 46 | * comparison. 47 | * 48 | * Generated from protobuf enum EDITION_2023 = 1000; 49 | */ 50 | const EDITION_2023 = 1000; 51 | /** 52 | * Generated from protobuf enum EDITION_2024 = 1001; 53 | */ 54 | const EDITION_2024 = 1001; 55 | /** 56 | * Placeholder editions for testing feature resolution. These should not be 57 | * used or relied on outside of tests. 58 | * 59 | * Generated from protobuf enum EDITION_1_TEST_ONLY = 1; 60 | */ 61 | const EDITION_1_TEST_ONLY = 1; 62 | /** 63 | * Generated from protobuf enum EDITION_2_TEST_ONLY = 2; 64 | */ 65 | const EDITION_2_TEST_ONLY = 2; 66 | /** 67 | * Generated from protobuf enum EDITION_99997_TEST_ONLY = 99997; 68 | */ 69 | const EDITION_99997_TEST_ONLY = 99997; 70 | /** 71 | * Generated from protobuf enum EDITION_99998_TEST_ONLY = 99998; 72 | */ 73 | const EDITION_99998_TEST_ONLY = 99998; 74 | /** 75 | * Generated from protobuf enum EDITION_99999_TEST_ONLY = 99999; 76 | */ 77 | const EDITION_99999_TEST_ONLY = 99999; 78 | /** 79 | * Placeholder for specifying unbounded edition support. This should only 80 | * ever be used by plugins that can expect to never require any changes to 81 | * support a new edition. 82 | * 83 | * Generated from protobuf enum EDITION_MAX = 2147483647; 84 | */ 85 | const EDITION_MAX = 2147483647; 86 | 87 | private static $valueToName = [ 88 | self::EDITION_UNKNOWN => 'EDITION_UNKNOWN', 89 | self::EDITION_LEGACY => 'EDITION_LEGACY', 90 | self::EDITION_PROTO2 => 'EDITION_PROTO2', 91 | self::EDITION_PROTO3 => 'EDITION_PROTO3', 92 | self::EDITION_2023 => 'EDITION_2023', 93 | self::EDITION_2024 => 'EDITION_2024', 94 | self::EDITION_1_TEST_ONLY => 'EDITION_1_TEST_ONLY', 95 | self::EDITION_2_TEST_ONLY => 'EDITION_2_TEST_ONLY', 96 | self::EDITION_99997_TEST_ONLY => 'EDITION_99997_TEST_ONLY', 97 | self::EDITION_99998_TEST_ONLY => 'EDITION_99998_TEST_ONLY', 98 | self::EDITION_99999_TEST_ONLY => 'EDITION_99999_TEST_ONLY', 99 | self::EDITION_MAX => 'EDITION_MAX', 100 | ]; 101 | 102 | public static function name($value) 103 | { 104 | if (!isset(self::$valueToName[$value])) { 105 | throw new UnexpectedValueException(sprintf( 106 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 107 | } 108 | return self::$valueToName[$value]; 109 | } 110 | 111 | 112 | public static function value($name) 113 | { 114 | $const = __CLASS__ . '::' . strtoupper($name); 115 | if (!defined($const)) { 116 | throw new UnexpectedValueException(sprintf( 117 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 118 | } 119 | return constant($const); 120 | } 121 | } 122 | 123 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/EnumBuilderContext.php: -------------------------------------------------------------------------------- 1 | descriptor = new EnumDescriptor(); 24 | $this->descriptor->setFullName($full_name); 25 | $this->descriptor->setClass($klass); 26 | $this->pool = $pool; 27 | } 28 | 29 | public function value($name, $number) 30 | { 31 | $value = new EnumValueDescriptor($name, $number); 32 | $this->descriptor->addValue($number, $value); 33 | return $this; 34 | } 35 | 36 | public function finalizeToPool() 37 | { 38 | $this->pool->addEnumDescriptor($this->descriptor); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/EnumDescriptor.php: -------------------------------------------------------------------------------- 1 | public_desc = new \Google\Protobuf\EnumDescriptor($this); 21 | } 22 | 23 | public function setFullName($full_name) 24 | { 25 | $this->full_name = $full_name; 26 | } 27 | 28 | public function getFullName() 29 | { 30 | return $this->full_name; 31 | } 32 | 33 | public function addValue($number, $value) 34 | { 35 | $this->value[$number] = $value; 36 | $this->name_to_value[$value->getName()] = $value; 37 | $this->value_descriptor[] = new EnumValueDescriptor($value->getName(), $number); 38 | } 39 | 40 | public function getValueByNumber($number) 41 | { 42 | if (isset($this->value[$number])) { 43 | return $this->value[$number]; 44 | } 45 | return null; 46 | } 47 | 48 | public function getValueByName($name) 49 | { 50 | if (isset($this->name_to_value[$name])) { 51 | return $this->name_to_value[$name]; 52 | } 53 | return null; 54 | } 55 | 56 | public function getValueDescriptorByIndex($index) 57 | { 58 | if (isset($this->value_descriptor[$index])) { 59 | return $this->value_descriptor[$index]; 60 | } 61 | return null; 62 | } 63 | 64 | public function getValueCount() 65 | { 66 | return count($this->value); 67 | } 68 | 69 | public function setClass($klass) 70 | { 71 | $this->klass = $klass; 72 | } 73 | 74 | public function getClass() 75 | { 76 | return $this->klass; 77 | } 78 | 79 | public function setLegacyClass($klass) 80 | { 81 | $this->legacy_klass = $klass; 82 | } 83 | 84 | public function getLegacyClass() 85 | { 86 | return $this->legacy_klass; 87 | } 88 | 89 | public static function buildFromProto($proto, $file_proto, $containing) 90 | { 91 | $desc = new EnumDescriptor(); 92 | 93 | $enum_name_without_package = ""; 94 | $classname = ""; 95 | $legacy_classname = ""; 96 | $fullname = ""; 97 | GPBUtil::getFullClassName( 98 | $proto, 99 | $containing, 100 | $file_proto, 101 | $enum_name_without_package, 102 | $classname, 103 | $legacy_classname, 104 | $fullname, 105 | $unused_previous_classname); 106 | $desc->setFullName($fullname); 107 | $desc->setClass($classname); 108 | $desc->setLegacyClass($legacy_classname); 109 | $values = $proto->getValue(); 110 | foreach ($values as $value) { 111 | $desc->addValue($value->getNumber(), $value); 112 | } 113 | 114 | return $desc; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php: -------------------------------------------------------------------------------- 1 | google.protobuf.EnumDescriptorProto.EnumReservedRange 22 | */ 23 | class EnumReservedRange extends \Google\Protobuf\Internal\Message 24 | { 25 | /** 26 | * Inclusive. 27 | * 28 | * Generated from protobuf field optional int32 start = 1; 29 | */ 30 | protected $start = null; 31 | /** 32 | * Inclusive. 33 | * 34 | * Generated from protobuf field optional int32 end = 2; 35 | */ 36 | protected $end = null; 37 | 38 | /** 39 | * Constructor. 40 | * 41 | * @param array $data { 42 | * Optional. Data for populating the Message object. 43 | * 44 | * @type int $start 45 | * Inclusive. 46 | * @type int $end 47 | * Inclusive. 48 | * } 49 | */ 50 | public function __construct($data = NULL) { 51 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 52 | parent::__construct($data); 53 | } 54 | 55 | /** 56 | * Inclusive. 57 | * 58 | * Generated from protobuf field optional int32 start = 1; 59 | * @return int 60 | */ 61 | public function getStart() 62 | { 63 | return isset($this->start) ? $this->start : 0; 64 | } 65 | 66 | public function hasStart() 67 | { 68 | return isset($this->start); 69 | } 70 | 71 | public function clearStart() 72 | { 73 | unset($this->start); 74 | } 75 | 76 | /** 77 | * Inclusive. 78 | * 79 | * Generated from protobuf field optional int32 start = 1; 80 | * @param int $var 81 | * @return $this 82 | */ 83 | public function setStart($var) 84 | { 85 | GPBUtil::checkInt32($var); 86 | $this->start = $var; 87 | 88 | return $this; 89 | } 90 | 91 | /** 92 | * Inclusive. 93 | * 94 | * Generated from protobuf field optional int32 end = 2; 95 | * @return int 96 | */ 97 | public function getEnd() 98 | { 99 | return isset($this->end) ? $this->end : 0; 100 | } 101 | 102 | public function hasEnd() 103 | { 104 | return isset($this->end); 105 | } 106 | 107 | public function clearEnd() 108 | { 109 | unset($this->end); 110 | } 111 | 112 | /** 113 | * Inclusive. 114 | * 115 | * Generated from protobuf field optional int32 end = 2; 116 | * @param int $var 117 | * @return $this 118 | */ 119 | public function setEnd($var) 120 | { 121 | GPBUtil::checkInt32($var); 122 | $this->end = $var; 123 | 124 | return $this; 125 | } 126 | 127 | } 128 | 129 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/EnumValueDescriptorProto.php: -------------------------------------------------------------------------------- 1 | google.protobuf.EnumValueDescriptorProto 18 | */ 19 | class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message 20 | { 21 | /** 22 | * Generated from protobuf field optional string name = 1; 23 | */ 24 | protected $name = null; 25 | /** 26 | * Generated from protobuf field optional int32 number = 2; 27 | */ 28 | protected $number = null; 29 | /** 30 | * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; 31 | */ 32 | protected $options = null; 33 | 34 | /** 35 | * Constructor. 36 | * 37 | * @param array $data { 38 | * Optional. Data for populating the Message object. 39 | * 40 | * @type string $name 41 | * @type int $number 42 | * @type \Google\Protobuf\Internal\EnumValueOptions $options 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * Generated from protobuf field optional string name = 1; 52 | * @return string 53 | */ 54 | public function getName() 55 | { 56 | return isset($this->name) ? $this->name : ''; 57 | } 58 | 59 | public function hasName() 60 | { 61 | return isset($this->name); 62 | } 63 | 64 | public function clearName() 65 | { 66 | unset($this->name); 67 | } 68 | 69 | /** 70 | * Generated from protobuf field optional string name = 1; 71 | * @param string $var 72 | * @return $this 73 | */ 74 | public function setName($var) 75 | { 76 | GPBUtil::checkString($var, True); 77 | $this->name = $var; 78 | 79 | return $this; 80 | } 81 | 82 | /** 83 | * Generated from protobuf field optional int32 number = 2; 84 | * @return int 85 | */ 86 | public function getNumber() 87 | { 88 | return isset($this->number) ? $this->number : 0; 89 | } 90 | 91 | public function hasNumber() 92 | { 93 | return isset($this->number); 94 | } 95 | 96 | public function clearNumber() 97 | { 98 | unset($this->number); 99 | } 100 | 101 | /** 102 | * Generated from protobuf field optional int32 number = 2; 103 | * @param int $var 104 | * @return $this 105 | */ 106 | public function setNumber($var) 107 | { 108 | GPBUtil::checkInt32($var); 109 | $this->number = $var; 110 | 111 | return $this; 112 | } 113 | 114 | /** 115 | * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; 116 | * @return \Google\Protobuf\Internal\EnumValueOptions|null 117 | */ 118 | public function getOptions() 119 | { 120 | return $this->options; 121 | } 122 | 123 | public function hasOptions() 124 | { 125 | return isset($this->options); 126 | } 127 | 128 | public function clearOptions() 129 | { 130 | unset($this->options); 131 | } 132 | 133 | /** 134 | * Generated from protobuf field optional .google.protobuf.EnumValueOptions options = 3; 135 | * @param \Google\Protobuf\Internal\EnumValueOptions $var 136 | * @return $this 137 | */ 138 | public function setOptions($var) 139 | { 140 | GPBUtil::checkMessage($var, \Google\Protobuf\Internal\EnumValueOptions::class); 141 | $this->options = $var; 142 | 143 | return $this; 144 | } 145 | 146 | } 147 | 148 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/ExtensionRangeOptions/VerificationState.php: -------------------------------------------------------------------------------- 1 | google.protobuf.ExtensionRangeOptions.VerificationState 14 | */ 15 | class VerificationState 16 | { 17 | /** 18 | * All the extensions of the range must be declared. 19 | * 20 | * Generated from protobuf enum DECLARATION = 0; 21 | */ 22 | const DECLARATION = 0; 23 | /** 24 | * Generated from protobuf enum UNVERIFIED = 1; 25 | */ 26 | const UNVERIFIED = 1; 27 | 28 | private static $valueToName = [ 29 | self::DECLARATION => 'DECLARATION', 30 | self::UNVERIFIED => 'UNVERIFIED', 31 | ]; 32 | 33 | public static function name($value) 34 | { 35 | if (!isset(self::$valueToName[$value])) { 36 | throw new UnexpectedValueException(sprintf( 37 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 38 | } 39 | return self::$valueToName[$value]; 40 | } 41 | 42 | 43 | public static function value($name) 44 | { 45 | $const = __CLASS__ . '::' . strtoupper($name); 46 | if (!defined($const)) { 47 | throw new UnexpectedValueException(sprintf( 48 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 49 | } 50 | return constant($const); 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/EnforceNamingStyle.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.EnforceNamingStyle 12 | */ 13 | class EnforceNamingStyle 14 | { 15 | /** 16 | * Generated from protobuf enum ENFORCE_NAMING_STYLE_UNKNOWN = 0; 17 | */ 18 | const ENFORCE_NAMING_STYLE_UNKNOWN = 0; 19 | /** 20 | * Generated from protobuf enum STYLE2024 = 1; 21 | */ 22 | const STYLE2024 = 1; 23 | /** 24 | * Generated from protobuf enum STYLE_LEGACY = 2; 25 | */ 26 | const STYLE_LEGACY = 2; 27 | 28 | private static $valueToName = [ 29 | self::ENFORCE_NAMING_STYLE_UNKNOWN => 'ENFORCE_NAMING_STYLE_UNKNOWN', 30 | self::STYLE2024 => 'STYLE2024', 31 | self::STYLE_LEGACY => 'STYLE_LEGACY', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/EnumType.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.EnumType 12 | */ 13 | class EnumType 14 | { 15 | /** 16 | * Generated from protobuf enum ENUM_TYPE_UNKNOWN = 0; 17 | */ 18 | const ENUM_TYPE_UNKNOWN = 0; 19 | /** 20 | * Generated from protobuf enum OPEN = 1; 21 | */ 22 | const OPEN = 1; 23 | /** 24 | * Generated from protobuf enum CLOSED = 2; 25 | */ 26 | const CLOSED = 2; 27 | 28 | private static $valueToName = [ 29 | self::ENUM_TYPE_UNKNOWN => 'ENUM_TYPE_UNKNOWN', 30 | self::OPEN => 'OPEN', 31 | self::CLOSED => 'CLOSED', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/FieldPresence.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.FieldPresence 12 | */ 13 | class FieldPresence 14 | { 15 | /** 16 | * Generated from protobuf enum FIELD_PRESENCE_UNKNOWN = 0; 17 | */ 18 | const FIELD_PRESENCE_UNKNOWN = 0; 19 | /** 20 | * Generated from protobuf enum EXPLICIT = 1; 21 | */ 22 | const EXPLICIT = 1; 23 | /** 24 | * Generated from protobuf enum IMPLICIT = 2; 25 | */ 26 | const IMPLICIT = 2; 27 | /** 28 | * Generated from protobuf enum LEGACY_REQUIRED = 3; 29 | */ 30 | const LEGACY_REQUIRED = 3; 31 | 32 | private static $valueToName = [ 33 | self::FIELD_PRESENCE_UNKNOWN => 'FIELD_PRESENCE_UNKNOWN', 34 | self::EXPLICIT => 'EXPLICIT', 35 | self::IMPLICIT => 'IMPLICIT', 36 | self::LEGACY_REQUIRED => 'LEGACY_REQUIRED', 37 | ]; 38 | 39 | public static function name($value) 40 | { 41 | if (!isset(self::$valueToName[$value])) { 42 | throw new UnexpectedValueException(sprintf( 43 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 44 | } 45 | return self::$valueToName[$value]; 46 | } 47 | 48 | 49 | public static function value($name) 50 | { 51 | $const = __CLASS__ . '::' . strtoupper($name); 52 | if (!defined($const)) { 53 | throw new UnexpectedValueException(sprintf( 54 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 55 | } 56 | return constant($const); 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/JsonFormat.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.JsonFormat 12 | */ 13 | class JsonFormat 14 | { 15 | /** 16 | * Generated from protobuf enum JSON_FORMAT_UNKNOWN = 0; 17 | */ 18 | const JSON_FORMAT_UNKNOWN = 0; 19 | /** 20 | * Generated from protobuf enum ALLOW = 1; 21 | */ 22 | const ALLOW = 1; 23 | /** 24 | * Generated from protobuf enum LEGACY_BEST_EFFORT = 2; 25 | */ 26 | const LEGACY_BEST_EFFORT = 2; 27 | 28 | private static $valueToName = [ 29 | self::JSON_FORMAT_UNKNOWN => 'JSON_FORMAT_UNKNOWN', 30 | self::ALLOW => 'ALLOW', 31 | self::LEGACY_BEST_EFFORT => 'LEGACY_BEST_EFFORT', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/MessageEncoding.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.MessageEncoding 12 | */ 13 | class MessageEncoding 14 | { 15 | /** 16 | * Generated from protobuf enum MESSAGE_ENCODING_UNKNOWN = 0; 17 | */ 18 | const MESSAGE_ENCODING_UNKNOWN = 0; 19 | /** 20 | * Generated from protobuf enum LENGTH_PREFIXED = 1; 21 | */ 22 | const LENGTH_PREFIXED = 1; 23 | /** 24 | * Generated from protobuf enum DELIMITED = 2; 25 | */ 26 | const DELIMITED = 2; 27 | 28 | private static $valueToName = [ 29 | self::MESSAGE_ENCODING_UNKNOWN => 'MESSAGE_ENCODING_UNKNOWN', 30 | self::LENGTH_PREFIXED => 'LENGTH_PREFIXED', 31 | self::DELIMITED => 'DELIMITED', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/RepeatedFieldEncoding.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.RepeatedFieldEncoding 12 | */ 13 | class RepeatedFieldEncoding 14 | { 15 | /** 16 | * Generated from protobuf enum REPEATED_FIELD_ENCODING_UNKNOWN = 0; 17 | */ 18 | const REPEATED_FIELD_ENCODING_UNKNOWN = 0; 19 | /** 20 | * Generated from protobuf enum PACKED = 1; 21 | */ 22 | const PACKED = 1; 23 | /** 24 | * Generated from protobuf enum EXPANDED = 2; 25 | */ 26 | const EXPANDED = 2; 27 | 28 | private static $valueToName = [ 29 | self::REPEATED_FIELD_ENCODING_UNKNOWN => 'REPEATED_FIELD_ENCODING_UNKNOWN', 30 | self::PACKED => 'PACKED', 31 | self::EXPANDED => 'EXPANDED', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/Utf8Validation.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.Utf8Validation 12 | */ 13 | class Utf8Validation 14 | { 15 | /** 16 | * Generated from protobuf enum UTF8_VALIDATION_UNKNOWN = 0; 17 | */ 18 | const UTF8_VALIDATION_UNKNOWN = 0; 19 | /** 20 | * Generated from protobuf enum VERIFY = 2; 21 | */ 22 | const VERIFY = 2; 23 | /** 24 | * Generated from protobuf enum NONE = 3; 25 | */ 26 | const NONE = 3; 27 | 28 | private static $valueToName = [ 29 | self::UTF8_VALIDATION_UNKNOWN => 'UTF8_VALIDATION_UNKNOWN', 30 | self::VERIFY => 'VERIFY', 31 | self::NONE => 'NONE', 32 | ]; 33 | 34 | public static function name($value) 35 | { 36 | if (!isset(self::$valueToName[$value])) { 37 | throw new UnexpectedValueException(sprintf( 38 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 39 | } 40 | return self::$valueToName[$value]; 41 | } 42 | 43 | 44 | public static function value($name) 45 | { 46 | $const = __CLASS__ . '::' . strtoupper($name); 47 | if (!defined($const)) { 48 | throw new UnexpectedValueException(sprintf( 49 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 50 | } 51 | return constant($const); 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/VisibilityFeature.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.VisibilityFeature 16 | */ 17 | class VisibilityFeature extends \Google\Protobuf\Internal\Message 18 | { 19 | 20 | /** 21 | * Constructor. 22 | * 23 | * @param array $data { 24 | * Optional. Data for populating the Message object. 25 | * 26 | * } 27 | */ 28 | public function __construct($data = NULL) { 29 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 30 | parent::__construct($data); 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSet/VisibilityFeature/DefaultSymbolVisibility.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility 12 | */ 13 | class DefaultSymbolVisibility 14 | { 15 | /** 16 | * Generated from protobuf enum DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0; 17 | */ 18 | const DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0; 19 | /** 20 | * Default pre-EDITION_2024, all UNSET visibility are export. 21 | * 22 | * Generated from protobuf enum EXPORT_ALL = 1; 23 | */ 24 | const EXPORT_ALL = 1; 25 | /** 26 | * All top-level symbols default to export, nested default to local. 27 | * 28 | * Generated from protobuf enum EXPORT_TOP_LEVEL = 2; 29 | */ 30 | const EXPORT_TOP_LEVEL = 2; 31 | /** 32 | * All symbols default to local. 33 | * 34 | * Generated from protobuf enum LOCAL_ALL = 3; 35 | */ 36 | const LOCAL_ALL = 3; 37 | /** 38 | * All symbols local by default. Nested types cannot be exported. 39 | * With special case caveat for message { enum {} reserved 1 to max; } 40 | * This is the recommended setting for new protos. 41 | * 42 | * Generated from protobuf enum STRICT = 4; 43 | */ 44 | const STRICT = 4; 45 | 46 | private static $valueToName = [ 47 | self::DEFAULT_SYMBOL_VISIBILITY_UNKNOWN => 'DEFAULT_SYMBOL_VISIBILITY_UNKNOWN', 48 | self::EXPORT_ALL => 'EXPORT_ALL', 49 | self::EXPORT_TOP_LEVEL => 'EXPORT_TOP_LEVEL', 50 | self::LOCAL_ALL => 'LOCAL_ALL', 51 | self::STRICT => 'STRICT', 52 | ]; 53 | 54 | public static function name($value) 55 | { 56 | if (!isset(self::$valueToName[$value])) { 57 | throw new UnexpectedValueException(sprintf( 58 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 59 | } 60 | return self::$valueToName[$value]; 61 | } 62 | 63 | 64 | public static function value($name) 65 | { 66 | $const = __CLASS__ . '::' . strtoupper($name); 67 | if (!defined($const)) { 68 | throw new UnexpectedValueException(sprintf( 69 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 70 | } 71 | return constant($const); 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FeatureSetDefaults/FeatureSetEditionDefault.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault 21 | */ 22 | class FeatureSetEditionDefault extends \Google\Protobuf\Internal\Message 23 | { 24 | /** 25 | * Generated from protobuf field optional .google.protobuf.Edition edition = 3; 26 | */ 27 | protected $edition = null; 28 | /** 29 | * Defaults of features that can be overridden in this edition. 30 | * 31 | * Generated from protobuf field optional .google.protobuf.FeatureSet overridable_features = 4; 32 | */ 33 | protected $overridable_features = null; 34 | /** 35 | * Defaults of features that can't be overridden in this edition. 36 | * 37 | * Generated from protobuf field optional .google.protobuf.FeatureSet fixed_features = 5; 38 | */ 39 | protected $fixed_features = null; 40 | 41 | /** 42 | * Constructor. 43 | * 44 | * @param array $data { 45 | * Optional. Data for populating the Message object. 46 | * 47 | * @type int $edition 48 | * @type \Google\Protobuf\Internal\FeatureSet $overridable_features 49 | * Defaults of features that can be overridden in this edition. 50 | * @type \Google\Protobuf\Internal\FeatureSet $fixed_features 51 | * Defaults of features that can't be overridden in this edition. 52 | * } 53 | */ 54 | public function __construct($data = NULL) { 55 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 56 | parent::__construct($data); 57 | } 58 | 59 | /** 60 | * Generated from protobuf field optional .google.protobuf.Edition edition = 3; 61 | * @return int 62 | */ 63 | public function getEdition() 64 | { 65 | return isset($this->edition) ? $this->edition : 0; 66 | } 67 | 68 | public function hasEdition() 69 | { 70 | return isset($this->edition); 71 | } 72 | 73 | public function clearEdition() 74 | { 75 | unset($this->edition); 76 | } 77 | 78 | /** 79 | * Generated from protobuf field optional .google.protobuf.Edition edition = 3; 80 | * @param int $var 81 | * @return $this 82 | */ 83 | public function setEdition($var) 84 | { 85 | GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); 86 | $this->edition = $var; 87 | 88 | return $this; 89 | } 90 | 91 | /** 92 | * Defaults of features that can be overridden in this edition. 93 | * 94 | * Generated from protobuf field optional .google.protobuf.FeatureSet overridable_features = 4; 95 | * @return \Google\Protobuf\Internal\FeatureSet|null 96 | */ 97 | public function getOverridableFeatures() 98 | { 99 | return $this->overridable_features; 100 | } 101 | 102 | public function hasOverridableFeatures() 103 | { 104 | return isset($this->overridable_features); 105 | } 106 | 107 | public function clearOverridableFeatures() 108 | { 109 | unset($this->overridable_features); 110 | } 111 | 112 | /** 113 | * Defaults of features that can be overridden in this edition. 114 | * 115 | * Generated from protobuf field optional .google.protobuf.FeatureSet overridable_features = 4; 116 | * @param \Google\Protobuf\Internal\FeatureSet $var 117 | * @return $this 118 | */ 119 | public function setOverridableFeatures($var) 120 | { 121 | GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); 122 | $this->overridable_features = $var; 123 | 124 | return $this; 125 | } 126 | 127 | /** 128 | * Defaults of features that can't be overridden in this edition. 129 | * 130 | * Generated from protobuf field optional .google.protobuf.FeatureSet fixed_features = 5; 131 | * @return \Google\Protobuf\Internal\FeatureSet|null 132 | */ 133 | public function getFixedFeatures() 134 | { 135 | return $this->fixed_features; 136 | } 137 | 138 | public function hasFixedFeatures() 139 | { 140 | return isset($this->fixed_features); 141 | } 142 | 143 | public function clearFixedFeatures() 144 | { 145 | unset($this->fixed_features); 146 | } 147 | 148 | /** 149 | * Defaults of features that can't be overridden in this edition. 150 | * 151 | * Generated from protobuf field optional .google.protobuf.FeatureSet fixed_features = 5; 152 | * @param \Google\Protobuf\Internal\FeatureSet $var 153 | * @return $this 154 | */ 155 | public function setFixedFeatures($var) 156 | { 157 | GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); 158 | $this->fixed_features = $var; 159 | 160 | return $this; 161 | } 162 | 163 | } 164 | 165 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FieldDescriptorProto.Label 12 | */ 13 | class Label 14 | { 15 | /** 16 | * 0 is reserved for errors 17 | * 18 | * Generated from protobuf enum LABEL_OPTIONAL = 1; 19 | */ 20 | const LABEL_OPTIONAL = 1; 21 | /** 22 | * Generated from protobuf enum LABEL_REPEATED = 3; 23 | */ 24 | const LABEL_REPEATED = 3; 25 | /** 26 | * The required label is only allowed in google.protobuf. In proto3 and Editions 27 | * it's explicitly prohibited. In Editions, the `field_presence` feature 28 | * can be used to get this behavior. 29 | * 30 | * Generated from protobuf enum LABEL_REQUIRED = 2; 31 | */ 32 | const LABEL_REQUIRED = 2; 33 | 34 | private static $valueToName = [ 35 | self::LABEL_OPTIONAL => 'LABEL_OPTIONAL', 36 | self::LABEL_REPEATED => 'LABEL_REPEATED', 37 | self::LABEL_REQUIRED => 'LABEL_REQUIRED', 38 | ]; 39 | 40 | public static function name($value) 41 | { 42 | if (!isset(self::$valueToName[$value])) { 43 | throw new UnexpectedValueException(sprintf( 44 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 45 | } 46 | return self::$valueToName[$value]; 47 | } 48 | 49 | 50 | public static function value($name) 51 | { 52 | $const = __CLASS__ . '::' . strtoupper($name); 53 | if (!defined($const)) { 54 | throw new UnexpectedValueException(sprintf( 55 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 56 | } 57 | return constant($const); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FieldDescriptorProto.Type 12 | */ 13 | class Type 14 | { 15 | /** 16 | * 0 is reserved for errors. 17 | * Order is weird for historical reasons. 18 | * 19 | * Generated from protobuf enum TYPE_DOUBLE = 1; 20 | */ 21 | const TYPE_DOUBLE = 1; 22 | /** 23 | * Generated from protobuf enum TYPE_FLOAT = 2; 24 | */ 25 | const TYPE_FLOAT = 2; 26 | /** 27 | * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if 28 | * negative values are likely. 29 | * 30 | * Generated from protobuf enum TYPE_INT64 = 3; 31 | */ 32 | const TYPE_INT64 = 3; 33 | /** 34 | * Generated from protobuf enum TYPE_UINT64 = 4; 35 | */ 36 | const TYPE_UINT64 = 4; 37 | /** 38 | * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if 39 | * negative values are likely. 40 | * 41 | * Generated from protobuf enum TYPE_INT32 = 5; 42 | */ 43 | const TYPE_INT32 = 5; 44 | /** 45 | * Generated from protobuf enum TYPE_FIXED64 = 6; 46 | */ 47 | const TYPE_FIXED64 = 6; 48 | /** 49 | * Generated from protobuf enum TYPE_FIXED32 = 7; 50 | */ 51 | const TYPE_FIXED32 = 7; 52 | /** 53 | * Generated from protobuf enum TYPE_BOOL = 8; 54 | */ 55 | const TYPE_BOOL = 8; 56 | /** 57 | * Generated from protobuf enum TYPE_STRING = 9; 58 | */ 59 | const TYPE_STRING = 9; 60 | /** 61 | * Tag-delimited aggregate. 62 | * Group type is deprecated and not supported after google.protobuf. However, Proto3 63 | * implementations should still be able to parse the group wire format and 64 | * treat group fields as unknown fields. In Editions, the group wire format 65 | * can be enabled via the `message_encoding` feature. 66 | * 67 | * Generated from protobuf enum TYPE_GROUP = 10; 68 | */ 69 | const TYPE_GROUP = 10; 70 | /** 71 | * Length-delimited aggregate. 72 | * 73 | * Generated from protobuf enum TYPE_MESSAGE = 11; 74 | */ 75 | const TYPE_MESSAGE = 11; 76 | /** 77 | * New in version 2. 78 | * 79 | * Generated from protobuf enum TYPE_BYTES = 12; 80 | */ 81 | const TYPE_BYTES = 12; 82 | /** 83 | * Generated from protobuf enum TYPE_UINT32 = 13; 84 | */ 85 | const TYPE_UINT32 = 13; 86 | /** 87 | * Generated from protobuf enum TYPE_ENUM = 14; 88 | */ 89 | const TYPE_ENUM = 14; 90 | /** 91 | * Generated from protobuf enum TYPE_SFIXED32 = 15; 92 | */ 93 | const TYPE_SFIXED32 = 15; 94 | /** 95 | * Generated from protobuf enum TYPE_SFIXED64 = 16; 96 | */ 97 | const TYPE_SFIXED64 = 16; 98 | /** 99 | * Uses ZigZag encoding. 100 | * 101 | * Generated from protobuf enum TYPE_SINT32 = 17; 102 | */ 103 | const TYPE_SINT32 = 17; 104 | /** 105 | * Uses ZigZag encoding. 106 | * 107 | * Generated from protobuf enum TYPE_SINT64 = 18; 108 | */ 109 | const TYPE_SINT64 = 18; 110 | 111 | private static $valueToName = [ 112 | self::TYPE_DOUBLE => 'TYPE_DOUBLE', 113 | self::TYPE_FLOAT => 'TYPE_FLOAT', 114 | self::TYPE_INT64 => 'TYPE_INT64', 115 | self::TYPE_UINT64 => 'TYPE_UINT64', 116 | self::TYPE_INT32 => 'TYPE_INT32', 117 | self::TYPE_FIXED64 => 'TYPE_FIXED64', 118 | self::TYPE_FIXED32 => 'TYPE_FIXED32', 119 | self::TYPE_BOOL => 'TYPE_BOOL', 120 | self::TYPE_STRING => 'TYPE_STRING', 121 | self::TYPE_GROUP => 'TYPE_GROUP', 122 | self::TYPE_MESSAGE => 'TYPE_MESSAGE', 123 | self::TYPE_BYTES => 'TYPE_BYTES', 124 | self::TYPE_UINT32 => 'TYPE_UINT32', 125 | self::TYPE_ENUM => 'TYPE_ENUM', 126 | self::TYPE_SFIXED32 => 'TYPE_SFIXED32', 127 | self::TYPE_SFIXED64 => 'TYPE_SFIXED64', 128 | self::TYPE_SINT32 => 'TYPE_SINT32', 129 | self::TYPE_SINT64 => 'TYPE_SINT64', 130 | ]; 131 | 132 | public static function name($value) 133 | { 134 | if (!isset(self::$valueToName[$value])) { 135 | throw new UnexpectedValueException(sprintf( 136 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 137 | } 138 | return self::$valueToName[$value]; 139 | } 140 | 141 | 142 | public static function value($name) 143 | { 144 | $const = __CLASS__ . '::' . strtoupper($name); 145 | if (!defined($const)) { 146 | throw new UnexpectedValueException(sprintf( 147 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 148 | } 149 | return constant($const); 150 | } 151 | } 152 | 153 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FieldOptions/CType.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FieldOptions.CType 12 | */ 13 | class CType 14 | { 15 | /** 16 | * Default mode. 17 | * 18 | * Generated from protobuf enum STRING = 0; 19 | */ 20 | const STRING = 0; 21 | /** 22 | * The option [ctype=CORD] may be applied to a non-repeated field of type 23 | * "bytes". It indicates that in C++, the data should be stored in a Cord 24 | * instead of a string. For very large strings, this may reduce memory 25 | * fragmentation. It may also allow better performance when parsing from a 26 | * Cord, or when parsing with aliasing enabled, as the parsed Cord may then 27 | * alias the original buffer. 28 | * 29 | * Generated from protobuf enum CORD = 1; 30 | */ 31 | const CORD = 1; 32 | /** 33 | * Generated from protobuf enum STRING_PIECE = 2; 34 | */ 35 | const STRING_PIECE = 2; 36 | 37 | private static $valueToName = [ 38 | self::STRING => 'STRING', 39 | self::CORD => 'CORD', 40 | self::STRING_PIECE => 'STRING_PIECE', 41 | ]; 42 | 43 | public static function name($value) 44 | { 45 | if (!isset(self::$valueToName[$value])) { 46 | throw new UnexpectedValueException(sprintf( 47 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 48 | } 49 | return self::$valueToName[$value]; 50 | } 51 | 52 | 53 | public static function value($name) 54 | { 55 | $const = __CLASS__ . '::' . strtoupper($name); 56 | if (!defined($const)) { 57 | throw new UnexpectedValueException(sprintf( 58 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 59 | } 60 | return constant($const); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FieldOptions/EditionDefault.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FieldOptions.EditionDefault 16 | */ 17 | class EditionDefault extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Generated from protobuf field optional .google.protobuf.Edition edition = 3; 21 | */ 22 | protected $edition = null; 23 | /** 24 | * Textproto value. 25 | * 26 | * Generated from protobuf field optional string value = 2; 27 | */ 28 | protected $value = null; 29 | 30 | /** 31 | * Constructor. 32 | * 33 | * @param array $data { 34 | * Optional. Data for populating the Message object. 35 | * 36 | * @type int $edition 37 | * @type string $value 38 | * Textproto value. 39 | * } 40 | */ 41 | public function __construct($data = NULL) { 42 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 43 | parent::__construct($data); 44 | } 45 | 46 | /** 47 | * Generated from protobuf field optional .google.protobuf.Edition edition = 3; 48 | * @return int 49 | */ 50 | public function getEdition() 51 | { 52 | return isset($this->edition) ? $this->edition : 0; 53 | } 54 | 55 | public function hasEdition() 56 | { 57 | return isset($this->edition); 58 | } 59 | 60 | public function clearEdition() 61 | { 62 | unset($this->edition); 63 | } 64 | 65 | /** 66 | * Generated from protobuf field optional .google.protobuf.Edition edition = 3; 67 | * @param int $var 68 | * @return $this 69 | */ 70 | public function setEdition($var) 71 | { 72 | GPBUtil::checkEnum($var, \Google\Protobuf\Internal\Edition::class); 73 | $this->edition = $var; 74 | 75 | return $this; 76 | } 77 | 78 | /** 79 | * Textproto value. 80 | * 81 | * Generated from protobuf field optional string value = 2; 82 | * @return string 83 | */ 84 | public function getValue() 85 | { 86 | return isset($this->value) ? $this->value : ''; 87 | } 88 | 89 | public function hasValue() 90 | { 91 | return isset($this->value); 92 | } 93 | 94 | public function clearValue() 95 | { 96 | unset($this->value); 97 | } 98 | 99 | /** 100 | * Textproto value. 101 | * 102 | * Generated from protobuf field optional string value = 2; 103 | * @param string $var 104 | * @return $this 105 | */ 106 | public function setValue($var) 107 | { 108 | GPBUtil::checkString($var, True); 109 | $this->value = $var; 110 | 111 | return $this; 112 | } 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FieldOptions/JSType.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FieldOptions.JSType 12 | */ 13 | class JSType 14 | { 15 | /** 16 | * Use the default type. 17 | * 18 | * Generated from protobuf enum JS_NORMAL = 0; 19 | */ 20 | const JS_NORMAL = 0; 21 | /** 22 | * Use JavaScript strings. 23 | * 24 | * Generated from protobuf enum JS_STRING = 1; 25 | */ 26 | const JS_STRING = 1; 27 | /** 28 | * Use JavaScript numbers. 29 | * 30 | * Generated from protobuf enum JS_NUMBER = 2; 31 | */ 32 | const JS_NUMBER = 2; 33 | 34 | private static $valueToName = [ 35 | self::JS_NORMAL => 'JS_NORMAL', 36 | self::JS_STRING => 'JS_STRING', 37 | self::JS_NUMBER => 'JS_NUMBER', 38 | ]; 39 | 40 | public static function name($value) 41 | { 42 | if (!isset(self::$valueToName[$value])) { 43 | throw new UnexpectedValueException(sprintf( 44 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 45 | } 46 | return self::$valueToName[$value]; 47 | } 48 | 49 | 50 | public static function value($name) 51 | { 52 | $const = __CLASS__ . '::' . strtoupper($name); 53 | if (!defined($const)) { 54 | throw new UnexpectedValueException(sprintf( 55 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 56 | } 57 | return constant($const); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FieldOptions/OptionRetention.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FieldOptions.OptionRetention 14 | */ 15 | class OptionRetention 16 | { 17 | /** 18 | * Generated from protobuf enum RETENTION_UNKNOWN = 0; 19 | */ 20 | const RETENTION_UNKNOWN = 0; 21 | /** 22 | * Generated from protobuf enum RETENTION_RUNTIME = 1; 23 | */ 24 | const RETENTION_RUNTIME = 1; 25 | /** 26 | * Generated from protobuf enum RETENTION_SOURCE = 2; 27 | */ 28 | const RETENTION_SOURCE = 2; 29 | 30 | private static $valueToName = [ 31 | self::RETENTION_UNKNOWN => 'RETENTION_UNKNOWN', 32 | self::RETENTION_RUNTIME => 'RETENTION_RUNTIME', 33 | self::RETENTION_SOURCE => 'RETENTION_SOURCE', 34 | ]; 35 | 36 | public static function name($value) 37 | { 38 | if (!isset(self::$valueToName[$value])) { 39 | throw new UnexpectedValueException(sprintf( 40 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 41 | } 42 | return self::$valueToName[$value]; 43 | } 44 | 45 | 46 | public static function value($name) 47 | { 48 | $const = __CLASS__ . '::' . strtoupper($name); 49 | if (!defined($const)) { 50 | throw new UnexpectedValueException(sprintf( 51 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 52 | } 53 | return constant($const); 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FieldOptions/OptionTargetType.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FieldOptions.OptionTargetType 16 | */ 17 | class OptionTargetType 18 | { 19 | /** 20 | * Generated from protobuf enum TARGET_TYPE_UNKNOWN = 0; 21 | */ 22 | const TARGET_TYPE_UNKNOWN = 0; 23 | /** 24 | * Generated from protobuf enum TARGET_TYPE_FILE = 1; 25 | */ 26 | const TARGET_TYPE_FILE = 1; 27 | /** 28 | * Generated from protobuf enum TARGET_TYPE_EXTENSION_RANGE = 2; 29 | */ 30 | const TARGET_TYPE_EXTENSION_RANGE = 2; 31 | /** 32 | * Generated from protobuf enum TARGET_TYPE_MESSAGE = 3; 33 | */ 34 | const TARGET_TYPE_MESSAGE = 3; 35 | /** 36 | * Generated from protobuf enum TARGET_TYPE_FIELD = 4; 37 | */ 38 | const TARGET_TYPE_FIELD = 4; 39 | /** 40 | * Generated from protobuf enum TARGET_TYPE_ONEOF = 5; 41 | */ 42 | const TARGET_TYPE_ONEOF = 5; 43 | /** 44 | * Generated from protobuf enum TARGET_TYPE_ENUM = 6; 45 | */ 46 | const TARGET_TYPE_ENUM = 6; 47 | /** 48 | * Generated from protobuf enum TARGET_TYPE_ENUM_ENTRY = 7; 49 | */ 50 | const TARGET_TYPE_ENUM_ENTRY = 7; 51 | /** 52 | * Generated from protobuf enum TARGET_TYPE_SERVICE = 8; 53 | */ 54 | const TARGET_TYPE_SERVICE = 8; 55 | /** 56 | * Generated from protobuf enum TARGET_TYPE_METHOD = 9; 57 | */ 58 | const TARGET_TYPE_METHOD = 9; 59 | 60 | private static $valueToName = [ 61 | self::TARGET_TYPE_UNKNOWN => 'TARGET_TYPE_UNKNOWN', 62 | self::TARGET_TYPE_FILE => 'TARGET_TYPE_FILE', 63 | self::TARGET_TYPE_EXTENSION_RANGE => 'TARGET_TYPE_EXTENSION_RANGE', 64 | self::TARGET_TYPE_MESSAGE => 'TARGET_TYPE_MESSAGE', 65 | self::TARGET_TYPE_FIELD => 'TARGET_TYPE_FIELD', 66 | self::TARGET_TYPE_ONEOF => 'TARGET_TYPE_ONEOF', 67 | self::TARGET_TYPE_ENUM => 'TARGET_TYPE_ENUM', 68 | self::TARGET_TYPE_ENUM_ENTRY => 'TARGET_TYPE_ENUM_ENTRY', 69 | self::TARGET_TYPE_SERVICE => 'TARGET_TYPE_SERVICE', 70 | self::TARGET_TYPE_METHOD => 'TARGET_TYPE_METHOD', 71 | ]; 72 | 73 | public static function name($value) 74 | { 75 | if (!isset(self::$valueToName[$value])) { 76 | throw new UnexpectedValueException(sprintf( 77 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 78 | } 79 | return self::$valueToName[$value]; 80 | } 81 | 82 | 83 | public static function value($name) 84 | { 85 | $const = __CLASS__ . '::' . strtoupper($name); 86 | if (!defined($const)) { 87 | throw new UnexpectedValueException(sprintf( 88 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 89 | } 90 | return constant($const); 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FileDescriptor.php: -------------------------------------------------------------------------------- 1 | package = $package; 22 | } 23 | 24 | public function getPackage() 25 | { 26 | return $this->package; 27 | } 28 | 29 | public function getMessageType() 30 | { 31 | return $this->message_type; 32 | } 33 | 34 | public function addMessageType($desc) 35 | { 36 | $this->message_type[] = $desc; 37 | } 38 | 39 | public function getEnumType() 40 | { 41 | return $this->enum_type; 42 | } 43 | 44 | public function addEnumType($desc) 45 | { 46 | $this->enum_type[]= $desc; 47 | } 48 | 49 | public static function buildFromProto($proto) 50 | { 51 | $file = new FileDescriptor(); 52 | $file->setPackage($proto->getPackage()); 53 | foreach ($proto->getMessageType() as $message_proto) { 54 | $file->addMessageType(Descriptor::buildFromProto( 55 | $message_proto, $proto, "")); 56 | } 57 | foreach ($proto->getEnumType() as $enum_proto) { 58 | $file->addEnumType( 59 | EnumDescriptor::buildFromProto( 60 | $enum_proto, 61 | $proto, 62 | "")); 63 | } 64 | return $file; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FileDescriptorSet.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FileDescriptorSet 19 | */ 20 | class FileDescriptorSet extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; 24 | */ 25 | private $file; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type \Google\Protobuf\Internal\FileDescriptorProto[] $file 34 | * } 35 | */ 36 | public function __construct($data = NULL) { 37 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 38 | parent::__construct($data); 39 | } 40 | 41 | /** 42 | * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; 43 | * @return RepeatedField<\Google\Protobuf\Internal\FileDescriptorProto> 44 | */ 45 | public function getFile() 46 | { 47 | return $this->file; 48 | } 49 | 50 | /** 51 | * Generated from protobuf field repeated .google.protobuf.FileDescriptorProto file = 1; 52 | * @param \Google\Protobuf\Internal\FileDescriptorProto[] $var 53 | * @return $this 54 | */ 55 | public function setFile($var) 56 | { 57 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); 58 | $this->file = $arr; 59 | 60 | return $this; 61 | } 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php: -------------------------------------------------------------------------------- 1 | google.protobuf.FileOptions.OptimizeMode 14 | */ 15 | class OptimizeMode 16 | { 17 | /** 18 | * Generate complete code for parsing, serialization, 19 | * 20 | * Generated from protobuf enum SPEED = 1; 21 | */ 22 | const SPEED = 1; 23 | /** 24 | * etc. 25 | * 26 | * Generated from protobuf enum CODE_SIZE = 2; 27 | */ 28 | const CODE_SIZE = 2; 29 | /** 30 | * Generate code using MessageLite and the lite runtime. 31 | * 32 | * Generated from protobuf enum LITE_RUNTIME = 3; 33 | */ 34 | const LITE_RUNTIME = 3; 35 | 36 | private static $valueToName = [ 37 | self::SPEED => 'SPEED', 38 | self::CODE_SIZE => 'CODE_SIZE', 39 | self::LITE_RUNTIME => 'LITE_RUNTIME', 40 | ]; 41 | 42 | public static function name($value) 43 | { 44 | if (!isset(self::$valueToName[$value])) { 45 | throw new UnexpectedValueException(sprintf( 46 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 47 | } 48 | return self::$valueToName[$value]; 49 | } 50 | 51 | 52 | public static function value($name) 53 | { 54 | $const = __CLASS__ . '::' . strtoupper($name); 55 | if (!defined($const)) { 56 | throw new UnexpectedValueException(sprintf( 57 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 58 | } 59 | return constant($const); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/GPBDecodeException.php: -------------------------------------------------------------------------------- 1 | google.protobuf.GeneratedCodeInfo 20 | */ 21 | class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message 22 | { 23 | /** 24 | * An Annotation connects some span of text in generated code to an element 25 | * of its generating .proto file. 26 | * 27 | * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; 28 | */ 29 | private $annotation; 30 | 31 | /** 32 | * Constructor. 33 | * 34 | * @param array $data { 35 | * Optional. Data for populating the Message object. 36 | * 37 | * @type \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[] $annotation 38 | * An Annotation connects some span of text in generated code to an element 39 | * of its generating .proto file. 40 | * } 41 | */ 42 | public function __construct($data = NULL) { 43 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 44 | parent::__construct($data); 45 | } 46 | 47 | /** 48 | * An Annotation connects some span of text in generated code to an element 49 | * of its generating .proto file. 50 | * 51 | * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; 52 | * @return RepeatedField<\Google\Protobuf\Internal\GeneratedCodeInfo\Annotation> 53 | */ 54 | public function getAnnotation() 55 | { 56 | return $this->annotation; 57 | } 58 | 59 | /** 60 | * An Annotation connects some span of text in generated code to an element 61 | * of its generating .proto file. 62 | * 63 | * Generated from protobuf field repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; 64 | * @param \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[] $var 65 | * @return $this 66 | */ 67 | public function setAnnotation($var) 68 | { 69 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class); 70 | $this->annotation = $arr; 71 | 72 | return $this; 73 | } 74 | 75 | } 76 | 77 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation/Semantic.php: -------------------------------------------------------------------------------- 1 | google.protobuf.GeneratedCodeInfo.Annotation.Semantic 15 | */ 16 | class Semantic 17 | { 18 | /** 19 | * There is no effect or the effect is indescribable. 20 | * 21 | * Generated from protobuf enum NONE = 0; 22 | */ 23 | const NONE = 0; 24 | /** 25 | * The element is set or otherwise mutated. 26 | * 27 | * Generated from protobuf enum SET = 1; 28 | */ 29 | const SET = 1; 30 | /** 31 | * An alias to the element is returned. 32 | * 33 | * Generated from protobuf enum ALIAS = 2; 34 | */ 35 | const ALIAS = 2; 36 | 37 | private static $valueToName = [ 38 | self::NONE => 'NONE', 39 | self::SET => 'SET', 40 | self::ALIAS => 'ALIAS', 41 | ]; 42 | 43 | public static function name($value) 44 | { 45 | if (!isset(self::$valueToName[$value])) { 46 | throw new UnexpectedValueException(sprintf( 47 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 48 | } 49 | return self::$valueToName[$value]; 50 | } 51 | 52 | 53 | public static function value($name) 54 | { 55 | $const = __CLASS__ . '::' . strtoupper($name); 56 | if (!defined($const)) { 57 | throw new UnexpectedValueException(sprintf( 58 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 59 | } 60 | return constant($const); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php: -------------------------------------------------------------------------------- 1 | getPublicDescriptor(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php: -------------------------------------------------------------------------------- 1 | public_desc; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/MapEntry.php: -------------------------------------------------------------------------------- 1 | getFieldByNumber(2); 26 | if ($value_field->getType() == GPBType::MESSAGE) { 27 | $klass = $value_field->getMessageType()->getClass(); 28 | $value = new $klass; 29 | $this->setValue($value); 30 | } 31 | } 32 | 33 | public function setKey($key) { 34 | $this->key = $key; 35 | } 36 | 37 | public function getKey() { 38 | return $this->key; 39 | } 40 | 41 | public function setValue($value) { 42 | $this->value = $value; 43 | } 44 | 45 | public function getValue() { 46 | return $this->value; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/MapFieldIter.php: -------------------------------------------------------------------------------- 1 | container = $container; 44 | $this->key_type = $key_type; 45 | } 46 | 47 | /** 48 | * Reset the status of the iterator 49 | * 50 | * @return void 51 | * @todo need to add return type void (require update php version to 7.1) 52 | */ 53 | #[\ReturnTypeWillChange] 54 | public function rewind() 55 | { 56 | reset($this->container); 57 | } 58 | 59 | /** 60 | * Return the element at the current position. 61 | * 62 | * @return object The element at the current position. 63 | * @todo need to add return type mixed (require update php version to 8.0) 64 | */ 65 | #[\ReturnTypeWillChange] 66 | public function current() 67 | { 68 | return current($this->container); 69 | } 70 | 71 | /** 72 | * Return the current key. 73 | * 74 | * @return object The current key. 75 | * @todo need to add return type mixed (require update php version to 8.0) 76 | */ 77 | #[\ReturnTypeWillChange] 78 | public function key() 79 | { 80 | $key = key($this->container); 81 | switch ($this->key_type) { 82 | case GPBType::INT64: 83 | case GPBType::UINT64: 84 | case GPBType::FIXED64: 85 | case GPBType::SFIXED64: 86 | case GPBType::SINT64: 87 | if (PHP_INT_SIZE === 8) { 88 | return $key; 89 | } 90 | // Intentionally fall through 91 | case GPBType::STRING: 92 | // PHP associative array stores int string as int for key. 93 | return strval($key); 94 | case GPBType::BOOL: 95 | // PHP associative array stores bool as integer for key. 96 | return boolval($key); 97 | default: 98 | return $key; 99 | } 100 | } 101 | 102 | /** 103 | * Move to the next position. 104 | * 105 | * @return void 106 | * @todo need to add return type void (require update php version to 7.1) 107 | */ 108 | #[\ReturnTypeWillChange] 109 | public function next() 110 | { 111 | next($this->container); 112 | } 113 | 114 | /** 115 | * Check whether there are more elements to iterate. 116 | * 117 | * @return bool True if there are more elements to iterate. 118 | */ 119 | public function valid(): bool 120 | { 121 | return key($this->container) !== null; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/MessageBuilderContext.php: -------------------------------------------------------------------------------- 1 | descriptor = new Descriptor(); 26 | $this->descriptor->setFullName($full_name); 27 | $this->descriptor->setClass($klass); 28 | $this->pool = $pool; 29 | } 30 | 31 | private function getFieldDescriptor($name, $label, $type, 32 | $number, $type_name = null) 33 | { 34 | $field = new FieldDescriptor(); 35 | $field->setName($name); 36 | $camel_name = implode('', array_map('ucwords', explode('_', $name))); 37 | $field->setGetter('get' . $camel_name); 38 | $field->setSetter('set' . $camel_name); 39 | $field->setType($type); 40 | $field->setNumber($number); 41 | $field->setLabel($label); 42 | 43 | // At this time, the message/enum type may have not been added to pool. 44 | // So we use the type name as place holder and will replace it with the 45 | // actual descriptor in cross building. 46 | switch ($type) { 47 | case GPBType::MESSAGE: 48 | $field->setMessageType($type_name); 49 | break; 50 | case GPBType::ENUM: 51 | $field->setEnumType($type_name); 52 | break; 53 | default: 54 | break; 55 | } 56 | 57 | return $field; 58 | } 59 | 60 | public function optional($name, $type, $number, $type_name = null) 61 | { 62 | $this->descriptor->addField($this->getFieldDescriptor( 63 | $name, 64 | GPBLabel::OPTIONAL, 65 | $type, 66 | $number, 67 | $type_name)); 68 | return $this; 69 | } 70 | 71 | public function repeated($name, $type, $number, $type_name = null) 72 | { 73 | $this->descriptor->addField($this->getFieldDescriptor( 74 | $name, 75 | GPBLabel::REPEATED, 76 | $type, 77 | $number, 78 | $type_name)); 79 | return $this; 80 | } 81 | 82 | public function required($name, $type, $number, $type_name = null) 83 | { 84 | $this->descriptor->addField($this->getFieldDescriptor( 85 | $name, 86 | GPBLabel::REQUIRED, 87 | $type, 88 | $number, 89 | $type_name)); 90 | return $this; 91 | } 92 | 93 | public function finalizeToPool() 94 | { 95 | $this->pool->addDescriptor($this->descriptor); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php: -------------------------------------------------------------------------------- 1 | google.protobuf.MethodOptions.IdempotencyLevel 16 | */ 17 | class IdempotencyLevel 18 | { 19 | /** 20 | * Generated from protobuf enum IDEMPOTENCY_UNKNOWN = 0; 21 | */ 22 | const IDEMPOTENCY_UNKNOWN = 0; 23 | /** 24 | * implies idempotent 25 | * 26 | * Generated from protobuf enum NO_SIDE_EFFECTS = 1; 27 | */ 28 | const NO_SIDE_EFFECTS = 1; 29 | /** 30 | * idempotent, but may have side effects 31 | * 32 | * Generated from protobuf enum IDEMPOTENT = 2; 33 | */ 34 | const IDEMPOTENT = 2; 35 | 36 | private static $valueToName = [ 37 | self::IDEMPOTENCY_UNKNOWN => 'IDEMPOTENCY_UNKNOWN', 38 | self::NO_SIDE_EFFECTS => 'NO_SIDE_EFFECTS', 39 | self::IDEMPOTENT => 'IDEMPOTENT', 40 | ]; 41 | 42 | public static function name($value) 43 | { 44 | if (!isset(self::$valueToName[$value])) { 45 | throw new UnexpectedValueException(sprintf( 46 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 47 | } 48 | return self::$valueToName[$value]; 49 | } 50 | 51 | 52 | public static function value($name) 53 | { 54 | $const = __CLASS__ . '::' . strtoupper($name); 55 | if (!defined($const)) { 56 | throw new UnexpectedValueException(sprintf( 57 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 58 | } 59 | return constant($const); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/OneofDescriptor.php: -------------------------------------------------------------------------------- 1 | public_desc = new \Google\Protobuf\OneofDescriptor($this); 23 | } 24 | 25 | public function setName($name) 26 | { 27 | $this->name = $name; 28 | } 29 | 30 | public function getName() 31 | { 32 | return $this->name; 33 | } 34 | 35 | public function addField(FieldDescriptor $field) 36 | { 37 | $this->fields[] = $field; 38 | } 39 | 40 | public function getFields() 41 | { 42 | return $this->fields; 43 | } 44 | 45 | public function isSynthetic() 46 | { 47 | return !is_null($this->fields) && count($this->fields) === 1 48 | && $this->fields[0]->getProto3Optional(); 49 | } 50 | 51 | public static function buildFromProto($oneof_proto, $desc, $index) 52 | { 53 | $oneof = new OneofDescriptor(); 54 | $oneof->setName($oneof_proto->getName()); 55 | foreach ($desc->getField() as $field) { 56 | /** @var FieldDescriptor $field */ 57 | if ($field->getOneofIndex() == $index) { 58 | $oneof->addField($field); 59 | $field->setContainingOneof($oneof); 60 | } 61 | } 62 | return $oneof; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/OneofDescriptorProto.php: -------------------------------------------------------------------------------- 1 | google.protobuf.OneofDescriptorProto 18 | */ 19 | class OneofDescriptorProto extends \Google\Protobuf\Internal\Message 20 | { 21 | /** 22 | * Generated from protobuf field optional string name = 1; 23 | */ 24 | protected $name = null; 25 | /** 26 | * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; 27 | */ 28 | protected $options = null; 29 | 30 | /** 31 | * Constructor. 32 | * 33 | * @param array $data { 34 | * Optional. Data for populating the Message object. 35 | * 36 | * @type string $name 37 | * @type \Google\Protobuf\Internal\OneofOptions $options 38 | * } 39 | */ 40 | public function __construct($data = NULL) { 41 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 42 | parent::__construct($data); 43 | } 44 | 45 | /** 46 | * Generated from protobuf field optional string name = 1; 47 | * @return string 48 | */ 49 | public function getName() 50 | { 51 | return isset($this->name) ? $this->name : ''; 52 | } 53 | 54 | public function hasName() 55 | { 56 | return isset($this->name); 57 | } 58 | 59 | public function clearName() 60 | { 61 | unset($this->name); 62 | } 63 | 64 | /** 65 | * Generated from protobuf field optional string name = 1; 66 | * @param string $var 67 | * @return $this 68 | */ 69 | public function setName($var) 70 | { 71 | GPBUtil::checkString($var, True); 72 | $this->name = $var; 73 | 74 | return $this; 75 | } 76 | 77 | /** 78 | * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; 79 | * @return \Google\Protobuf\Internal\OneofOptions|null 80 | */ 81 | public function getOptions() 82 | { 83 | return $this->options; 84 | } 85 | 86 | public function hasOptions() 87 | { 88 | return isset($this->options); 89 | } 90 | 91 | public function clearOptions() 92 | { 93 | unset($this->options); 94 | } 95 | 96 | /** 97 | * Generated from protobuf field optional .google.protobuf.OneofOptions options = 2; 98 | * @param \Google\Protobuf\Internal\OneofOptions $var 99 | * @return $this 100 | */ 101 | public function setOptions($var) 102 | { 103 | GPBUtil::checkMessage($var, \Google\Protobuf\Internal\OneofOptions::class); 104 | $this->options = $var; 105 | 106 | return $this; 107 | } 108 | 109 | } 110 | 111 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/OneofField.php: -------------------------------------------------------------------------------- 1 | desc = $desc; 23 | } 24 | 25 | public function setValue($value) 26 | { 27 | $this->value = $value; 28 | } 29 | 30 | public function getValue() 31 | { 32 | return $this->value; 33 | } 34 | 35 | public function setFieldName($field_name) 36 | { 37 | $this->field_name = $field_name; 38 | } 39 | 40 | public function getFieldName() 41 | { 42 | return $this->field_name; 43 | } 44 | 45 | public function setNumber($number) 46 | { 47 | $this->number = $number; 48 | } 49 | 50 | public function getNumber() 51 | { 52 | return $this->number; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/OneofOptions.php: -------------------------------------------------------------------------------- 1 | google.protobuf.OneofOptions 16 | */ 17 | class OneofOptions extends \Google\Protobuf\Internal\Message 18 | { 19 | /** 20 | * Any features defined in the specific edition. 21 | * WARNING: This field should only be used by protobuf plugins or special 22 | * cases like the proto compiler. Other uses are discouraged and 23 | * developers should rely on the protoreflect APIs for their client language. 24 | * 25 | * Generated from protobuf field optional .google.protobuf.FeatureSet features = 1; 26 | */ 27 | protected $features = null; 28 | /** 29 | * The parser stores options it doesn't recognize here. See above. 30 | * 31 | * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; 32 | */ 33 | private $uninterpreted_option; 34 | 35 | /** 36 | * Constructor. 37 | * 38 | * @param array $data { 39 | * Optional. Data for populating the Message object. 40 | * 41 | * @type \Google\Protobuf\Internal\FeatureSet $features 42 | * Any features defined in the specific edition. 43 | * WARNING: This field should only be used by protobuf plugins or special 44 | * cases like the proto compiler. Other uses are discouraged and 45 | * developers should rely on the protoreflect APIs for their client language. 46 | * @type \Google\Protobuf\Internal\UninterpretedOption[] $uninterpreted_option 47 | * The parser stores options it doesn't recognize here. See above. 48 | * } 49 | */ 50 | public function __construct($data = NULL) { 51 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 52 | parent::__construct($data); 53 | } 54 | 55 | /** 56 | * Any features defined in the specific edition. 57 | * WARNING: This field should only be used by protobuf plugins or special 58 | * cases like the proto compiler. Other uses are discouraged and 59 | * developers should rely on the protoreflect APIs for their client language. 60 | * 61 | * Generated from protobuf field optional .google.protobuf.FeatureSet features = 1; 62 | * @return \Google\Protobuf\Internal\FeatureSet|null 63 | */ 64 | public function getFeatures() 65 | { 66 | return $this->features; 67 | } 68 | 69 | public function hasFeatures() 70 | { 71 | return isset($this->features); 72 | } 73 | 74 | public function clearFeatures() 75 | { 76 | unset($this->features); 77 | } 78 | 79 | /** 80 | * Any features defined in the specific edition. 81 | * WARNING: This field should only be used by protobuf plugins or special 82 | * cases like the proto compiler. Other uses are discouraged and 83 | * developers should rely on the protoreflect APIs for their client language. 84 | * 85 | * Generated from protobuf field optional .google.protobuf.FeatureSet features = 1; 86 | * @param \Google\Protobuf\Internal\FeatureSet $var 87 | * @return $this 88 | */ 89 | public function setFeatures($var) 90 | { 91 | GPBUtil::checkMessage($var, \Google\Protobuf\Internal\FeatureSet::class); 92 | $this->features = $var; 93 | 94 | return $this; 95 | } 96 | 97 | /** 98 | * The parser stores options it doesn't recognize here. See above. 99 | * 100 | * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; 101 | * @return RepeatedField<\Google\Protobuf\Internal\UninterpretedOption> 102 | */ 103 | public function getUninterpretedOption() 104 | { 105 | return $this->uninterpreted_option; 106 | } 107 | 108 | /** 109 | * The parser stores options it doesn't recognize here. See above. 110 | * 111 | * Generated from protobuf field repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; 112 | * @param \Google\Protobuf\Internal\UninterpretedOption[] $var 113 | * @return $this 114 | */ 115 | public function setUninterpretedOption($var) 116 | { 117 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); 118 | $this->uninterpreted_option = $arr; 119 | 120 | return $this; 121 | } 122 | 123 | } 124 | 125 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/RawInputStream.php: -------------------------------------------------------------------------------- 1 | buffer = $buffer; 20 | } 21 | 22 | public function getData() 23 | { 24 | return $this->buffer; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/RepeatedField.php: -------------------------------------------------------------------------------- 1 | position = 0; 42 | $this->container = $container; 43 | } 44 | 45 | /** 46 | * Reset the status of the iterator 47 | * 48 | * @return void 49 | * @todo need to add return type void (require update php version to 7.1) 50 | */ 51 | #[\ReturnTypeWillChange] 52 | public function rewind() 53 | { 54 | $this->position = 0; 55 | } 56 | 57 | /** 58 | * Return the element at the current position. 59 | * 60 | * @return object The element at the current position. 61 | * @todo need to add return type mixed (require update php version to 8.0) 62 | */ 63 | #[\ReturnTypeWillChange] 64 | public function current() 65 | { 66 | return $this->container[$this->position]; 67 | } 68 | 69 | /** 70 | * Return the current position. 71 | * 72 | * @return integer The current position. 73 | * @todo need to add return type mixed (require update php version to 8.0) 74 | */ 75 | #[\ReturnTypeWillChange] 76 | public function key() 77 | { 78 | return $this->position; 79 | } 80 | 81 | /** 82 | * Move to the next position. 83 | * 84 | * @return void 85 | * @todo need to add return type void (require update php version to 7.1) 86 | */ 87 | #[\ReturnTypeWillChange] 88 | public function next() 89 | { 90 | ++$this->position; 91 | } 92 | 93 | /** 94 | * Check whether there are more elements to iterate. 95 | * 96 | * @return bool True if there are more elements to iterate. 97 | */ 98 | public function valid(): bool 99 | { 100 | return isset($this->container[$this->position]); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/ServiceDescriptorProto.php: -------------------------------------------------------------------------------- 1 | google.protobuf.ServiceDescriptorProto 18 | */ 19 | class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message 20 | { 21 | /** 22 | * Generated from protobuf field optional string name = 1; 23 | */ 24 | protected $name = null; 25 | /** 26 | * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; 27 | */ 28 | private $method; 29 | /** 30 | * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; 31 | */ 32 | protected $options = null; 33 | 34 | /** 35 | * Constructor. 36 | * 37 | * @param array $data { 38 | * Optional. Data for populating the Message object. 39 | * 40 | * @type string $name 41 | * @type \Google\Protobuf\Internal\MethodDescriptorProto[] $method 42 | * @type \Google\Protobuf\Internal\ServiceOptions $options 43 | * } 44 | */ 45 | public function __construct($data = NULL) { 46 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 47 | parent::__construct($data); 48 | } 49 | 50 | /** 51 | * Generated from protobuf field optional string name = 1; 52 | * @return string 53 | */ 54 | public function getName() 55 | { 56 | return isset($this->name) ? $this->name : ''; 57 | } 58 | 59 | public function hasName() 60 | { 61 | return isset($this->name); 62 | } 63 | 64 | public function clearName() 65 | { 66 | unset($this->name); 67 | } 68 | 69 | /** 70 | * Generated from protobuf field optional string name = 1; 71 | * @param string $var 72 | * @return $this 73 | */ 74 | public function setName($var) 75 | { 76 | GPBUtil::checkString($var, True); 77 | $this->name = $var; 78 | 79 | return $this; 80 | } 81 | 82 | /** 83 | * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; 84 | * @return RepeatedField<\Google\Protobuf\Internal\MethodDescriptorProto> 85 | */ 86 | public function getMethod() 87 | { 88 | return $this->method; 89 | } 90 | 91 | /** 92 | * Generated from protobuf field repeated .google.protobuf.MethodDescriptorProto method = 2; 93 | * @param \Google\Protobuf\Internal\MethodDescriptorProto[] $var 94 | * @return $this 95 | */ 96 | public function setMethod($var) 97 | { 98 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); 99 | $this->method = $arr; 100 | 101 | return $this; 102 | } 103 | 104 | /** 105 | * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; 106 | * @return \Google\Protobuf\Internal\ServiceOptions|null 107 | */ 108 | public function getOptions() 109 | { 110 | return $this->options; 111 | } 112 | 113 | public function hasOptions() 114 | { 115 | return isset($this->options); 116 | } 117 | 118 | public function clearOptions() 119 | { 120 | unset($this->options); 121 | } 122 | 123 | /** 124 | * Generated from protobuf field optional .google.protobuf.ServiceOptions options = 3; 125 | * @param \Google\Protobuf\Internal\ServiceOptions $var 126 | * @return $this 127 | */ 128 | public function setOptions($var) 129 | { 130 | GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ServiceOptions::class); 131 | $this->options = $var; 132 | 133 | return $this; 134 | } 135 | 136 | } 137 | 138 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/SymbolVisibility.php: -------------------------------------------------------------------------------- 1 | google.protobuf.SymbolVisibility 18 | */ 19 | class SymbolVisibility 20 | { 21 | /** 22 | * Generated from protobuf enum VISIBILITY_UNSET = 0; 23 | */ 24 | const VISIBILITY_UNSET = 0; 25 | /** 26 | * Generated from protobuf enum VISIBILITY_LOCAL = 1; 27 | */ 28 | const VISIBILITY_LOCAL = 1; 29 | /** 30 | * Generated from protobuf enum VISIBILITY_EXPORT = 2; 31 | */ 32 | const VISIBILITY_EXPORT = 2; 33 | 34 | private static $valueToName = [ 35 | self::VISIBILITY_UNSET => 'VISIBILITY_UNSET', 36 | self::VISIBILITY_LOCAL => 'VISIBILITY_LOCAL', 37 | self::VISIBILITY_EXPORT => 'VISIBILITY_EXPORT', 38 | ]; 39 | 40 | public static function name($value) 41 | { 42 | if (!isset(self::$valueToName[$value])) { 43 | throw new UnexpectedValueException(sprintf( 44 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 45 | } 46 | return self::$valueToName[$value]; 47 | } 48 | 49 | 50 | public static function value($name) 51 | { 52 | $const = __CLASS__ . '::' . strtoupper($name); 53 | if (!defined($const)) { 54 | throw new UnexpectedValueException(sprintf( 55 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 56 | } 57 | return constant($const); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/TimestampBase.php: -------------------------------------------------------------------------------- 1 | seconds = $datetime->getTimestamp(); 19 | $this->nanos = 1000 * $datetime->format('u'); 20 | } 21 | 22 | /** 23 | * Converts Timestamp to PHP DateTime. 24 | * 25 | * @return \DateTime $datetime 26 | */ 27 | public function toDateTime() 28 | { 29 | $time = sprintf('%s.%06d', $this->seconds, $this->nanos / 1000); 30 | return \DateTime::createFromFormat('U.u', $time); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php: -------------------------------------------------------------------------------- 1 | google.protobuf.UninterpretedOption.NamePart 22 | */ 23 | class NamePart extends \Google\Protobuf\Internal\Message 24 | { 25 | /** 26 | * Generated from protobuf field required string name_part = 1; 27 | */ 28 | protected $name_part = null; 29 | /** 30 | * Generated from protobuf field required bool is_extension = 2; 31 | */ 32 | protected $is_extension = null; 33 | 34 | /** 35 | * Constructor. 36 | * 37 | * @param array $data { 38 | * Optional. Data for populating the Message object. 39 | * 40 | * @type string $name_part 41 | * @type bool $is_extension 42 | * } 43 | */ 44 | public function __construct($data = NULL) { 45 | \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); 46 | parent::__construct($data); 47 | } 48 | 49 | /** 50 | * Generated from protobuf field required string name_part = 1; 51 | * @return string 52 | */ 53 | public function getNamePart() 54 | { 55 | return isset($this->name_part) ? $this->name_part : ''; 56 | } 57 | 58 | public function hasNamePart() 59 | { 60 | return isset($this->name_part); 61 | } 62 | 63 | public function clearNamePart() 64 | { 65 | unset($this->name_part); 66 | } 67 | 68 | /** 69 | * Generated from protobuf field required string name_part = 1; 70 | * @param string $var 71 | * @return $this 72 | */ 73 | public function setNamePart($var) 74 | { 75 | GPBUtil::checkString($var, True); 76 | $this->name_part = $var; 77 | 78 | return $this; 79 | } 80 | 81 | /** 82 | * Generated from protobuf field required bool is_extension = 2; 83 | * @return bool 84 | */ 85 | public function getIsExtension() 86 | { 87 | return isset($this->is_extension) ? $this->is_extension : false; 88 | } 89 | 90 | public function hasIsExtension() 91 | { 92 | return isset($this->is_extension); 93 | } 94 | 95 | public function clearIsExtension() 96 | { 97 | unset($this->is_extension); 98 | } 99 | 100 | /** 101 | * Generated from protobuf field required bool is_extension = 2; 102 | * @param bool $var 103 | * @return $this 104 | */ 105 | public function setIsExtension($var) 106 | { 107 | GPBUtil::checkBool($var); 108 | $this->is_extension = $var; 109 | 110 | return $this; 111 | } 112 | 113 | } 114 | 115 | -------------------------------------------------------------------------------- /src/Google/Protobuf/ListValue.php: -------------------------------------------------------------------------------- 1 | google.protobuf.ListValue 17 | */ 18 | class ListValue extends \Google\Protobuf\Internal\Message 19 | { 20 | /** 21 | * Repeated field of dynamically typed values. 22 | * 23 | * Generated from protobuf field repeated .google.protobuf.Value values = 1; 24 | */ 25 | private $values; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param array $data { 31 | * Optional. Data for populating the Message object. 32 | * 33 | * @type \Google\Protobuf\Value[] $values 34 | * Repeated field of dynamically typed values. 35 | * } 36 | */ 37 | public function __construct($data = NULL) { 38 | \GPBMetadata\Google\Protobuf\Struct::initOnce(); 39 | parent::__construct($data); 40 | } 41 | 42 | /** 43 | * Repeated field of dynamically typed values. 44 | * 45 | * Generated from protobuf field repeated .google.protobuf.Value values = 1; 46 | * @return RepeatedField<\Google\Protobuf\Value> 47 | */ 48 | public function getValues() 49 | { 50 | return $this->values; 51 | } 52 | 53 | /** 54 | * Repeated field of dynamically typed values. 55 | * 56 | * Generated from protobuf field repeated .google.protobuf.Value values = 1; 57 | * @param \Google\Protobuf\Value[] $var 58 | * @return $this 59 | */ 60 | public function setValues($var) 61 | { 62 | $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); 63 | $this->values = $arr; 64 | 65 | return $this; 66 | } 67 | 68 | } 69 | 70 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Mixin.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Mixin 77 | */ 78 | class Mixin extends \Google\Protobuf\Internal\Message 79 | { 80 | /** 81 | * The fully qualified name of the interface which is included. 82 | * 83 | * Generated from protobuf field string name = 1; 84 | */ 85 | protected $name = ''; 86 | /** 87 | * If non-empty specifies a path under which inherited HTTP paths 88 | * are rooted. 89 | * 90 | * Generated from protobuf field string root = 2; 91 | */ 92 | protected $root = ''; 93 | 94 | /** 95 | * Constructor. 96 | * 97 | * @param array $data { 98 | * Optional. Data for populating the Message object. 99 | * 100 | * @type string $name 101 | * The fully qualified name of the interface which is included. 102 | * @type string $root 103 | * If non-empty specifies a path under which inherited HTTP paths 104 | * are rooted. 105 | * } 106 | */ 107 | public function __construct($data = NULL) { 108 | \GPBMetadata\Google\Protobuf\Api::initOnce(); 109 | parent::__construct($data); 110 | } 111 | 112 | /** 113 | * The fully qualified name of the interface which is included. 114 | * 115 | * Generated from protobuf field string name = 1; 116 | * @return string 117 | */ 118 | public function getName() 119 | { 120 | return $this->name; 121 | } 122 | 123 | /** 124 | * The fully qualified name of the interface which is included. 125 | * 126 | * Generated from protobuf field string name = 1; 127 | * @param string $var 128 | * @return $this 129 | */ 130 | public function setName($var) 131 | { 132 | GPBUtil::checkString($var, True); 133 | $this->name = $var; 134 | 135 | return $this; 136 | } 137 | 138 | /** 139 | * If non-empty specifies a path under which inherited HTTP paths 140 | * are rooted. 141 | * 142 | * Generated from protobuf field string root = 2; 143 | * @return string 144 | */ 145 | public function getRoot() 146 | { 147 | return $this->root; 148 | } 149 | 150 | /** 151 | * If non-empty specifies a path under which inherited HTTP paths 152 | * are rooted. 153 | * 154 | * Generated from protobuf field string root = 2; 155 | * @param string $var 156 | * @return $this 157 | */ 158 | public function setRoot($var) 159 | { 160 | GPBUtil::checkString($var, True); 161 | $this->root = $var; 162 | 163 | return $this; 164 | } 165 | 166 | } 167 | 168 | -------------------------------------------------------------------------------- /src/Google/Protobuf/NullValue.php: -------------------------------------------------------------------------------- 1 | google.protobuf.NullValue 16 | */ 17 | class NullValue 18 | { 19 | /** 20 | * Null value. 21 | * 22 | * Generated from protobuf enum NULL_VALUE = 0; 23 | */ 24 | const NULL_VALUE = 0; 25 | 26 | private static $valueToName = [ 27 | self::NULL_VALUE => 'NULL_VALUE', 28 | ]; 29 | 30 | public static function name($value) 31 | { 32 | if (!isset(self::$valueToName[$value])) { 33 | throw new UnexpectedValueException(sprintf( 34 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 35 | } 36 | return self::$valueToName[$value]; 37 | } 38 | 39 | 40 | public static function value($name) 41 | { 42 | $const = __CLASS__ . '::' . strtoupper($name); 43 | if (!defined($const)) { 44 | throw new UnexpectedValueException(sprintf( 45 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 46 | } 47 | return constant($const); 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/Google/Protobuf/OneofDescriptor.php: -------------------------------------------------------------------------------- 1 | internal_desc = $internal_desc; 27 | } 28 | 29 | /** 30 | * @return string The name of the oneof 31 | */ 32 | public function getName() 33 | { 34 | return $this->internal_desc->getName(); 35 | } 36 | 37 | /** 38 | * @param int $index Must be >= 0 and < getFieldCount() 39 | * @return FieldDescriptor 40 | */ 41 | public function getField($index) 42 | { 43 | if ( 44 | is_null($this->internal_desc->getFields()) 45 | || !isset($this->internal_desc->getFields()[$index]) 46 | ) { 47 | return null; 48 | } 49 | return $this->getPublicDescriptor($this->internal_desc->getFields()[$index]); 50 | } 51 | 52 | /** 53 | * @return int Number of fields in the oneof 54 | */ 55 | public function getFieldCount() 56 | { 57 | return count($this->internal_desc->getFields()); 58 | } 59 | 60 | public function isSynthetic() 61 | { 62 | return $this->internal_desc->isSynthetic(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Option.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Option 17 | */ 18 | class Option extends \Google\Protobuf\Internal\Message 19 | { 20 | /** 21 | * The option's name. For protobuf built-in options (options defined in 22 | * descriptor.proto), this is the short name. For example, `"map_entry"`. 23 | * For custom options, it should be the fully-qualified name. For example, 24 | * `"google.api.http"`. 25 | * 26 | * Generated from protobuf field string name = 1; 27 | */ 28 | protected $name = ''; 29 | /** 30 | * The option's value packed in an Any message. If the value is a primitive, 31 | * the corresponding wrapper type defined in google/protobuf/wrappers.proto 32 | * should be used. If the value is an enum, it should be stored as an int32 33 | * value using the google.protobuf.Int32Value type. 34 | * 35 | * Generated from protobuf field .google.protobuf.Any value = 2; 36 | */ 37 | protected $value = null; 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param array $data { 43 | * Optional. Data for populating the Message object. 44 | * 45 | * @type string $name 46 | * The option's name. For protobuf built-in options (options defined in 47 | * descriptor.proto), this is the short name. For example, `"map_entry"`. 48 | * For custom options, it should be the fully-qualified name. For example, 49 | * `"google.api.http"`. 50 | * @type \Google\Protobuf\Any $value 51 | * The option's value packed in an Any message. If the value is a primitive, 52 | * the corresponding wrapper type defined in google/protobuf/wrappers.proto 53 | * should be used. If the value is an enum, it should be stored as an int32 54 | * value using the google.protobuf.Int32Value type. 55 | * } 56 | */ 57 | public function __construct($data = NULL) { 58 | \GPBMetadata\Google\Protobuf\Type::initOnce(); 59 | parent::__construct($data); 60 | } 61 | 62 | /** 63 | * The option's name. For protobuf built-in options (options defined in 64 | * descriptor.proto), this is the short name. For example, `"map_entry"`. 65 | * For custom options, it should be the fully-qualified name. For example, 66 | * `"google.api.http"`. 67 | * 68 | * Generated from protobuf field string name = 1; 69 | * @return string 70 | */ 71 | public function getName() 72 | { 73 | return $this->name; 74 | } 75 | 76 | /** 77 | * The option's name. For protobuf built-in options (options defined in 78 | * descriptor.proto), this is the short name. For example, `"map_entry"`. 79 | * For custom options, it should be the fully-qualified name. For example, 80 | * `"google.api.http"`. 81 | * 82 | * Generated from protobuf field string name = 1; 83 | * @param string $var 84 | * @return $this 85 | */ 86 | public function setName($var) 87 | { 88 | GPBUtil::checkString($var, True); 89 | $this->name = $var; 90 | 91 | return $this; 92 | } 93 | 94 | /** 95 | * The option's value packed in an Any message. If the value is a primitive, 96 | * the corresponding wrapper type defined in google/protobuf/wrappers.proto 97 | * should be used. If the value is an enum, it should be stored as an int32 98 | * value using the google.protobuf.Int32Value type. 99 | * 100 | * Generated from protobuf field .google.protobuf.Any value = 2; 101 | * @return \Google\Protobuf\Any|null 102 | */ 103 | public function getValue() 104 | { 105 | return $this->value; 106 | } 107 | 108 | public function hasValue() 109 | { 110 | return isset($this->value); 111 | } 112 | 113 | public function clearValue() 114 | { 115 | unset($this->value); 116 | } 117 | 118 | /** 119 | * The option's value packed in an Any message. If the value is a primitive, 120 | * the corresponding wrapper type defined in google/protobuf/wrappers.proto 121 | * should be used. If the value is an enum, it should be stored as an int32 122 | * value using the google.protobuf.Int32Value type. 123 | * 124 | * Generated from protobuf field .google.protobuf.Any value = 2; 125 | * @param \Google\Protobuf\Any $var 126 | * @return $this 127 | */ 128 | public function setValue($var) 129 | { 130 | GPBUtil::checkMessage($var, \Google\Protobuf\Any::class); 131 | $this->value = $var; 132 | 133 | return $this; 134 | } 135 | 136 | } 137 | 138 | -------------------------------------------------------------------------------- /src/Google/Protobuf/PrintOptions.php: -------------------------------------------------------------------------------- 1 | google.protobuf.SourceContext 17 | */ 18 | class SourceContext extends \Google\Protobuf\Internal\Message 19 | { 20 | /** 21 | * The path-qualified name of the .proto file that contained the associated 22 | * protobuf element. For example: `"google/protobuf/source_context.proto"`. 23 | * 24 | * Generated from protobuf field string file_name = 1; 25 | */ 26 | protected $file_name = ''; 27 | 28 | /** 29 | * Constructor. 30 | * 31 | * @param array $data { 32 | * Optional. Data for populating the Message object. 33 | * 34 | * @type string $file_name 35 | * The path-qualified name of the .proto file that contained the associated 36 | * protobuf element. For example: `"google/protobuf/source_context.proto"`. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\SourceContext::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The path-qualified name of the .proto file that contained the associated 46 | * protobuf element. For example: `"google/protobuf/source_context.proto"`. 47 | * 48 | * Generated from protobuf field string file_name = 1; 49 | * @return string 50 | */ 51 | public function getFileName() 52 | { 53 | return $this->file_name; 54 | } 55 | 56 | /** 57 | * The path-qualified name of the .proto file that contained the associated 58 | * protobuf element. For example: `"google/protobuf/source_context.proto"`. 59 | * 60 | * Generated from protobuf field string file_name = 1; 61 | * @param string $var 62 | * @return $this 63 | */ 64 | public function setFileName($var) 65 | { 66 | GPBUtil::checkString($var, True); 67 | $this->file_name = $var; 68 | 69 | return $this; 70 | } 71 | 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/Google/Protobuf/StringValue.php: -------------------------------------------------------------------------------- 1 | google.protobuf.StringValue 19 | */ 20 | class StringValue extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The string value. 24 | * 25 | * Generated from protobuf field string value = 1; 26 | */ 27 | protected $value = ''; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type string $value 36 | * The string value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The string value. 46 | * 47 | * Generated from protobuf field string value = 1; 48 | * @return string 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The string value. 57 | * 58 | * Generated from protobuf field string value = 1; 59 | * @param string $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkString($var, True); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Struct.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Struct 22 | */ 23 | class Struct extends \Google\Protobuf\Internal\Message 24 | { 25 | /** 26 | * Unordered map of dynamically typed values. 27 | * 28 | * Generated from protobuf field map fields = 1; 29 | */ 30 | private $fields; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param array $data { 36 | * Optional. Data for populating the Message object. 37 | * 38 | * @type array|\Google\Protobuf\Internal\MapField $fields 39 | * Unordered map of dynamically typed values. 40 | * } 41 | */ 42 | public function __construct($data = NULL) { 43 | \GPBMetadata\Google\Protobuf\Struct::initOnce(); 44 | parent::__construct($data); 45 | } 46 | 47 | /** 48 | * Unordered map of dynamically typed values. 49 | * 50 | * Generated from protobuf field map fields = 1; 51 | * @return \Google\Protobuf\Internal\MapField 52 | */ 53 | public function getFields() 54 | { 55 | return $this->fields; 56 | } 57 | 58 | /** 59 | * Unordered map of dynamically typed values. 60 | * 61 | * Generated from protobuf field map fields = 1; 62 | * @param array|\Google\Protobuf\Internal\MapField $var 63 | * @return $this 64 | */ 65 | public function setFields($var) 66 | { 67 | $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Value::class); 68 | $this->fields = $arr; 69 | 70 | return $this; 71 | } 72 | 73 | } 74 | 75 | -------------------------------------------------------------------------------- /src/Google/Protobuf/Syntax.php: -------------------------------------------------------------------------------- 1 | google.protobuf.Syntax 14 | */ 15 | class Syntax 16 | { 17 | /** 18 | * Syntax `proto2`. 19 | * 20 | * Generated from protobuf enum SYNTAX_PROTO2 = 0; 21 | */ 22 | const SYNTAX_PROTO2 = 0; 23 | /** 24 | * Syntax `proto3`. 25 | * 26 | * Generated from protobuf enum SYNTAX_PROTO3 = 1; 27 | */ 28 | const SYNTAX_PROTO3 = 1; 29 | /** 30 | * Syntax `editions`. 31 | * 32 | * Generated from protobuf enum SYNTAX_EDITIONS = 2; 33 | */ 34 | const SYNTAX_EDITIONS = 2; 35 | 36 | private static $valueToName = [ 37 | self::SYNTAX_PROTO2 => 'SYNTAX_PROTO2', 38 | self::SYNTAX_PROTO3 => 'SYNTAX_PROTO3', 39 | self::SYNTAX_EDITIONS => 'SYNTAX_EDITIONS', 40 | ]; 41 | 42 | public static function name($value) 43 | { 44 | if (!isset(self::$valueToName[$value])) { 45 | throw new UnexpectedValueException(sprintf( 46 | 'Enum %s has no name defined for value %s', __CLASS__, $value)); 47 | } 48 | return self::$valueToName[$value]; 49 | } 50 | 51 | 52 | public static function value($name) 53 | { 54 | $const = __CLASS__ . '::' . strtoupper($name); 55 | if (!defined($const)) { 56 | throw new UnexpectedValueException(sprintf( 57 | 'Enum %s has no value defined for name %s', __CLASS__, $name)); 58 | } 59 | return constant($const); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/Google/Protobuf/UInt32Value.php: -------------------------------------------------------------------------------- 1 | google.protobuf.UInt32Value 19 | */ 20 | class UInt32Value extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The uint32 value. 24 | * 25 | * Generated from protobuf field uint32 value = 1; 26 | */ 27 | protected $value = 0; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type int $value 36 | * The uint32 value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The uint32 value. 46 | * 47 | * Generated from protobuf field uint32 value = 1; 48 | * @return int 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The uint32 value. 57 | * 58 | * Generated from protobuf field uint32 value = 1; 59 | * @param int $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkUint32($var); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/Google/Protobuf/UInt64Value.php: -------------------------------------------------------------------------------- 1 | google.protobuf.UInt64Value 19 | */ 20 | class UInt64Value extends \Google\Protobuf\Internal\Message 21 | { 22 | /** 23 | * The uint64 value. 24 | * 25 | * Generated from protobuf field uint64 value = 1; 26 | */ 27 | protected $value = 0; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param array $data { 33 | * Optional. Data for populating the Message object. 34 | * 35 | * @type int|string $value 36 | * The uint64 value. 37 | * } 38 | */ 39 | public function __construct($data = NULL) { 40 | \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); 41 | parent::__construct($data); 42 | } 43 | 44 | /** 45 | * The uint64 value. 46 | * 47 | * Generated from protobuf field uint64 value = 1; 48 | * @return int|string 49 | */ 50 | public function getValue() 51 | { 52 | return $this->value; 53 | } 54 | 55 | /** 56 | * The uint64 value. 57 | * 58 | * Generated from protobuf field uint64 value = 1; 59 | * @param int|string $var 60 | * @return $this 61 | */ 62 | public function setValue($var) 63 | { 64 | GPBUtil::checkUint64($var); 65 | $this->value = $var; 66 | 67 | return $this; 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/phpdoc.dist.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | doc 6 | 7 | 8 | doc 9 | 10 | 11 | Google/Protobuf/Internal/MapField.php 12 | Google/Protobuf/Internal/Message.php 13 | Google/Protobuf/Internal/RepeatedField.php 14 | 15 | 16 | --------------------------------------------------------------------------------