本文整理匯總了PHP中Google\Protobuf\DescriptorProto::getNestedTypeList方法的典型用法代碼示例。如果您正苦於以下問題:PHP DescriptorProto::getNestedTypeList方法的具體用法?PHP DescriptorProto::getNestedTypeList怎麽用?PHP DescriptorProto::getNestedTypeList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Google\Protobuf\DescriptorProto
的用法示例。
在下文中一共展示了DescriptorProto::getNestedTypeList方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: compileMessage
public function compileMessage(proto\DescriptorProto $msg, $namespace)
{
$s[] = "/**";
$s[] = " * @constructor";
$s[] = " * @augments {ProtoJson.Message}";
$s[] = " * @extends ProtoJson.Message";
$s[] = " * @memberOf {$namespace}";
$s[] = " * @param {object} data - Optional, provide initial data to parse";
$s[] = " */";
$s[] = "{$namespace}.{$msg->name} = ProtoJson.create({";
$s[] = " fields: {";
$lines = array();
foreach ($msg->getFieldList() as $field) {
$lines[] = " {$field->number}: " . $this->generateField($field);
}
$s[] = implode(",\n", $lines);
$s[] = " },";
$s[] = " ranges: [";
// @todo dump extension ranges
$s[] = " ]";
$s[] = "});";
$s[] = "";
// Compute a new namespace with the message name as suffix
$namespace .= "." . $msg->getName();
// Generate getters/setters
foreach ($msg->getFieldList() as $field) {
$s[] = $this->generateAccessors($field, $namespace);
}
// Generate Enums
foreach ($msg->getEnumTypeList() as $enum) {
$s[] = $this->compileEnum($enum, $namespace);
}
// Generate nested messages
foreach ($msg->getNestedTypeList() as $msg) {
$s[] = $this->compileMessage($msg, $namespace);
}
// Collect extensions
foreach ($msg->getExtensionList() as $field) {
$this->extensions[$field->getExtendee()][] = array($namespace, $field);
}
return implode("\n", $s);
}