本文整理汇总了PHP中google\protobuf\FieldDescriptorProto\Type::isEnum方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::isEnum方法的具体用法?PHP Type::isEnum怎么用?PHP Type::isEnum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google\protobuf\FieldDescriptorProto\Type
的用法示例。
在下文中一共展示了Type::isEnum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFullQualifiedTypeName
public static function getFullQualifiedTypeName(FieldDescriptorProto $field, DescriptorProto $descriptor, FileDescriptorProto $file)
{
if (FieldDescriptorProto\Type::isMessage($field) || FieldDescriptorProto\Type::isEnum($field)) {
$name = $field->getTypeName();
if (strlen($name) < 1) {
return null;
}
if ($name[0] == ".") {
$name = Helper::getPackageName($file) . $name;
} else {
$name = $descriptor->package_name . $name;
}
} else {
$name = $field->getTypeName();
}
return $name;
}
示例2: printProperties
public function printProperties(Printer $printer)
{
if ($this->descriptor->getOptions()->getExtension("php_option")->getUseSingleProperty()) {
$printer->put("/** @var array \$`var` */\n", "var", $this->descriptor->getOptions()->getExtension("php_option")->getSinglePropertyName());
$printer->put("protected \$`var` = array();\n", "var", $this->descriptor->getOptions()->getExtension("php_option")->getSinglePropertyName());
} else {
foreach ($this->descriptor->getField() as $field) {
/* @var $field \google\protobuf\FieldDescriptorProto */
$printer->put("/**\n");
if ($dict = SourceInfoDictionary::get($this->descriptor->file()->getName(), $this->descriptor->getName(), $field->getName())) {
/* @var $dict \google\protobuf\SourceCodeInfo\Location */
if ($dict->getLeadingComments()) {
$lines = preg_split("/\r?\n/", trim($dict->getLeadingComments()));
foreach ($lines as $line) {
$line = Helper::cleanupComment($line);
$printer->put(" * `comment`\n", "comment", $line);
}
$printer->put(" *\n");
}
}
$printer->put(" * @var `type` \$`var`\n", "type", $this->getTypeName($field), "var", $field->getName());
$printer->put(" * @tag `tag`\n", "tag", $field->getNumber());
$printer->put(" * @label `required`\n", "required", FieldDescriptorProto\Label::isRequired($field) ? "required" : "optional");
$printer->put(" * @type `type`\n", "type", Helper::getFieldTypeName($field));
if (FieldDescriptorProto\Label::isRepeated($field) && FieldDescriptorProto\Type::isMessage($field) || FieldDescriptorProto\Type::isEnum($field)) {
$printer->put(" * @see `see`\n", "see", Helper::getClassName($field, true));
}
if ($dict = SourceInfoDictionary::get($this->descriptor->file()->getName(), $this->descriptor->getName(), $field->getName())) {
/* @var $dict \google\protobuf\SourceCodeInfo\Location */
if ($dict->getTrailingComments()) {
$printer->put(" *\n");
$lines = preg_split("/\r?\n/", trim($dict->getTrailingComments()));
foreach ($lines as $line) {
$printer->put(" * `comment`\n", "comment", Helper::cleanupComment($line));
}
$printer->put(" *\n");
}
}
$printer->put(" **/\n");
$printer->put("protected \$`name`;\n", "name", $field->getName());
$printer->put("\n");
}
}
$printer->put("\n");
$printer->put("// @@protoc_insertion_point(properties_scope:`name`)\n\n", "name", $this->descriptor->full_name);
}