function process($webscript, $method) { $this->deleteInvalidTickets(); try { $reflectedWebscript = new ReflectionAnnotatedClass(ucfirst($webscript) . "Webscript"); if ($reflectedWebscript->hasMethod($method)) { $methodInstance = $reflectedWebscript->getMethod($method); if ($methodInstance->isPublic()) { $args = ""; $ticket = ""; if ($methodInstance->hasAnnotation("Get")) { $args = $_GET['data']; $ticket = $_GET['ticket']; } if ($methodInstance->hasAnnotation("Post")) { $args = $_POST['data']; $ticket = $_POST['ticket']; } if ($methodInstance->hasAnnotation("RequiresAuthentication")) { if ($this->checkAuthentication($ticket, $methodInstance->getAnnotation("RequiresAuthentication"))) { $this->extendAuthentication($ticket); } else { return $this->authenticationFailed(); } } return $methodInstance->invoke($reflectedWebscript->newInstance(), $args, $ticket); } } else { return $this->notFound(); } } catch (ReflectionException $e) { return $this->notFound(); } }