Total Complexity | 7 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
19 | class CNAME implements RdataInterface |
||
20 | { |
||
21 | use RdataTrait; |
||
22 | |||
23 | const TYPE = 'CNAME'; |
||
24 | const TYPE_CODE = 5; |
||
25 | |||
26 | /** |
||
27 | * @var string|null |
||
28 | */ |
||
29 | protected $target; |
||
30 | |||
31 | /** |
||
32 | * @param string $target |
||
33 | */ |
||
34 | 42 | public function setTarget(string $target): void |
|
37 | 42 | } |
|
38 | |||
39 | /** |
||
40 | * @return string |
||
41 | */ |
||
42 | 15 | public function getTarget(): ?string |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | 10 | public function toText(): string |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | 5 | public function toWire(): string |
|
59 | { |
||
60 | 5 | if (null === $this->target) { |
|
61 | 1 | throw new \InvalidArgumentException('Target must be set.'); |
|
62 | } |
||
63 | |||
64 | 5 | return self::encodeName($this->target); |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 14 | public function fromText(string $text): void |
|
73 | 14 | } |
|
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | 10 | public function fromWire(string $rdata, int &$offset = 0, ?int $rdLength = null): void |
|
81 | 10 | } |
|
82 | } |
||
83 |