/** * Obtain the rule for the given field (repeated, optional, required). * * @param \google\protobuf\FieldDescriptorProto $field * * @return string */ protected function getFieldLabelName(FieldDescriptorProto $field) { $label = $field->getLabel()->value(); $name = Field::getLabelName($label); return $name ?: 'unknown'; }
/** * @dataProvider labelNameProvider */ public function testGetLabelName($type, $expected) { $this->assertEquals($expected, Field::getLabelName($type)); }