ResponseTemplateManager
final class ResponseTemplateManager extends AbstractResponseTemplateManager (View source)
IBS ResponseTemplateManager
Constants
| private BUILTIN_TEMPLATES |
IBS's built-in templates. A constant, not a property: each registry
instance copies these at construction and mutates only its copy, so there
is no route by which one caller's override reaches another (RSRMID-2941). |
Methods
No description
Create an IBS Response instance from a template id.
Instantiate the IBS response parser.
IBS compares templates on the status and message hash keys.
Register a template on this registry.
Every template in this registry as a Response, keyed by template id.
Every template in this registry as its raw wire text.
Check if given template exists in this registry.
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
Generate API response template string for given status and description
Get response template instance from this registry
Details
__construct()
No description
static protected array
builtinTemplates()
No description
protected ResponseInterface
createResponseFromTemplateId(string $templateId)
Create an IBS Response instance from a template id.
The registry is handed to the Response so the template id resolves against this object — that hand-off is what replaced the global lookup.
protected ResponseParserInterface
newResponseParser()
Instantiate the IBS response parser.
static protected array
matchKeys()
IBS compares templates on the status and message hash keys.
ResponseTemplateManagerInterface
addTemplate(string $templateId, string $plain, string|null $description = null)
Register a template on this registry.
array
getTemplates()
Every template in this registry as a Response, keyed by template id.
array
getRawTemplates()
Every template in this registry as its raw wire text.
bool
hasTemplate(string $templateId)
Check if given template exists in this registry.
bool
isTemplateMatchHash(array $responseHash, string $templateId)
Check if given API response hash matches a given template by code and description
bool
isTemplateMatchPlain(string $plain, string $templateId)
Check if given API plain response matches a given template by code and description
string
generateTemplate(string $code, string $description)
Generate API response template string for given status and description
ResponseInterface
getTemplate(string $templateId)
Get response template instance from this registry