public function switchType($type) { // switch statement by content type switch ($type) { case 'JSON': $this->setHeader('Content-Type', 'application/json'); break; case 'CLI': case 'HTML': default: break; } $this->type = $type; }