PHP SDK by CNIC

ResponseTranslator
in package

HEXONET ResponseTranslator

Table of Contents

$descriptionRegexMap  : array<string|int, mixed>
hidden class var of API description regex mappings for translation
translate()  : string
translate a raw api response
findMatch()  : bool
Finds a match in the given text and performs replacements based on patterns and placeholders.

Properties

$descriptionRegexMap

hidden class var of API description regex mappings for translation

private static array<string|int, mixed> $descriptionRegexMap = [ // HX "Authorization failed; Operation forbidden by ACL" => "Authorization failed; Used Command `{COMMAND}` not white-listed by your Access Control List", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY STATUS (clientTransferProhibited)/WRONG AUTH" => "This Domain is locked and the given Authorization Code is wrong. Initiating a Transfer is therefore impossible.", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY STATUS (clientTransferProhibited)" => "This Domain is locked. Initiating a Transfer is therefore impossible.", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY STATUS (requested)" => "Registration of this Domain Name has not yet completed. Initiating a Transfer is therefore impossible.", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY STATUS (requestedcreate)" => "Registration of this Domain Name has not yet completed. Initiating a Transfer is therefore impossible.", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY STATUS (requesteddelete)" => "Deletion of this Domain Name has been requested. Initiating a Transfer is therefore impossible.", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY STATUS (pendingdelete)" => "Deletion of this Domain Name is pending. Initiating a Transfer is therefore impossible.", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY WRONG AUTH" => "The given Authorization Code is wrong. Initiating a Transfer is therefore impossible.", "Request is not available; DOMAIN TRANSFER IS PROHIBITED BY AGE OF THE DOMAIN" => "This Domain Name is within 60 days of initial registration. Initiating a Transfer is therefore impossible.", "Attribute value is not unique; DOMAIN is already assigned to your account" => "You cannot transfer a domain that is already on your account at the registrar's system.", // CNR "Missing required attribute; premium domain name. please provide required parameters" => "Confirm the Premium pricing by providing the necessary premium domain price data.", "SkipPregQuote" => [ // HX "Invalid attribute value syntax; resource record \\[(.+)\\]" => "Invalid Syntax for DNSZone Resource Record: \$1", "Missing required attribute; CLASS(?:=| \\[MUST BE )PREMIUM_([\\w\\+]+)[\\s\\]]" => "Confirm the Premium pricing by providing the parameter CLASS with the value PREMIUM_\$1.", "Syntax error in Parameter DOMAIN \\((.+)\\)" => "The Domain Name \$1 is invalid.", ], ]

Methods

translate()

translate a raw api response

public static translate(string $raw, array<string|int, string> $cmd[, array<string|int, string> $ph = [] ]) : string
Parameters
$raw : string

API raw response

$cmd : array<string|int, string>

requested API command

$ph : array<string|int, string> = []

list of place holder vars

Return values
string

findMatch()

Finds a match in the given text and performs replacements based on patterns and placeholders.

protected static findMatch(string $regex, string &$newraw, string $val, array<string|int, string> $cmd, array<string|int, string> $ph) : bool

This function searches for a specified regular expression pattern in the provided text and performs replacements based on the matched pattern, command data, and placeholder values.

Parameters
$regex : string

The regular expression pattern to search for.

$newraw : string

The input text where the match will be searched for and replacements applied.

$val : string

The value to be used in replacement if a match is found.

$cmd : array<string|int, string>

The command data containing replacements, if applicable.

$ph : array<string|int, string>

An array of placeholder values for further replacements.

Return values
bool

Returns true if replacements were performed, false otherwise.

Search results