response = $response; $body = $this->response->getBody()->getContents(); $bom = pack("CCC", 0xef, 0xbb, 0xbf); if (0 === strncmp($body, $bom, 3)) { $body = substr($body, 3); } $this->responseString = $body; $this->responseArray = json_decode($this->getResponseString(), true); // writes $this->responseArray; $this->jsonSerialize(); } /** * @return string */ public function getResponseString() { return $this->responseString; } /** * @return array */ public function jsonSerialize() { return $this->responseArray; } /** * @return array */ public function toArray() { return $this->jsonSerialize(); } }