Passed
Push — master ( c1e68f...f0bd78 )
by Sam
01:33 queued 10s
created

DNSKEY   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 25
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A setProtocol() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Badcow DNS Library.
7
 *
8
 * (c) Samuel Williams <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Badcow\DNS\Rdata;
15
16
/**
17
 * Class DNSKEY.
18
 *
19
 * {@link https://tools.ietf.org/html/rfc4034#section-2.1}
20
 */
21
class DNSKEY extends KEY
22
{
23
    const TYPE = 'DNSKEY';
24
    const TYPE_CODE = 48;
25
26
    /**
27
     * The Protocol Field MUST have value 3, and the DNSKEY RR MUST be
28
     * treated as invalid during signature verification if it is found to be
29
     * some value other than 3.
30
     * {@link https://tools.ietf.org/html/rfc4034#section-2.1.2}.
31
     *
32
     * @var int
33
     */
34
    protected $protocol = 3;
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 3
    public function setProtocol(int $protocol): void
40
    {
41 3
        if (3 !== $protocol) {
42 1
            throw new \InvalidArgumentException('DNSKEY RData: parameter <protocol> can only be set to "3".');
43
        }
44
45 2
        parent::setProtocol($protocol);
46 2
    }
47
}
48