statusCode = $statusCode; $this->body = $body; } /** * @return int */ public function getStatusCode(): int { return $this->statusCode; } /** * @param string $key * @return mixed|null */ public function getFromBody(string $key) { return $this->body[$key] ?? null; } /** * @return string|null */ public function getMessage(): ?string { return $this->getFromBody('message'); } /** * @return string */ public function getRequestId(): string { return $this->getFromBody('requestId') ?? 'unknown'; } /** * @return bool */ abstract public function isSuccessful(): bool; }