1 | <?php |
||
22 | class ResourceRecord |
||
23 | { |
||
24 | /** |
||
25 | * @var int|null |
||
26 | */ |
||
27 | private $classId = 1; |
||
28 | |||
29 | /** |
||
30 | * @var RdataInterface|null |
||
31 | */ |
||
32 | private $rdata; |
||
33 | |||
34 | /** |
||
35 | * @var int|null |
||
36 | */ |
||
37 | private $ttl; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | private $name; |
||
43 | |||
44 | /** |
||
45 | * @var string|null |
||
46 | */ |
||
47 | private $comment; |
||
48 | |||
49 | /** |
||
50 | * @param int $ttl |
||
51 | * @param string $comment |
||
52 | 16 | */ |
|
53 | public static function create(string $name, RdataInterface $rdata, int $ttl = null, string $class = Classes::INTERNET, string $comment = null): ResourceRecord |
||
64 | |||
65 | /** |
||
66 | * Set the class for the resource record |
||
67 | * Usually one of IN, HS, or CH. |
||
68 | * |
||
69 | * @param string $class |
||
70 | * |
||
71 | * @throws InvalidArgumentException |
||
72 | 45 | */ |
|
73 | public function setClass(?string $class): void |
||
87 | |||
88 | /** |
||
89 | * Set the name for the resource record. |
||
90 | * Eg. "subdomain.example.com.". |
||
91 | 54 | */ |
|
92 | public function setName(string $name): void |
||
96 | |||
97 | /** |
||
98 | * @param RdataInterface $rdata |
||
99 | 51 | */ |
|
100 | public function setRdata(?RdataInterface $rdata): void |
||
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | 40 | */ |
|
108 | public function getClass(): ?string |
||
116 | 8 | ||
117 | public function setClassId(int $classId): void |
||
121 | 2 | ||
122 | public function getClassId(): ?int |
||
126 | |||
127 | /** |
||
128 | * Set the time to live. |
||
129 | * |
||
130 | * @param int $ttl |
||
131 | 54 | */ |
|
132 | public function setTtl(?int $ttl): void |
||
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | 39 | */ |
|
140 | public function getName(): ?string |
||
144 | |||
145 | /** |
||
146 | * @return string |
||
147 | 29 | */ |
|
148 | public function getType(): ?string |
||
156 | |||
157 | /** |
||
158 | * @return RdataInterface |
||
159 | 33 | */ |
|
160 | public function getRdata(): ?RdataInterface |
||
164 | |||
165 | /** |
||
166 | * @return int |
||
167 | 36 | */ |
|
168 | public function getTtl(): ?int |
||
172 | |||
173 | /** |
||
174 | * Set a comment for the record. |
||
175 | * |
||
176 | * @param string $comment |
||
177 | 45 | */ |
|
178 | public function setComment(?string $comment): void |
||
182 | |||
183 | /** |
||
184 | * Get the record's comment. |
||
185 | * |
||
186 | * @return string |
||
187 | 13 | */ |
|
188 | public function getComment(): ?string |
||
192 | |||
193 | /** |
||
194 | * @throws UnsetValueException|InvalidArgumentException |
||
195 | 8 | */ |
|
196 | public function toWire(): string |
||
231 | |||
232 | /** |
||
233 | * @throws Rdata\UnsupportedTypeException |
||
234 | 8 | */ |
|
235 | public static function fromWire(string $encoded, int &$offset = 0): ResourceRecord |
||
252 | } |
||
253 |