ResponseTemplateManager
HEXONET ResponseTemplateManager
Table of Contents
- $_instance : ResponseTemplateManager|null
- ResponseTemplateManager Instance
- $templates : array<string|int, mixed>
- template container
- __wakeup() : mixed
- wakeup prevent from being unserialized (which would create a second instance of it)
- addTemplate() : self
- Add response template to template container
- generateTemplate() : string
- Generate API response template string for given code and description
- getInstance() : self
- Get ResponseTemplateManager Instance
- getTemplate() : ResponseTemplate
- Get response template instance from template container
- getTemplates() : array<string|int, mixed>
- Return all available response templates
- hasTemplate() : bool
- Check if given template exists in template container
- isTemplateMatchHash() : bool
- Check if given API response hash matches a given template by code and description
- isTemplateMatchPlain() : bool
- Check if given API plain response matches a given template by code and description
- __clone() : mixed
- clone Forbid creating a copy of that instance from outside
- __construct() : mixed
- Constructor Forbid creating an instance from outside
Properties
$_instance
ResponseTemplateManager Instance
private
static ResponseTemplateManager|null
$_instance
= null
$templates
template container
private
array<string|int, mixed>
$templates
Methods
__wakeup()
wakeup prevent from being unserialized (which would create a second instance of it)
public
__wakeup() : mixed
Return values
mixed —addTemplate()
Add response template to template container
public
addTemplate(string $id, string $plain) : self
Parameters
- $id : string
-
template id
- $plain : string
-
API plain response
Return values
self —generateTemplate()
Generate API response template string for given code and description
public
generateTemplate(string $code, string $description) : string
Parameters
- $code : string
-
API response code
- $description : string
-
API response description
Return values
string —generate response template string
getInstance()
Get ResponseTemplateManager Instance
public
static getInstance() : self
Return values
self —getTemplate()
Get response template instance from template container
public
getTemplate(string $id) : ResponseTemplate
Parameters
- $id : string
-
template id
Return values
ResponseTemplate —template instance
getTemplates()
Return all available response templates
public
getTemplates() : array<string|int, mixed>
Return values
array<string|int, mixed> —all available response template instances
hasTemplate()
Check if given template exists in template container
public
hasTemplate(string $id) : bool
Parameters
- $id : string
-
template id
Return values
bool —boolean result
isTemplateMatchHash()
Check if given API response hash matches a given template by code and description
public
isTemplateMatchHash(array<string|int, mixed> $tpl, string $id) : bool
Parameters
- $tpl : array<string|int, mixed>
-
api response hash
- $id : string
-
template id
Return values
bool —boolean result
isTemplateMatchPlain()
Check if given API plain response matches a given template by code and description
public
isTemplateMatchPlain(string $plain, string $id) : bool
Parameters
- $plain : string
-
API plain response
- $id : string
-
template id
Return values
bool —boolean result
__clone()
clone Forbid creating a copy of that instance from outside
private
__clone() : mixed
Return values
mixed —__construct()
Constructor Forbid creating an instance from outside
private
__construct() : mixed