diff --git a/src/Client.php b/src/Client.php index 5c27fb1..98f6e26 100644 --- a/src/Client.php +++ b/src/Client.php @@ -64,6 +64,13 @@ class Client implements RdapClientInterface, RdapHttpClientAwareInterface */ protected array $protocols = self::PROTOCOLS; + /** + * @var array Protocol type aliases, kept for backwards compatibility + */ + private const PROTOCOL_ALIASES = [ + 'ipv46' => self::IPV6, + ]; + /** * @var RequestFactoryInterface|null $requestFactory The PSR-17 request factory */ @@ -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]); } /** @@ -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); diff --git a/src/Interfaces/RdapClientInterface.php b/src/Interfaces/RdapClientInterface.php index 34b6e14..421fb45 100644 --- a/src/Interfaces/RdapClientInterface.php +++ b/src/Interfaces/RdapClientInterface.php @@ -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';