$operation = http_request("Operation", "s", null); $manga = http_request("Manga", "i", 0); if ($operation === null) { throw new Exception("Call to mangaFunctions without 'Operation' requested"); } $mangas = new Mangas("mangaFunctions", $jornada); $am = new AuthManager("mangaFunctions"); switch ($operation) { // no direct "insert", as created/destroyed from jornadaFunctions case "update": $am->access(PERMS_OPERATOR); $result = $mangas->update($manga); break; case "sharejuez": $am->access(PERMS_OPERATOR); $result = $mangas->shareJuez(); break; // no direct delete as created/destroyed from jornadaFunctions // no direct delete as created/destroyed from jornadaFunctions case "enumerate": $result = $mangas->selectByJornada(); break; case "swap": $result = $mangas->swapMangas($manga); break; case "getbyid": $result = $mangas->selectByID($manga); break; default: throw new Exception("mangaFunctions:: invalid operation: {$operation} provided"); }