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

Client   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A lookup() 0 14 2
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