public function render($type = 'HTML') { // switch statement by response type switch (strtoupper($type)) { case 'CLI': case 'JSON': return $this->jsonSerialize(); case 'HTML': return $this->__toString(); default: return ''; } }