PolymorphicRdata   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 10
dl 0
loc 64
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A setType() 0 3 1
A setData() 0 3 1
A getData() 0 3 1
A __construct() 0 4 1
A output() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of Badcow DNS Library.
5
 *
6
 * (c) Samuel Williams <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Badcow\DNS\Parser;
13
14
use Badcow\DNS\Rdata\RdataInterface;
15
16
class PolymorphicRdata implements RdataInterface
17
{
18
    /**
19
     * The RData type.
20
     *
21
     * @var string
22
     */
23
    private $type;
24
25
    /**
26
     * @var string
27
     */
28
    private $data;
29
30
    /**
31
     * PolymorphicRdata constructor.
32
     *
33
     * @param string|null $type
34
     * @param string|null $data
35
     */
36 1
    public function __construct(string $type = null, string $data = null)
37
    {
38 1
        $this->setType($type);
39 1
        $this->setData($data);
40 1
    }
41
42
    /**
43
     * @param string $type
44
     */
45 1
    public function setType(?string $type): void
46
    {
47 1
        $this->type = $type;
48 1
    }
49
50
    /**
51
     * @return string
52
     */
53 1
    public function getType(): string
54
    {
55 1
        return $this->type;
56
    }
57
58
    /**
59
     * @param string $data
60
     */
61 1
    public function setData(?string $data): void
62
    {
63 1
        $this->data = $data;
64 1
    }
65
66
    /**
67
     * @return string
68
     */
69 1
    public function getData(): string
70
    {
71 1
        return $this->data;
72
    }
73
74
    /**
75
     * @return string
76
     */
77 1
    public function output(): string
78
    {
79 1
        return $this->getData();
80
    }
81
}
82