DummyResolver::isAuthority()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of PHP DNS Server.
5
 *
6
 * (c) Yif Swery <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace yswery\DNS\Tests;
13
14
use yswery\DNS\RecordTypeEnum;
15
use yswery\DNS\Resolver\ResolverInterface;
16
use yswery\DNS\ResourceRecord;
17
18
class DummyResolver implements ResolverInterface
19
{
20
    public function isAuthority($domain): bool
21
    {
22
        return true;
23
    }
24
25
    public function allowsRecursion(): bool
26
    {
27
        return false;
28
    }
29
30
    /**
31
     * @param ResourceRecord[] $queries
32
     *
33
     * @return array
34
     */
35
    public function getAnswer(array $queries, ?string $client = null): array
36
    {
37
        $q = $queries[0];
38
39
        return [(new ResourceRecord())
40
            ->setName($q->getName())
41
            ->setClass($q->getClass())
42
            ->setTtl(300)
43
            ->setType(RecordTypeEnum::TYPE_OPT)
44
            ->setRdata('Some data'), ];
45
    }
46
}
47