Test Failed
Push — master ( ed95ce...c4bcac )
by Daniel
02:07
created

Client::getRegistrableDomain()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 1
dl 0
loc 7
ccs 0
cts 0
cp 0
crap 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace MallardDuck\Whois;
3
4
use MallardDuck\Whois\Exceptions\MissingArgException;
5
6
/**
7
 * The Whois Client Class.
8
 *
9
 * @author mallardduck <[email protected]>
10
 * @copyright lucidinternets.com 2018
11
 * @version 1.0.0
12
 */
13
class Client extends AbstractClient
14
{
15
16
    /**
17
     * Construct the Whois Client Class.
18
     */
19
    public function __construct()
20
    {
21
        parent::__construct();
22
    }
23
24
    /**
25
     * Performs a Whois look up on the domain provided.
26
     * @param  string $domain The domain being looked up via whois.
27
     * @return string         The output of the Whois look up.
28
     */
29
    public function lookup($domain = '')
30
    {
31
        if (empty($domain)) {
32
            throw new MissingArgException("Must provide a domain name when using lookup method.");
33 9
        }
34
        $this->parseWhoisDomain($domain);
35 9
36 9
        // Get the domains whois server.
37
        $whoisServer = $this->tldLocator->getWhoisServer($this->parsedDomain);
38
39
        // Get the full output of the whois lookup.
40
        $response = $this->makeWhoisRequest($this->parsedDomain, $whoisServer);
41
42
        return $response;
43 6
    }
44
45
}
46