ResponseParserInterface
interface ResponseParserInterface (View source)
Contract for the brand parser that turns a raw API response into its hash form.
Isolating the parse step behind this seam is the Response-tree twin of
{\CNIC\TransportInterface}: a substitute parser can be handed to a Response
(see {\CNIC\AbstractResponse::__construct()}) without reflection or
subclassing, and each brand's real parser can be exercised directly instead of
only through a fully constructed Response. The production implementations are
{\CNIC\CNR\ResponseParser} (line-oriented key=value with PROPERTY[…]
columns) and {\CNIC\IBS\ResponseParser} (JSON, falling back to plain
text), used by IBS and Moniker alike.
The signature is deliberately uniform across brands even though only IBS reads $cmd — a contract the two could not both satisfy would be no contract at all. CNR's wire format is self-describing and its parser ignores the argument.
Methods
Parse a raw API response into its hash form.
Details
array
parse(string $raw, array $cmd = [])
Parse a raw API response into its hash form.