SoaResourceRecord   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 24
c 1
b 0
f 0
dl 0
loc 72
ccs 20
cts 20
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 9 1
A getType() 0 3 1
A __construct() 0 19 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 SOA.
9
 */
10
class SoaResourceRecord extends ResourceRecord
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $nameserver;
16
17
    /**
18
     * @var string
19
     */
20
    protected $email;
21
22
    /**
23
     * @var int
24
     */
25
    protected $serialNumber;
26
27
    /**
28
     * @var int
29
     */
30
    protected $refresh;
31
32
    /**
33
     * @var int
34
     */
35
    protected $retry;
36
37
    /**
38
     * @var int
39
     */
40
    protected $expiry;
41
42
    /**
43
     * @var int
44
     */
45
    protected $negativeCachingTime;
46
47 9
    public function __construct(
48
        string $name,
49
        int $ttl,
50
        string $nameserver,
51
        string $email,
52
        int $serialNumber,
53
        int $refresh,
54
        int $retry,
55
        int $expiry,
56
        int $negativeCachingTime
57
    ) {
58 9
        parent::__construct($name, $ttl);
59 9
        $this->nameserver = $nameserver;
60 9
        $this->email = $email;
61 9
        $this->serialNumber = $serialNumber;
62 9
        $this->refresh = $refresh;
63 9
        $this->retry = $retry;
64 9
        $this->expiry = $expiry;
65 9
        $this->negativeCachingTime = $negativeCachingTime;
66 9
    }
67
68 3
    public function getType(): int
69
    {
70 3
        return ResourceRecord::TYPE_SOA;
71
    }
72
73 6
    public function __toString(): string
74
    {
75 6
        return "{$this->nameserver}"
76 6
            . " {$this->email}"
77 6
            . " {$this->serialNumber}"
78 6
            . " {$this->refresh}"
79 6
            . " {$this->retry}"
80 6
            . " {$this->expiry}"
81 6
            . " {$this->negativeCachingTime}";
82
    }
83
}
84