SrvResourceRecord   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 48
ccs 14
cts 14
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 6 1
A __construct() 0 13 1
A getType() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Afonso\Dns;
6
7
/**
8
 * This class represents a DNS Resource Record of type SRV.
9
 */
10
class SrvResourceRecord extends ResourceRecord
11
{
12
    /**
13
     * @var int
14
     */
15
    protected $priority;
16
17
    /**
18
     * @var int
19
     */
20
    protected $weight;
21
22
    /**
23
     * @var int
24
     */
25
    protected $port;
26
27
    /**
28
     * @var string
29
     */
30
    protected $target;
31
32 9
    public function __construct(
33
        string $name,
34
        int $ttl,
35
        int $priority,
36
        int $weight,
37
        int $port,
38
        string $target
39
    ) {
40 9
        parent::__construct($name, $ttl);
41 9
        $this->priority = $priority;
42 9
        $this->weight = $weight;
43 9
        $this->port = $port;
44 9
        $this->target = $target;
45 9
    }
46
47 3
    public function getType(): int
48
    {
49 3
        return ResourceRecord::TYPE_SRV;
50
    }
51
52 6
    public function __toString(): string
53
    {
54 6
        return "{$this->priority}"
55 6
            . " {$this->weight}"
56 6
            . " {$this->port}"
57 6
            . " {$this->target}";
58
    }
59
}
60