Passed
Push — master ( 66e2c6...742734 )
by Sam
03:55
created

PolymorphicRdata   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 6
eloc 10
dl 0
loc 64
ccs 8
cts 16
cp 0.5
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
namespace Badcow\DNS\Parser;
4
5
use Badcow\DNS\Rdata\RdataInterface;
6
7
class PolymorphicRdata implements RdataInterface
8
{
9
    /**
10
     * The RData type.
11
     *
12
     * @var string
13
     */
14
    private $type;
15
16
    /**
17
     * @var string
18
     */
19
    private $data;
20
21
    /**
22
     * PolymorphicRdata constructor.
23
     *
24
     * @param string|null $type
25
     * @param string|null $data
26
     */
27 1
    public function __construct(string $type = null, string $data = null)
28
    {
29 1
        $this->type = $type;
30 1
        $this->data = $data;
31 1
    }
32
33
    /**
34
     * @param string $type
35
     */
36
    public function setType(string $type): void
37
    {
38
        $this->type = $type;
39
    }
40
41
    /**
42
     * @return string
43
     */
44 1
    public function getType(): string
45
    {
46 1
        return $this->type;
47
    }
48
49
    /**
50
     * @param string $data
51
     */
52
    public function setData(string $data): void
53
    {
54
        $this->data = $data;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getData(): string
61
    {
62
        return $this->data;
63
    }
64
65
    /**
66
     * @return string
67
     */
68 1
    public function output(): string
69
    {
70 1
        return $this->data;
71
    }
72
}
73