AbstractClient
abstract class AbstractClient (View source)
Shared foundation for all registrar API clients.
Concrete subclasses provide the request() implementation, the default logger, and the appropriate SocketConfig subtype.
Constants
| private VERSION |
Current module version. Kept in sync automatically by semantic-release — see .releaserc.json. |
Properties
| protected array<string, mixed> | $context | context data for the client |
|
| protected string | $socketURL | API connection url |
|
| protected AbstractSocketConfig | $socketConfig | Object covering API connection data |
|
| protected bool | $debugMode | activity flag for debug mode |
|
| protected string | $ua | user agent |
|
| protected array<int, mixed> | $curlopts | additional curl options to use |
|
| protected LoggerInterface | $logger | logger instance for debug mode |
|
| protected bool | $isOTE | is connected to OT&E |
|
| protected HttpTransport | $transport | HTTP transport layer |
Methods
Constructor
Perform API request using the given command.
Instantiate the SocketConfig for this client.
Set the default logger for this client.
Enable debug output to STDOUT
Disable debug output
Serialize given command for POST request including connection configuration data
Get the API Session ID that is currently set
Get the API connection url that is currently set
Set a custom user agent (for platforms that use this SDK)
Get the user agent string
Set proxy to use for API communication
Get proxy configuration for API communication
Set Referer to use for API communication
Get Referer configuration for API communication
Get the current module version
Set another connection url to be used for API communication
Set an API session id to be used for API communication
Set Credentials to be used for API communication
Set Role Credentials to be used for API communication
Activate High Performance Setup
Convert domain names to idn + punycode if necessary
Auto convert API command parameters to punycode, if necessary.
Delegate cURL execution to the transport layer.
Close all cURL connections
Get LIVE system URL
Check whether the client is connected to the OT&E system
Set OT&E System for API communication
Set LIVE System for API communication (this is the default setting)
Set context data for the client
Details
__construct()
Constructor
abstract ResponseInterface
request(array $cmd = [])
Perform API request using the given command.
Each client implements its own command serialisation and response type.
abstract protected AbstractSocketConfig
newSocketConfig()
Instantiate the SocketConfig for this client.
Subclasses return their own SocketConfig subtype.
abstract AbstractClient
setDefaultLogger()
Set the default logger for this client.
Subclasses instantiate the appropriate Logger implementation.
AbstractClient
setCustomLogger(LoggerInterface $customLogger)
Set custom logger to use instead of the default one.
Create your own class implementing \CNIC\LoggerInterface.
AbstractClient
enableDebugMode()
Enable debug output to STDOUT
AbstractClient
disableDebugMode()
Disable debug output
string
getPOSTData(array $cmd, bool $secured = false)
Serialize given command for POST request including connection configuration data
string|null
getSession()
Get the API Session ID that is currently set
string
getURL()
Get the API connection url that is currently set
AbstractClient
setUserAgent(string $str, string $rv, array $modules = [])
Set a custom user agent (for platforms that use this SDK)
string
getUserAgent()
Get the user agent string
AbstractClient
setProxy(string $proxy = "")
Set proxy to use for API communication
string|null
getProxy()
Get proxy configuration for API communication
AbstractClient
setReferer(string $referer = "")
Set Referer to use for API communication
string|null
getReferer()
Get Referer configuration for API communication
string
getVersion()
Get the current module version
AbstractClient
setURL(string $value)
Set another connection url to be used for API communication
AbstractClient
setSession(string $value = "")
Set an API session id to be used for API communication
AbstractClient
setCredentials(string $uid = "", string $pw = "")
Set Credentials to be used for API communication
AbstractClient
setRoleCredentials(string $uid = "", string $role = "", string $pw = "")
Set Role Credentials to be used for API communication
AbstractClient
useHighPerformanceConnectionSetup()
Activate High Performance Setup
array
IDNConvert(array $domains)
Convert domain names to idn + punycode if necessary
protected array
autoIDNConvert(array $cmd)
Auto convert API command parameters to punycode, if necessary.
protected array
executeCurl(string $data, array $cfg, array $extraCurlOpts = [])
Delegate cURL execution to the transport layer.
void
close()
Close all cURL connections
string
getLiveUrl()
Get LIVE system URL
bool
isOTE()
Check whether the client is connected to the OT&E system
AbstractClient
useOTESystem()
Set OT&E System for API communication
AbstractClient
useLIVESystem()
Set LIVE System for API communication (this is the default setting)
AbstractClient
setContext(array $context)
Set context data for the client