Skip to content

Commit

Permalink
Move function to concrete class instead of abstract...
Browse files Browse the repository at this point in the history
...so this probably should have been moved when I moved the rest.
It worked as is but did make things domain specific in the 'abstract'.
  • Loading branch information
mallardduck committed May 5, 2018
1 parent d7cfba6 commit 5434884
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
15 changes: 1 addition & 14 deletions src/WhoisServerList/AbstractLocator.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
namespace MallardDuck\Whois\WhoisServerList;

use MallardDuck\Whois\Exceptions\UnknownWhoisException;

/**
* Whois Server List Locator Class
*
Expand Down Expand Up @@ -94,16 +92,5 @@ abstract public function findWhoisServer($domain);
*
* @return string Returns the domain name of the whois server.
*/
public function getWhoisServer($domain = '')
{
if (!empty($domain) || empty($this->lastMatch)) {
$this->findWhoisServer($domain);
}
$server = current($this->lastMatch);
if ('UNKNOWN' === strtoupper($server)) {
throw new UnknownWhoisException("This domain doesn't have a valid whois server.");
}

return $server;
}
abstract public function getWhoisServer($domain = '');
}
20 changes: 20 additions & 0 deletions src/WhoisServerList/DomainLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,24 @@ public function findWhoisServer($domain)

return $this;
}

/**
* Get the Whois server of the domain provided, or previously found domain.
*
* @param string $domain The domain being looked up via whois.
*
* @return string Returns the domain name of the whois server.
*/
public function getWhoisServer($domain = '')
{
if (!empty($domain) || empty($this->lastMatch)) {
$this->findWhoisServer($domain);
}
$server = current($this->lastMatch);
if ('UNKNOWN' === strtoupper($server)) {
throw new UnknownWhoisException("This domain doesn't have a valid whois server.");
}

return $server;
}
}

0 comments on commit 5434884

Please sign in to comment.