Completed
Push — master ( 1d13ba...f9bf31 )
by Sam
49:13
created

NSEC   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 73
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getNextDomainName() 0 4 1
A setNextDomainName() 0 4 1
A addTypeBitMap() 0 4 1
A clearTypeMap() 0 4 1
A getTypeBitMaps() 0 4 1
A output() 0 8 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\DNSSEC;
13
14
use Badcow\DNS\Rdata\RdataInterface;
15
use Badcow\DNS\Rdata\RdataTrait;
16
17
class NSEC implements RdataInterface
18
{
19
    use RdataTrait;
20
21
    const TYPE = 'NSEC';
22
23
    /**
24
     * The Next Domain field contains the next owner name (in the canonical
25
     * ordering of the zone) that has authoritative data or contains a
26
     * delegation point NS RRset.
27
     * {@link https://tools.ietf.org/html/rfc4034#section-4.1.1}
28
     *
29
     * @var string
30
     */
31
    private $nextDomainName;
32
33
    /**
34
     * @var array
35
     */
36
    private $typeBitMaps = [];
37
38
    /**
39
     * @return string
40
     */
41
    public function getNextDomainName()
42
    {
43
        return $this->nextDomainName;
44
    }
45
46
    /**
47
     * @param string $nextDomainName
48
     */
49
    public function setNextDomainName($nextDomainName)
50
    {
51
        $this->nextDomainName = $nextDomainName;
52
    }
53
54
    /**
55
     * @param $type
56
     */
57
    public function addTypeBitMap($type)
58
    {
59
        $this->typeBitMaps[] = $type;
60
    }
61
62
    /**
63
     * Clears the types from the RDATA
64
     */
65
    public function clearTypeMap()
66
    {
67
        $this->typeBitMaps = [];
68
    }
69
70
    /**
71
     * @return array
72
     */
73
    public function getTypeBitMaps()
74
    {
75
        return $this->typeBitMaps;
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function output()
82
    {
83
        return sprintf(
84
            '%s %s',
85
            $this->nextDomainName,
86
            implode(' ', $this->typeBitMaps)
87
        );
88
    }
89
}