public function toASN1(): StringType
    {
        switch ($this->_tag) {
            case Element::TYPE_IA5_STRING:
                return new IA5String($this->_text);
            case Element::TYPE_VISIBLE_STRING:
                return new VisibleString($this->_text);
            case Element::TYPE_BMP_STRING:
                return new BMPString($this->_text);
            case Element::TYPE_UTF8_STRING:
                return new UTF8String($this->_text);
            default:
                throw new \UnexpectedValueException(
                    "Type " . Element::tagToName($this->_tag) . " not supported.");
        }
    }
public function toASN1(): StringType
    {
        switch ($this->_tag) {
            case Element::TYPE_IA5_STRING:
                return new IA5String($this->_text);
            case Element::TYPE_VISIBLE_STRING:
                return new VisibleString($this->_text);
            case Element::TYPE_BMP_STRING:
                return new BMPString($this->_text);
            case Element::TYPE_UTF8_STRING:
                return new UTF8String($this->_text);
            default:
                throw new \UnexpectedValueException(
                    "Type " . Element::tagToName($this->_tag) . " not supported.");
        }
    }
public function toASN1 ( ) : StringType { switch ( $ this -> _tag ) { case Element :: TYPE_IA5_STRING : return new IA5String ( $ this -> _text ) ; case Element :: TYPE_VISIBLE_STRING : return new VisibleString ( $ this -> _text ) ; case Element :: TYPE_BMP_STRING : return new BMPString ( $ this -> _text ) ; case Element :: TYPE_UTF8_STRING : return new UTF8String ( $ this -> _text ) ; default : throw new \ UnexpectedValueException ( "Type " . Element :: tagToName ( $ this -> _tag ) . " not supported." ) ; } }
Generate ASN.1 element.

@throws \UnexpectedValueException
@return StringType
Generate ASN . 1 element .