-
Notifications
You must be signed in to change notification settings - Fork 22
/
.protoc.php.yml
58 lines (53 loc) · 1.81 KB
/
.protoc.php.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-
match: "^(EnumDescriptorProto|FieldDescriptorProto|DescriptorProto)$"
file: "/google/protobuf/$0.php"
insertion_point: "class_scope:.google.protobuf.$0"
insertion: |
/**
* helper method for retriviing parent FileDescriptorProto message
*
* @return \google\protobuf\FileDescriptorProto
*/
public function file()
{
$parent = $this->containerOf();
while ($parent && !($parent instanceof \google\protobuf\FileDescriptorProto)) {
$parent = $parent->containerOf();
}
return $parent;
}
-
match: "^Label$"
file: "/google/protobuf/FieldDescriptorProto/Label.php"
insertion_point: "class_scope:.google.protobuf.FieldDescriptorProto.Label"
insertion: |
public static function isRequired(\google\protobuf\FieldDescriptorProto $field)
{
return self::LABEL_REQUIRED == $field->getLabel();
}
public static function isOptional(\google\protobuf\FieldDescriptorProto $field)
{
return self::LABEL_OPTIONAL == $field->getLabel();
}
public static function isRepeated(\google\protobuf\FieldDescriptorProto $field)
{
return self::LABEL_REPEATED == $field->getLabel();
}
public static function isPacked(\google\protobuf\FieldDescriptorProto $field)
{
return self::LABEL_REPEATED == $field->getLabel() &&
$field->getOptions()->getPacked();
}
-
match: "^Type$"
file: "/google/protobuf/FieldDescriptorProto/Type.php"
insertion_point: "class_scope:.google.protobuf.FieldDescriptorProto.Type"
insertion: |
public static function isMessage(\google\protobuf\FieldDescriptorProto $field)
{
return self::TYPE_MESSAGE == $field->getType();
}
public static function isEnum(\google\protobuf\FieldDescriptorProto $field)
{
return self::TYPE_ENUM == $field->getType();
}