public static function fromString(string $str): self
    {
        $rdns = array();
        foreach (DNParser::parseString($str) as $nameComponent) {
            $attribs = array();
            foreach ($nameComponent as list($name, $val)) {
                $type = AttributeType::fromName($name);
                // hexstrings are parsed to ASN.1 elements
                if ($val instanceof Element) {
                    $el = $val;
                } else {
                    $el = AttributeType::asn1StringForType($type->oid(), $val);
                }
                $value = AttributeValue::fromASN1ByOID($type->oid(),
                    $el->asUnspecified());
                $attribs[] = new AttributeTypeAndValue($type, $value);
            }
            $rdns[] = new RDN(...$attribs);
        }
        return new self(...$rdns);
    }
public static function fromString(string $str): self
    {
        $rdns = array();
        foreach (DNParser::parseString($str) as $nameComponent) {
            $attribs = array();
            foreach ($nameComponent as list($name, $val)) {
                $type = AttributeType::fromName($name);
                // hexstrings are parsed to ASN.1 elements
                if ($val instanceof Element) {
                    $el = $val;
                } else {
                    $el = AttributeType::asn1StringForType($type->oid(), $val);
                }
                $value = AttributeValue::fromASN1ByOID($type->oid(),
                    $el->asUnspecified());
                $attribs[] = new AttributeTypeAndValue($type, $value);
            }
            $rdns[] = new RDN(...$attribs);
        }
        return new self(...$rdns);
    }
public static function fromString ( string $ str ) : self { $ rdns = array ( ) ; foreach ( DNParser :: parseString ( $ str ) as $ nameComponent ) { $ attribs = array ( ) ; foreach ( $ nameComponent as list ( $ name , $ val ) ) { $ type = AttributeType :: fromName ( $ name ) ; // hexstrings are parsed to ASN.1 elements if ( $ val instanceof Element ) { $ el = $ val ; } else { $ el = AttributeType :: asn1StringForType ( $ type -> oid ( ) , $ val ) ; } $ value = AttributeValue :: fromASN1ByOID ( $ type -> oid ( ) , $ el -> asUnspecified ( ) ) ; $ attribs [ ] = new AttributeTypeAndValue ( $ type , $ value ) ; } $ rdns [ ] = new RDN ( ... $ attribs ) ; } return new self ( ... $ rdns ) ; }
Initialize from distinguished name string.

@link https://tools.ietf.org/html/rfc1779
@param string $str
@return self
Initialize from distinguished name string .