Esempio n. 1
0
File: RDN.php Progetto: sop/x501
 /**
  * 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);
 }
Esempio n. 2
0
 /**
  * Get AttributeTypeAndValue object with this as a value.
  *
  * @return AttributeTypeAndValue
  */
 public function toAttributeTypeAndValue()
 {
     return AttributeTypeAndValue::fromAttributeValue($this);
 }
Esempio n. 3
0
 /**
  * Check whether attribute is semantically equal to other.
  *
  * @param AttributeTypeAndValue $other Object to compare to
  * @return bool
  */
 public function equals(AttributeTypeAndValue $other)
 {
     // check that attribute types match
     if ($this->oid() !== $other->oid()) {
         return false;
     }
     $matcher = $this->_value->equalityMatchingRule();
     $result = $matcher->compare($this->_value->stringValue(), $other->_value->stringValue());
     // match
     if ($result) {
         return true;
     }
     // no match or Undefined
     return false;
 }