+
+ /**
+ * Server a PHP stub
+ */
+ private function serveStub() {
+ $name = $this->request->getQuery("ref", "s");
+ $repo = $this->reference->getRepoForEntry($name);
+ if (!$repo->hasStub($stub)) {
+ throw new Exception(404, "Stub not found");
+ }
+ $this->response->setHeader("Content-Type", "application/x-php");
+ $this->response->setContentDisposition(["attachment" => ["filename" => "$name.stub.php"]]);
+ $this->response->setBody(new Body(fopen($stub, "r")));
+ $this->response->send();
+ }
+