ResponseTranslator
final class ResponseTranslator extends AbstractResponseTranslator (View source)
CNR ResponseTranslator
Constants
| private DESCRIPTION_REGEX_MAP |
plain-string description keys for translation; keys are preg_quote'd before matching |
| private DESCRIPTION_RAW_PATTERN_MAP |
raw regex pattern keys for translation; keys are used as-is (not preg_quote'd) |
Methods
A fresh CNR template registry holding the brand's built-ins.
No description
No description
CNR carries the human-readable text in the DESCRIPTION field.
CNR falls back to the "invalid" template when CODE or DESCRIPTION is missing, or DESCRIPTION is present but empty.
translate a raw api response
Replace known placeholders in the human-readable field while preserving literal brace content and unknown-token content in other fields.
Details
static protected ResponseTemplateManagerInterface
newTemplateManager()
A fresh CNR template registry holding the brand's built-ins.
static protected array
descriptionRegexMap()
No description
static protected array
descriptionRawPatternMap()
No description
static protected string
fieldName()
CNR carries the human-readable text in the DESCRIPTION field.
static protected bool
hasMissingRequiredFields(string $raw)
CNR falls back to the "invalid" template when CODE or DESCRIPTION is missing, or DESCRIPTION is present but empty.
static string
translate(string $raw, array $cmd, array $placeholders = [], string|null $error = null, ResponseTemplateManagerInterface|null $templates = null)
translate a raw api response
static protected string
replacePlaceholders(string $raw, array $placeholders)
Replace known placeholders in the human-readable field while preserving literal brace content and unknown-token content in other fields.
Operates line-by-line on the brand's field (see fieldName()): provided placeholders are substituted, unknown {UPPER} tokens are stripped, and any other brace content (e.g. lowercase %{i} in SPF records) is left untouched.