Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ class Client implements RdapClientInterface, RdapHttpClientAwareInterface
*/
protected array $protocols = self::PROTOCOLS;

/**
* @var array<string, string> Protocol type aliases, kept for backwards compatibility
*/
private const PROTOCOL_ALIASES = [
'ipv46' => self::IPV6,
];

/**
* @var RequestFactoryInterface|null $requestFactory The PSR-17 request factory
*/
Expand Down Expand Up @@ -197,7 +204,7 @@ static function (int $code, string $message) use (&$errorCode, &$errorMessage) :
*/
public function hasProtocol(string $protocolType) : bool
{
return isset($this->protocols[$protocolType]);
return isset($this->protocols[self::PROTOCOL_ALIASES[$protocolType] ?? $protocolType]);
}

/**
Expand Down Expand Up @@ -237,6 +244,7 @@ public function getProtocol(string $protocolType) : RdapProtocolInterface
) {
$protocolType = strtolower(trim($protocolType));
}
$protocolType = self::PROTOCOL_ALIASES[strtolower(trim($protocolType))] ?? $protocolType;
if (isset($this->protocols[$protocolType])) {
if (!is_object($this->protocols[$protocolType])) {
$this->protocols[$protocolType] = new $this->protocols[$protocolType]($this);
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/RdapClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
interface RdapClientInterface
{
public const IPV4 = 'ipv4';
public const IPV6 = 'ipv46';
public const IPV6 = 'ipv6';
public const DOMAIN = 'domain';
public const NS = 'ns';
public const ASN = 'asn';
Expand Down
Loading