<?php
namespace google\protobuf\FieldDescriptorProto;

// @@protoc_insertion_point(namespace:.google.protobuf.FieldDescriptorProto.Label)

/**
 * Generated by the protocol buffer compiler.  DO NOT EDIT!
 * source: google/protobuf/descriptor.proto
 *
 */
class Label extends \ProtocolBuffers\Enum
{
  // @@protoc_insertion_point(traits:.google.protobuf.FieldDescriptorProto.Label)
  
  /**
   * 0 is reserved for errors
   */
  const LABEL_OPTIONAL = 1;
  const LABEL_REQUIRED = 2;
  const LABEL_REPEATED = 3;
  
  // @@protoc_insertion_point(const_scope:.google.protobuf.FieldDescriptorProto.Label)
  
  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();
  }
  // @@protoc_insertion_point(class_scope:.google.protobuf.FieldDescriptorProto.Label)
  
  /**
   * @return \ProtocolBuffers\EnumDescriptor
   */
  public static function getEnumDescriptor()
  {
    static $descriptor;
    if (!$descriptor) {
      $builder = new \ProtocolBuffers\EnumDescriptorBuilder();
      $builder->addValue(new \ProtocolBuffers\EnumValueDescriptor(array(
        "value" => self::LABEL_OPTIONAL,
        "name"  => 'LABEL_OPTIONAL',
      )));
      $builder->addValue(new \ProtocolBuffers\EnumValueDescriptor(array(
        "value" => self::LABEL_REQUIRED,
        "name"  => 'LABEL_REQUIRED',
      )));
      $builder->addValue(new \ProtocolBuffers\EnumValueDescriptor(array(
        "value" => self::LABEL_REPEATED,
        "name"  => 'LABEL_REPEATED',
      )));
      // @@protoc_insertion_point(builder_scope:.google.protobuf.FieldDescriptorProto.Label)
      $descriptor = $builder->build();
    }
    return $descriptor;
  }
}
