protected function setRestBodyType($type) { $type = strtolower($type); switch ($type) { case 'json': case 'xml': $this->restBodyType = $type; break; default: throw new \Exception("REST body type '{$type}' not suported"); } }