MxResourceRecord::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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