ResponseTemplateManager
final class ResponseTemplateManager (View source)
CNR ResponseTemplateManager
Properties
| static string[] | $templates | Template container |
Methods
Generate API response template string for given code and description
Add response template to template container
Get response template instance from template container
Return all available response templates
Check if given template exists in template container
Check if given API response hash matches a given template by code and description
Check if given API plain response matches a given template by code and description
Details
static string
generateTemplate(string $code, string $description)
Generate API response template string for given code and description
static ResponseTemplateManager
addTemplate(string $id, string $plain, string|null $descr = null)
Add response template to template container
static Response
getTemplate(string $id)
Get response template instance from template container
static array
getTemplates()
Return all available response templates
static bool
hasTemplate(string $id)
Check if given template exists in template container
static bool
isTemplateMatchHash(array $tpl, string $id)
Check if given API response hash matches a given template by code and description
static bool
isTemplateMatchPlain(string $plain, string $id)
Check if given API plain response matches a given template by code and description