/**
* Parses the given response depending on its format.
*
* @param string $response Response.
* @param string $format Format.
* @return array Data.
*/
protected function _parse($response, $format)
{
switch ($format) {
case Format::json:
return Json::parse($response);
case Format::xml:
return Xml::parse($response);
default:
throw new Exception('Unsupported response format.');
}
}