-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathPTR.php
50 lines (42 loc) · 1.13 KB
/
PTR.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Spatie\Dns\Records;
/**
* @method string reversDnsName()
*/
class PTR extends Record
{
protected string $reversDnsName;
protected string $name;
public static function parse(string $line): ?self
{
$attributes = static::lineToArray($line, 5);
if (count($attributes) < 5) {
return null;
}
return static::make([
'reversDnsName' => $attributes[0],
'ttl' => $attributes[1],
'class' => $attributes[2],
'type' => $attributes[3],
'name' => $attributes[4],
]);
}
public function __toString(): string
{
return "{$this->reversDnsName}.\t\t{$this->ttl}\t{$this->class}\t{$this->type}\t{$this->name}";
}
public function toArray()
{
return [
'reversDnsName' => $this->reversDnsName,
'ttl' => $this->ttl,
'class' => $this->class,
'type' => $this->type,
'name' => $this->name,
];
}
protected function castReversDnsName(string $value): string
{
return $this->prepareDomain($value);
}
}