public function __toString() { $contentType = $this->first()->getContentType(); $data = $this->getData(); switch ($contentType) { case 'application/json': $content = json_encode($data); break; case 'application/xml': $content = Utils::convertToXML($this->getData(), 'result', array($this, 'normalizeKey')); break; default: throw new \RuntimeException("Unsupported multi-response content type: {$contentType}"); } return $content; }
public function __toString() { return Utils::convertToXML($this->getData(), 'result', array($this, 'normalizeKey')); }