MxResourceRecord   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A __construct() 0 9 1
A __toString() 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 MX.
9
 */
10
class MxResourceRecord extends ResourceRecord
11
{
12
    /**
13
     * @var int
14
     */
15
    protected $preference;
16
17
    /**
18
     * @var string
19
     */
20
    protected $exchanger;
21
22 9
    public function __construct(
23
        string $name,
24
        int $ttl,
25
        int $preference,
26
        string $exchanger
27
    ) {
28 9
        parent::__construct($name, $ttl);
29 9
        $this->preference = $preference;
30 9
        $this->exchanger = $exchanger;
31 9
    }
32
33 3
    public function getType(): int
34
    {
35 3
        return ResourceRecord::TYPE_MX;
36
    }
37
38 6
    public function __toString(): string
39
    {
40 6
        return "{$this->preference} {$this->exchanger}";
41
    }
42
}
43