1 | <?php |
||
20 | class DisplayText |
||
21 | { |
||
22 | /** |
||
23 | * Text. |
||
24 | * |
||
25 | * @var string $_text |
||
26 | */ |
||
27 | protected $_text; |
||
28 | |||
29 | /** |
||
30 | * Element tag. |
||
31 | * |
||
32 | * @var int $_tag |
||
33 | */ |
||
34 | protected $_tag; |
||
35 | |||
36 | /** |
||
37 | * Constructor. |
||
38 | * |
||
39 | * @param string $text |
||
40 | * @param int $tag |
||
41 | */ |
||
42 | 24 | public function __construct(string $text, int $tag) |
|
47 | |||
48 | /** |
||
49 | * Initialize from ASN.1. |
||
50 | * |
||
51 | * @param StringType $el |
||
52 | * @return self |
||
53 | */ |
||
54 | 13 | public static function fromASN1(StringType $el): self |
|
58 | |||
59 | /** |
||
60 | * Initialize from a UTF-8 string. |
||
61 | * |
||
62 | * @param string $str |
||
63 | * @return self |
||
64 | */ |
||
65 | 6 | public static function fromString(string $str): self |
|
69 | |||
70 | /** |
||
71 | * Get the text. |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | 8 | public function string(): string |
|
79 | |||
80 | /** |
||
81 | * Generate ASN.1 element. |
||
82 | * |
||
83 | * @throws \UnexpectedValueException |
||
84 | * @return StringType |
||
85 | */ |
||
86 | 25 | public function toASN1(): StringType |
|
102 | |||
103 | /** |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | 3 | public function __toString() |
|
111 | } |
||
112 |