/** * Initialize from ASN.1. * * @param Set $set * @return self */ public static function fromASN1(Set $set) { $attribs = array_map(function (UnspecifiedType $el) { return AttributeTypeAndValue::fromASN1($el->asSequence()); }, $set->elements()); return new self(...$attribs); }
/** * Initialize from ASN.1. * * @param Set $set * @return self */ public static function fromASN1(Set $set) { $attribs = array_map(function (UnspecifiedType $el) { return Attribute::fromASN1($el->asSequence()); }, $set->elements()); // cast attributes $attribs = array_map(function (Attribute $attr) { $oid = $attr->oid(); if (array_key_exists($oid, self::MAP_OID_TO_CLASS)) { $cls = self::MAP_OID_TO_CLASS[$oid]; return $attr->castValues($cls); } return $attr; }, $attribs); return new self(...$attribs); }