Completed
Branch monolith (e7771f)
by Sam
01:35
created

PolymorphicRdata   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 66
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setType() 0 4 1
A getType() 0 4 1
A setData() 0 4 1
A getData() 0 4 1
A output() 0 4 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\Rdata;
13
14
/**
15
 * Used to create RData of types that have not yet been implemented in the library.
16
 */
17
class PolymorphicRdata implements RdataInterface
18
{
19
    /**
20
     * The RData type.
21
     *
22
     * @var string
23
     */
24
    private $type;
25
26
    /**
27
     * @var string
28
     */
29
    private $data;
30
31
    /**
32
     * PolymorphicRdata constructor.
33
     *
34
     * @param string|null $type
35
     * @param string|null $data
36
     */
37 1
    public function __construct(string $type = null, string $data = null)
38
    {
39 1
        $this->setType($type);
40 1
        $this->setData($data);
41 1
    }
42
43
    /**
44
     * @param string $type
45
     */
46 1
    public function setType(?string $type): void
47
    {
48 1
        $this->type = $type;
49 1
    }
50
51
    /**
52
     * @return string
53
     */
54 1
    public function getType(): string
55
    {
56 1
        return $this->type;
57
    }
58
59
    /**
60
     * @param string $data
61
     */
62 1
    public function setData(?string $data): void
63
    {
64 1
        $this->data = $data;
65 1
    }
66
67
    /**
68
     * @return string
69
     */
70 1
    public function getData(): string
71
    {
72 1
        return $this->data;
73
    }
74
75
    /**
76
     * @return string
77
     */
78 1
    public function output(): string
79
    {
80 1
        return $this->getData();
81
    }
82
}
83