getParams(); $currentType = currentRequestType(); if ($currentType === RequestType::OPTIONS) { respondStatus(200); } if ($authenticationRequired) { $auth = new Authenticator(); if (!$auth->isAuthenticated($params)) { $this->authenticationMissing($params); return; } } if ($currentType === RequestType::GET) { $this->get($params); } else if ($currentType === RequestType::POST) { $this->post($params); } else { respondStatus(405); } } private function getParams() { $content = json_decode(file_get_contents('php://input'), true); if ($content == NULL) $content = array(); return new ParamCleaner(array_merge($content, $_REQUEST, $_SESSION, $_FILES)); } } ?>