<?php

 
 
 
 
 
 

namespace Google\Protobuf;

use Google\Protobuf\Internal\GetPublicDescriptorTrait;

class OneofDescriptor
{
    use GetPublicDescriptorTrait;

     
    private $internal_desc;

    


    public function __construct($internal_desc)
    {
        $this->internal_desc = $internal_desc;
    }

    


    public function getName()
    {
        return $this->internal_desc->getName();
    }

    



    public function getField($index)
    {
        if (
            is_null($this->internal_desc->getFields())
            || !isset($this->internal_desc->getFields()[$index])
        ) {
            return null;
        }
        return $this->getPublicDescriptor($this->internal_desc->getFields()[$index]);
    }

    


    public function getFieldCount()
    {
        return count($this->internal_desc->getFields());
    }

    public function isSynthetic()
    {
        return $this->internal_desc->isSynthetic();
    }
}
