Completed
Push — master ( a21f6f...b758b2 )
by Carlos
01:41
created

Request::isValidRequestType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 12
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 15
ccs 12
cts 12
cp 1
crap 1
rs 9.8666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Afonso\Dns;
6
7
class Request
8
{
9
    protected $name;
10
11
    protected $type;
12
13 12
    public function __construct(string $name, int $type)
14
    {
15 12
        if (!ResourceRecord::isValidType($type)) {
16 3
            throw new \InvalidArgumentException("'${type}' is not a valid DNS resource record type");
17
        }
18
19 9
        $this->name = $name;
20 9
        $this->type = $type;
21 9
    }
22
23 9
    public function getName(): string
24
    {
25 9
        return $this->name;
26
    }
27
28 6
    public function getType(): int
29
    {
30 6
        return $this->type;
31
    }
32
}
33