1 | <?php |
||
22 | class NAPTR implements RdataInterface |
||
23 | { |
||
24 | use RdataTrait; |
||
25 | |||
26 | const TYPE = 'NAPTR'; |
||
27 | const TYPE_CODE = 35; |
||
28 | |||
29 | /** |
||
30 | * A 16-bit unsigned integer specifying the order in which the NAPTR |
||
31 | * records MUST be processed in order to accurately represent the |
||
32 | * ordered list of Rules. The ordering is from lowest to highest. |
||
33 | * If two records have the same order value then they are considered |
||
34 | * to be the same rule and should be selected based on the |
||
35 | * combination of the Preference values and Services offered. |
||
36 | * |
||
37 | * @var int|null |
||
38 | */ |
||
39 | private $order; |
||
40 | |||
41 | /** |
||
42 | * It is a 16-bit unsigned integer that specifies the order in which |
||
43 | * NAPTR records with equal Order values SHOULD be processed, low |
||
44 | * numbers being processed before high numbers. |
||
45 | * |
||
46 | * @var int |
||
47 | */ |
||
48 | private $preference; |
||
49 | |||
50 | /** |
||
51 | * A <character-string> containing flags to control aspects of the |
||
52 | * rewriting and interpretation of the fields in the record. Flags |
||
53 | * are single characters from the set A-Z and 0-9. The case of the |
||
54 | * alphabetic characters is not significant. The field can be empty. |
||
55 | * |
||
56 | * @var string|null |
||
57 | */ |
||
58 | private $flags; |
||
59 | |||
60 | /** |
||
61 | * A <character-string> that specifies the Service Parameters |
||
62 | * applicable to this this delegation path. It is up to the |
||
63 | * Application Specification to specify the values found in this |
||
64 | * field. |
||
65 | * |
||
66 | * @var string|null |
||
67 | */ |
||
68 | private $services; |
||
69 | |||
70 | /** |
||
71 | * A <character-string> containing a substitution expression that is |
||
72 | * applied to the original string held by the client in order to |
||
73 | * construct the next domain name to lookup. |
||
74 | * |
||
75 | * @var string|null |
||
76 | */ |
||
77 | private $regexp; |
||
78 | |||
79 | /** |
||
80 | * A <domain-name> which is the next domain-name to query for |
||
81 | * depending on the potential values found in the flags field. This |
||
82 | * field is used when the regular expression is a simple replacement |
||
83 | * operation. Any value in this field MUST be a fully qualified |
||
84 | * domain-name. |
||
85 | * |
||
86 | * @var string |
||
87 | */ |
||
88 | private $replacement; |
||
89 | |||
90 | /** |
||
91 | * @return int |
||
92 | */ |
||
93 | 4 | public function getOrder(): ?int |
|
97 | |||
98 | /** |
||
99 | * @param int $order |
||
100 | * |
||
101 | * @throws \InvalidArgumentException |
||
102 | */ |
||
103 | 8 | public function setOrder(int $order): void |
|
111 | |||
112 | /** |
||
113 | * @return int |
||
114 | */ |
||
115 | 4 | public function getPreference(): ?int |
|
119 | |||
120 | /** |
||
121 | * @param int $preference |
||
122 | * |
||
123 | * @throws \InvalidArgumentException |
||
124 | */ |
||
125 | 8 | public function setPreference(int $preference): void |
|
133 | |||
134 | /** |
||
135 | * @return string |
||
136 | */ |
||
137 | 4 | public function getFlags(): ?string |
|
141 | |||
142 | /** |
||
143 | * @param string $flags |
||
144 | */ |
||
145 | 8 | public function setFlags(?string $flags): void |
|
149 | |||
150 | /** |
||
151 | * @return string |
||
152 | */ |
||
153 | 4 | public function getServices(): ?string |
|
157 | |||
158 | /** |
||
159 | * @param string $services |
||
160 | */ |
||
161 | 8 | public function setServices(?string $services): void |
|
165 | |||
166 | /** |
||
167 | * @return string |
||
168 | */ |
||
169 | 4 | public function getRegexp(): ?string |
|
173 | |||
174 | /** |
||
175 | * @param string $regexp |
||
176 | */ |
||
177 | 8 | public function setRegexp(?string $regexp): void |
|
181 | |||
182 | /** |
||
183 | * @return string |
||
184 | */ |
||
185 | 4 | public function getReplacement(): ?string |
|
189 | |||
190 | /** |
||
191 | * @param string $replacement |
||
192 | */ |
||
193 | 8 | public function setReplacement(string $replacement): void |
|
201 | |||
202 | /** |
||
203 | * {@inheritdoc} |
||
204 | */ |
||
205 | 2 | public function toText(): string |
|
216 | |||
217 | /** |
||
218 | * {@inheritdoc} |
||
219 | */ |
||
220 | 2 | public function toWire(): string |
|
228 | |||
229 | /** |
||
230 | * {@inheritdoc} |
||
231 | * |
||
232 | * @return NAPTR |
||
233 | */ |
||
234 | 2 | public static function fromText(string $text): RdataInterface |
|
247 | |||
248 | /** |
||
249 | * {@inheritdoc} |
||
250 | * |
||
251 | * @return NAPTR |
||
252 | */ |
||
253 | 2 | public static function fromWire(string $rdata): RdataInterface |
|
268 | |||
269 | /** |
||
270 | * Extract text from within quotation marks and advance the offset. |
||
271 | * |
||
272 | * @param string $string |
||
273 | * @param int $offset |
||
274 | * |
||
275 | * @return string |
||
276 | */ |
||
277 | 2 | private static function extractText(string $string, int &$offset): string |
|
295 | } |
||
296 |