Passed
Push — master ( c592e8...73d0c8 )
by Daniel
02:00
created

Client::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 60
    public function __construct()
20
    {
21 60
        parent::__construct();
22 60
    }
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 54
    public function lookup($domain = '')
30
    {
31 54
        if (empty($domain)) {
32 3
            throw new MissingArgException("Must provide a domain name when using lookup method.");
33
        }
34 51
        $this->parseWhoisDomain($domain);
35
36
        // Get the domains whois server.
37 51
        $whoisServer = $this->tldLocator->getWhoisServer($this->parsedDomain);
38
39
        // Get the full output of the whois lookup.
40 33
        $response = $this->makeWhoisRequest($this->parsedDomain, $whoisServer);
41
42 33
        return $response;
43
    }
44
}
45