diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-06-05 00:10:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-05 00:10:18 -0700 |
commit | 6f325805c0bc956f927b0e2dbfb4dd8133b4ed69 (patch) | |
tree | 2f7d596b8e19933b67868d7378bb663960b75f87 /php/src/Google/Protobuf/Internal/FileOptions.php | |
parent | fbaad3617fbfadafbcc653a621620a5081df64eb (diff) |
Add new file option php_namespace. (#3162)
* Add new file option php_namespace.
Use this option to change the namespace of php generated classes.
Default is empty. When this option is empty, the package name will be
used for determining the namespace.
* Uncomment commented tests
* Revert gdb test change
* Update csharp descriptor.
* Add test for empty php_namespace.
Diffstat (limited to 'php/src/Google/Protobuf/Internal/FileOptions.php')
-rw-r--r-- | php/src/Google/Protobuf/Internal/FileOptions.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 22653a4f..332da3dc 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -188,6 +188,17 @@ class FileOptions extends \Google\Protobuf\Internal\Message private $has_php_class_prefix = false; /** * <pre> + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + * </pre> + * + * <code>optional string php_namespace = 41;</code> + */ + private $php_namespace = ''; + private $has_php_namespace = false; + /** + * <pre> * The parser stores options it doesn't recognize here. See above. * </pre> * @@ -231,6 +242,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->java_package = $var; $this->has_java_package = true; + + return $this; } public function hasJavaPackage() @@ -270,6 +283,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->java_outer_classname = $var; $this->has_java_outer_classname = true; + + return $this; } public function hasJavaOuterClassname() @@ -311,6 +326,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->java_multiple_files = $var; $this->has_java_multiple_files = true; + + return $this; } public function hasJavaMultipleFiles() @@ -342,6 +359,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->java_generate_equals_and_hash = $var; $this->has_java_generate_equals_and_hash = true; + + return $this; } public function hasJavaGenerateEqualsAndHash() @@ -383,6 +402,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->java_string_check_utf8 = $var; $this->has_java_string_check_utf8 = true; + + return $this; } public function hasJavaStringCheckUtf8() @@ -406,6 +427,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkEnum($var, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class); $this->optimize_for = $var; $this->has_optimize_for = true; + + return $this; } public function hasOptimizeFor() @@ -445,6 +468,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->go_package = $var; $this->has_go_package = true; + + return $this; } public function hasGoPackage() @@ -492,6 +517,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->cc_generic_services = $var; $this->has_cc_generic_services = true; + + return $this; } public function hasCcGenericServices() @@ -515,6 +542,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->java_generic_services = $var; $this->has_java_generic_services = true; + + return $this; } public function hasJavaGenericServices() @@ -538,6 +567,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->py_generic_services = $var; $this->has_py_generic_services = true; + + return $this; } public function hasPyGenericServices() @@ -575,6 +606,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->deprecated = $var; $this->has_deprecated = true; + + return $this; } public function hasDeprecated() @@ -608,6 +641,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkBool($var); $this->cc_enable_arenas = $var; $this->has_cc_enable_arenas = true; + + return $this; } public function hasCcEnableArenas() @@ -641,6 +676,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->objc_class_prefix = $var; $this->has_objc_class_prefix = true; + + return $this; } public function hasObjcClassPrefix() @@ -672,6 +709,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->csharp_namespace = $var; $this->has_csharp_namespace = true; + + return $this; } public function hasCsharpNamespace() @@ -709,6 +748,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->swift_prefix = $var; $this->has_swift_prefix = true; + + return $this; } public function hasSwiftPrefix() @@ -742,6 +783,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message GPBUtil::checkString($var, True); $this->php_class_prefix = $var; $this->has_php_class_prefix = true; + + return $this; } public function hasPhpClassPrefix() @@ -751,6 +794,43 @@ class FileOptions extends \Google\Protobuf\Internal\Message /** * <pre> + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + * </pre> + * + * <code>optional string php_namespace = 41;</code> + */ + public function getPhpNamespace() + { + return $this->php_namespace; + } + + /** + * <pre> + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + * </pre> + * + * <code>optional string php_namespace = 41;</code> + */ + public function setPhpNamespace($var) + { + GPBUtil::checkString($var, True); + $this->php_namespace = $var; + $this->has_php_namespace = true; + + return $this; + } + + public function hasPhpNamespace() + { + return $this->has_php_namespace; + } + + /** + * <pre> * The parser stores options it doesn't recognize here. See above. * </pre> * @@ -773,6 +853,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; + + return $this; } public function hasUninterpretedOption() |