| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 6 | public function lookup($domain = '') |
|
| 44 | { |
||
| 45 | 6 | if (empty($domain)) { |
|
| 46 | 3 | throw new MissingArgException("Must provide a domain name when using lookup method."); |
|
| 47 | } |
||
| 48 | // Get the domains whois server. |
||
| 49 | 3 | $whoisServer = $this->tldLocator->getWhoisServer($domain); |
|
| 50 | // Form a socket connection to the whois server. |
||
| 51 | 3 | $client = new SocketClient('tcp://' . $whoisServer . ':43'); |
|
| 52 | 3 | $client->connect(); |
|
| 53 | // Send the domain name requested for whois lookup. |
||
| 54 | 3 | $client->writeLine($domain . $this->clrf); |
|
| 55 | |||
| 56 | // Read and return the full output of the whois lookup. |
||
| 57 | 3 | return $client->readAll(); |
|
| 58 | } |
||
| 60 |