getLabelName() public static method

Obtain the label name (repeated, optional, required).
public static getLabelName ( string $label ) : string
$label string
return string
 /**
  * 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';
 }
Example #2
0
 /**
  * @dataProvider labelNameProvider
  */
 public function testGetLabelName($type, $expected)
 {
     $this->assertEquals($expected, Field::getLabelName($type));
 }