Completed
Push — master ( 5836e1...99cc50 )
by Sam
15s queued 10s
created

SOA::outputFormatted()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 10
cts 10
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
 * @see http://www.ietf.org/rfc/rfc1035.text
16
 */
17
class SOA implements RdataInterface
18
{
19
    use RdataTrait;
20
21
    const TYPE = 'SOA';
22
23
    /**
24
     * The <domain-name> of the name server that was the
25
     * original or primary source of data for this zone.
26
     *
27
     * @var string
28
     */
29
    private $mname;
30
31
    /**
32
     * A <domain-name> which specifies the mailbox of the
33
     * person responsible for this zone.
34
     *
35
     * @var string
36
     */
37
    private $rname;
38
39
    /**
40
     * The unsigned 32 bit version number of the original copy
41
     * of the zone.
42
     *
43
     * @var int
44
     */
45
    private $serial;
46
47
    /**
48
     * A 32 bit time interval before the zone should be
49
     * refreshed.
50
     *
51
     * @var int
52
     */
53
    private $refresh;
54
55
    /**
56
     * A 32 bit time interval that should elapse before a
57
     * failed refresh should be retried.
58
     *
59
     * @var int
60
     */
61
    private $retry;
62
63
    /**
64
     * A 32 bit time value that specifies the upper limit on
65
     * the time interval that can elapse before the zone is no
66
     * longer authoritative.
67
     *
68
     * @var int
69
     */
70
    private $expire;
71
72
    /**
73
     * The unsigned 32 bit minimum TTL field that should be
74
     * exported with any RR from this zone.
75
     *
76
     * @var int
77
     */
78
    private $minimum;
79
80
    /**
81
     * @param int $expire
82
     */
83 11
    public function setExpire(int $expire): void
84
    {
85 11
        $this->expire = $expire;
86 11
    }
87
88
    /**
89
     * @return int
90
     */
91 2
    public function getExpire(): int
92
    {
93 2
        return $this->expire;
94
    }
95
96
    /**
97
     * @param int $minimum
98
     */
99 11
    public function setMinimum(int $minimum): void
100
    {
101 11
        $this->minimum = $minimum;
102 11
    }
103
104
    /**
105
     * @return int
106
     */
107 2
    public function getMinimum(): int
108
    {
109 2
        return $this->minimum;
110
    }
111
112
    /**
113
     * @param string $mname
114
     */
115 11
    public function setMname(string $mname): void
116
    {
117 11
        $this->mname = $mname;
118 11
    }
119
120
    /**
121
     * @return string
122
     */
123 2
    public function getMname(): string
124
    {
125 2
        return $this->mname;
126
    }
127
128
    /**
129
     * @param int $refresh
130
     */
131 11
    public function setRefresh(int $refresh): void
132
    {
133 11
        $this->refresh = $refresh;
134 11
    }
135
136
    /**
137
     * @return int
138
     */
139 2
    public function getRefresh(): int
140
    {
141 2
        return $this->refresh;
142
    }
143
144
    /**
145
     * @param int $retry
146
     */
147 11
    public function setRetry(int $retry): void
148
    {
149 11
        $this->retry = (int) $retry;
150 11
    }
151
152
    /**
153
     * @return int
154
     */
155 2
    public function getRetry(): int
156
    {
157 2
        return $this->retry;
158
    }
159
160
    /**
161
     * @param $rname
162
     */
163 11
    public function setRname(string $rname): void
164
    {
165 11
        $this->rname = $rname;
166 11
    }
167
168
    /**
169
     * @return string
170
     */
171 2
    public function getRname(): string
172
    {
173 2
        return $this->rname;
174
    }
175
176
    /**
177
     * @param int $serial
178
     */
179 11
    public function setSerial(int $serial): void
180
    {
181 11
        $this->serial = $serial;
182 11
    }
183
184
    /**
185
     * @return int
186
     */
187 2
    public function getSerial(): int
188
    {
189 2
        return $this->serial;
190
    }
191
192
    /**
193
     * {@inheritdoc}
194
     */
195 4
    public function output(): string
196
    {
197 4
        return sprintf(
198 4
            '%s %s %s %s %s %s %s',
199 4
            $this->mname,
200 4
            $this->rname,
201 4
            $this->serial,
202 4
            $this->refresh,
203 4
            $this->retry,
204 4
            $this->expire,
205 4
            $this->minimum
206
        );
207
    }
208
}
209