request->getHttpMethod()) { case 'GET': $id = $this->request->getURIParams()[0]; return $this->returnResultGameID($id); case 'POST': $id = $this->request->getURIParams()[0]; $data = json_decode(file_get_contents("php://input"),TRUE); return $this->saveAwnser($id, $data); break; case 'DELETE': $data = json_decode(file_get_contents("php://input"),TRUE); return $this->deleteLine($data); break; case 'OPTIONS': return Response::okresponse(json_encode("OPTIONS")); } return Response::errorResponse("unsupported parameters or method in game"); } public function saveAwnser($id, $data) { Result::saveAwnser(array(":id" => $id, ":user_id" => $data['USER_ID'], ":awn" => $data['value'])); return Response::okresponse(json_encode("Tout va bien")); } public function returnResultGameID($id) { $result = Result::returnResultGameID(array(":id" => $id)); return Response::okresponse(json_encode($result)); } public function deleteLine($data) { Result::deleteLigne(array(":id" => $data['USER_ID'])); return Response::okresponse(json_encode("Theo")); } }