| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 111 | public function findWhoisServer($domain) |
|
| 36 | { |
||
| 37 | 111 | if (empty($domain)) { |
|
| 38 | 18 | throw new MissingArgException("Must provide domain argument."); |
|
| 39 | } |
||
| 40 | |||
| 41 | $tldInfo = $this->whoisCollection->filter(function ($item, $key) use ($domain) { |
||
| 42 | 102 | return preg_match('/'.$key.'/', $domain); |
|
| 43 | 102 | }); |
|
| 44 | 102 | if (empty($tldInfo->all())) { |
|
| 45 | 12 | throw new UnknownWhoisException("This domain doesn't have a valid TLD whois server."); |
|
| 46 | } |
||
| 47 | 90 | $this->lastMatch = $tldInfo->all(); |
|
| 48 | |||
| 49 | 90 | return $this; |
|
| 50 | } |
||
| 52 |