1<?php 2/** 3 * This file is part of the FreeDSx ASN1 package. 4 * 5 * (c) Chad Sikorra <Chad.Sikorra@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 11namespace FreeDSx\Asn1\Type; 12 13/** 14 * Represents a Relative OID type. 15 * 16 * @author Chad Sikorra <Chad.Sikorra@gmail.com> 17 */ 18class RelativeOidType extends AbstractType 19{ 20 protected $tagNumber = self::TAG_TYPE_RELATIVE_OID; 21 22 /** 23 * @param string $value 24 */ 25 public function __construct(string $value) 26 { 27 parent::__construct($value); 28 } 29 30 /** 31 * @param string $relativeOid 32 * @return $this 33 */ 34 public function setValue(string $relativeOid) 35 { 36 $this->value = $relativeOid; 37 38 return $this; 39 } 40 41 /** 42 * @return string 43 */ 44 public function getValue(): string 45 { 46 return $this->value; 47 } 48 49 /** 50 * @return string 51 */ 52 public function __toString() 53 { 54 return (string) $this->value; 55 } 56 57 /** 58 * @param string|int $tagNumber 59 * @param int $class 60 * @param string $value 61 * @return RelativeOidType 62 */ 63 public static function withTag($tagNumber, int $class, string $value) 64 { 65 $type = new self($value); 66 $type->tagNumber = $tagNumber; 67 $type->taggingClass = $class; 68 69 return $type; 70 } 71} 72