interface ResponseTemplateFactoryInterface (View source)

The opt-in half of a template registry: turning stored templates into brand {ResponseInterface} objects, and comparing a response against one.

Separate from {\CNIC\ResponseTemplateManagerInterface} (RSRMID-2968) because the two roles have different consumers: the pipeline needs the registry and must not be able to reach this one, since every method here builds a Response that re-runs translate()/parse/column assembly.

{\CNIC\AbstractResponseTemplateManager} implements both faces on one object — a brand Response can only be built by a brand-aware class, so a standalone factory would mean a second parallel brand hierarchy for no gain. Consumers opt in by typing against the face they need.

Every method here resolves a template id against the registry, never wire text (see {\CNIC\AbstractResponseTemplateManager::createResponseFromTemplateId()}).

Methods

getTemplate(string $templateId)

The Response for the given template id, or the brand's "notfound" template when this registry holds no such id.

array
getTemplates()

Every template in this registry as a Response, keyed by template id.

bool
isTemplateMatchHash(array $responseHash, string $templateId)

Whether the given API response hash matches a template held here, on this brand's two match keys (CNR: CODE/DESCRIPTION, IBS: status/message).

bool
isTemplateMatchPlain(string $plain, string $templateId)

Whether the given API plain response matches a template held here, on this brand's two match keys.

Details

ResponseInterface getTemplate(string $templateId)

The Response for the given template id, or the brand's "notfound" template when this registry holds no such id.

The Response is built against this registry, so a template registered here resolves here and nowhere else.

Parameters

string $templateId

Return Value

ResponseInterface

array getTemplates()

Every template in this registry as a Response, keyed by template id.

Return Value

array

bool isTemplateMatchHash(array $responseHash, string $templateId)

Whether the given API response hash matches a template held here, on this brand's two match keys (CNR: CODE/DESCRIPTION, IBS: status/message).

Parameters

array $responseHash
string $templateId

Return Value

bool

bool isTemplateMatchPlain(string $plain, string $templateId)

Whether the given API plain response matches a template held here, on this brand's two match keys.

Parameters

string $plain

API plain response

string $templateId

Return Value

bool