app = $app; $app->getView()->addData([ "pages" => $this->wikiPages() ]); } function __invoke(array $args = null) { $title = $args["page"]; $page = $this->wikiPath($args["page"]); $this->app->display("pages/wiki", compact("title", "page")); } function wikiPages() { return array_filter(array_map(function($s) { return strtr(basename($s, ".md"), "-", " "); }, scandir(self::WIKI_PATH)), function($s) { return $s{0} !== "."; }); } function wikiPath($page) { $file = basename(strtr($page, " ", "-"), ".md") . ".md"; return self::WIKI_PATH . $file; } }