- private function createPayload(\http\Controller $ctl) {
- $pld = new \stdClass;
-
- try {
- $pld->quick = function($string) {
- $md = \MarkdownDocument::createFromString($string);
- $md->compile(\MarkdownDocument::AUTOLINK);
- return $md->getHtml();
- };
-
- $pld->file = function($file) {
- $fd = fopen($file, "r");
- $md = \MarkdownDocument::createFromStream($fd);
- $md->compile(\MarkdownDocument::AUTOLINK | \MarkdownDocument::TOC);
- $html = $md->getHtml();
- fclose($fd);
- return $html;
- };
-
- $pld->ref = implode("/", $this->baseUrl->params(
- $this->baseUrl->mod($ctl->getRequest()->getRequestUrl())));
-
- $pld->refs = $this->reference;
- $pld->baseUrl = $this->baseUrl;
-
- } catch (\Exception $e) {
- $pld->exception = $e;
- }
-
+ private function createPayload() : object {
+ $pld = new stdClass;
+
+ $pld->esc = "htmlspecialchars";
+ $pld->anchor = [$this->reference, "formatAnchor"];
+ $pld->quick = [$this->reference, "formatString"];
+ $pld->file = [$this->reference, "formatFile"];
+
+ $pld->ref = $this->baseUrl->pathinfo(
+ $this->baseUrl->mod($this->request->getRequestUrl()));
+
+ $pld->refs = $this->reference;
+ $pld->baseUrl = $this->baseUrl;
+