diff options
Diffstat (limited to 'src/compiler/php_generator_helpers.h')
-rw-r--r-- | src/compiler/php_generator_helpers.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/compiler/php_generator_helpers.h b/src/compiler/php_generator_helpers.h index 3a5c08b3e6..5edebf6290 100644 --- a/src/compiler/php_generator_helpers.h +++ b/src/compiler/php_generator_helpers.h @@ -26,9 +26,22 @@ namespace grpc_php_generator { +inline grpc::string GetPHPServiceClassname( + const grpc::protobuf::ServiceDescriptor *service, + const grpc::string ¶meter) { + grpc::string suffix; + if (parameter == "") { + suffix = "Client"; + } else { + suffix = parameter; + } + return service->name() + suffix; +} + inline grpc::string GetPHPServiceFilename( const grpc::protobuf::FileDescriptor *file, - const grpc::protobuf::ServiceDescriptor *service) { + const grpc::protobuf::ServiceDescriptor *service, + const grpc::string ¶meter) { std::vector<grpc::string> tokens = grpc_generator::tokenize(file->package(), "."); std::ostringstream oss; @@ -36,7 +49,7 @@ inline grpc::string GetPHPServiceFilename( oss << (i == 0 ? "" : "/") << grpc_generator::CapitalizeFirstLetter(tokens[i]); } - return oss.str() + "/" + service->name() + "Client.php"; + return oss.str() + "/" + GetPHPServiceClassname(service, parameter) + ".php"; } // ReplaceAll replaces all instances of search with replace in s. |