Request::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 4
c 1
b 0
f 1
nc 2
nop 2
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 2
rs 10
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