Test Failed
Push — master ( 069f49...4b1c03 )
by Ludwig
06:38
created

PowerDNSClientFactory::createClient()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 3
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the Cwd PowerDNS Client
4
 *
5
 * (c) 2018 cwd.at GmbH <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Cwd\PowerDNSClient;
14
15
class PowerDNSClientFactory
16
{
17
    static public function createClient(string $uri, string $apiKey, ?string $defaultServer = null): PowerDNSClient
18
    {
19
        $client = new Client($uri, $apiKey);
20
        $pdns = new PowerDNSClient($client);
21
        if ($defaultServer !== null) {
22
            $pdns->setDefaultServerId($defaultServer);
23
        }
24
25
        return $pdns;
26
    }
27
}