RelativeDistinguishedName.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /*
  3. * This file is part of the PHPASN1 library.
  4. *
  5. * Copyright © Friedrich Große <friedrich.grosse@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace FG\ASN1\Composite;
  11. use FG\ASN1\Exception\NotImplementedException;
  12. use FG\ASN1\ASNObject;
  13. use FG\ASN1\Universal\Set;
  14. class RelativeDistinguishedName extends Set
  15. {
  16. /**
  17. * @param string|\FG\ASN1\Universal\ObjectIdentifier $objIdentifierString
  18. * @param \FG\ASN1\ASNObject $value
  19. */
  20. public function __construct($objIdentifierString, ASNObject $value)
  21. {
  22. // TODO: This does only support one element in the RelativeDistinguishedName Set but it it is defined as follows:
  23. // RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue
  24. parent::__construct(new AttributeTypeAndValue($objIdentifierString, $value));
  25. }
  26. public function getContent()
  27. {
  28. /** @var \FG\ASN1\ASNObject $firstObject */
  29. $firstObject = $this->children[0];
  30. return $firstObject->__toString();
  31. }
  32. /**
  33. * At the current version this code can not work since the implementation of Construct requires
  34. * the class to support a constructor without arguments.
  35. *
  36. * @deprecated this function is not yet implemented! Feel free to submit a pull request on github
  37. * @param string $binaryData
  38. * @param int $offsetIndex
  39. * @throws NotImplementedException
  40. */
  41. public static function fromBinary(&$binaryData, &$offsetIndex = 0)
  42. {
  43. throw new NotImplementedException();
  44. }
  45. }