Completed
Branch v2 (ec0e33)
by Sam
02:09
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
    public function setExpire(int $expire): void
84
    {
85
        $this->expire = $expire;
86
    }
87
88
    /**
89
     * @return int
90
     */
91
    public function getExpire(): int
92
    {
93
        return $this->expire;
94
    }
95
96
    /**
97
     * @param int $minimum
98
     */
99
    public function setMinimum(int $minimum): void
100
    {
101
        $this->minimum = $minimum;
102
    }
103
104
    /**
105
     * @return int
106
     */
107
    public function getMinimum(): int
108
    {
109
        return $this->minimum;
110
    }
111
112
    /**
113
     * @param string $mname
114
     */
115
    public function setMname(string $mname): void
116
    {
117
        $this->mname = $mname;
118
    }
119
120
    /**
121
     * @return string
122
     */
123
    public function getMname(): string
124
    {
125
        return $this->mname;
126
    }
127
128
    /**
129
     * @param int $refresh
130
     */
131
    public function setRefresh(int $refresh): void
132
    {
133
        $this->refresh = $refresh;
134
    }
135
136
    /**
137
     * @return int
138
     */
139
    public function getRefresh(): int
140
    {
141
        return $this->refresh;
142
    }
143
144
    /**
145
     * @param int $retry
146
     */
147
    public function setRetry(int $retry): void
148
    {
149
        $this->retry = (int) $retry;
150
    }
151
152
    /**
153
     * @return int
154
     */
155
    public function getRetry(): int
156
    {
157
        return $this->retry;
158
    }
159
160
    /**
161
     * @param $rname
162
     */
163
    public function setRname(string $rname): void
164
    {
165
        $this->rname = $rname;
166
    }
167
168
    /**
169
     * @return string
170
     */
171
    public function getRname(): string
172
    {
173
        return $this->rname;
174
    }
175
176
    /**
177
     * @param int $serial
178
     */
179
    public function setSerial(int $serial): void
180
    {
181
        $this->serial = $serial;
182
    }
183
184
    /**
185
     * @return int
186
     */
187
    public function getSerial(): int
188
    {
189
        return $this->serial;
190
    }
191
192
    /**
193
     * {@inheritdoc}
194
     */
195
    public function output(): string
196
    {
197
        return sprintf(
198
            '%s %s %s %s %s %s %s',
199
            $this->mname,
200
            $this->rname,
201
            $this->serial,
202
            $this->refresh,
203
            $this->retry,
204
            $this->expire,
205
            $this->minimum
206
        );
207
    }
208
}
209