1 | <?php |
||
19 | class PolymorphicRdata implements RdataInterface |
||
20 | { |
||
21 | /** |
||
22 | * The RData type. |
||
23 | * |
||
24 | * @var string|null |
||
25 | */ |
||
26 | private $type; |
||
27 | |||
28 | /** |
||
29 | * @var string|null |
||
30 | */ |
||
31 | private $data; |
||
32 | |||
33 | /** |
||
34 | * @var int|null |
||
35 | */ |
||
36 | private $typeCode; |
||
37 | |||
38 | /** |
||
39 | * PolymorphicRdata constructor. |
||
40 | * |
||
41 | * @param string|null $type |
||
42 | * @param string|null $data |
||
43 | */ |
||
44 | 1 | public function __construct(?string $type = null, ?string $data = null) |
|
54 | |||
55 | /** |
||
56 | * @param string $type |
||
57 | */ |
||
58 | 1 | public function setType(string $type): void |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 1 | public function getType(): string |
|
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function getTypeCode(): int |
||
83 | |||
84 | /** |
||
85 | * @deprecated |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function output(): string |
||
90 | { |
||
91 | @trigger_error('Method RdataInterface::output() has been deprecated. Use RdataInterface::toText().', E_USER_DEPRECATED); |
||
|
|||
92 | |||
93 | return $this->toText(); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * @param string $data |
||
98 | */ |
||
99 | 1 | public function setData(string $data): void |
|
103 | |||
104 | /** |
||
105 | * @return string|null |
||
106 | */ |
||
107 | 1 | public function getData(): ?string |
|
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 1 | public function toText(): string |
|
119 | |||
120 | /** |
||
121 | * {@inheritdoc} |
||
122 | */ |
||
123 | public function toWire(): string |
||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | public static function fromText(string $text): RdataInterface |
||
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | public static function fromWire(string $rdata): RdataInterface |
||
143 | } |
||
144 |
If you suppress an error, we recommend checking for the error condition explicitly: