final class ResponseTranslator extends AbstractResponseTranslator (View source)

IBS 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

static array
templates()

The IBS static template container.

static array
descriptionRegexMap()

No description

static array
descriptionRawPatternMap()

No description

static string
fieldName()

IBS carries the human-readable text in the message field.

static bool
hasMissingRequiredFields(string $raw)

IBS falls back to the "invalid" template when status is missing (JSON or plain) or present but empty. message is optional in success cases and is deliberately not checked.

static string
translate(string $raw, array $cmd, array $placeholders = [])

translate a raw api response

static 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.

Details

static protected array templates()

The IBS static template container.

Return Value

array

static protected array descriptionRegexMap()

No description

Return Value

array

static protected array descriptionRawPatternMap()

No description

Return Value

array

static protected string fieldName()

IBS carries the human-readable text in the message field.

Return Value

string

static protected bool hasMissingRequiredFields(string $raw)

IBS falls back to the "invalid" template when status is missing (JSON or plain) or present but empty. message is optional in success cases and is deliberately not checked.

Parameters

string $raw

API raw response (already normalised)

Return Value

bool

static string translate(string $raw, array $cmd, array $placeholders = [])

translate a raw api response

Parameters

string $raw

API raw response

array $cmd

requested API command

array $placeholders

Return Value

string

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.

Parameters

string $raw
array $placeholders

Return Value

string