Index

DocPageController

MMO\doc\controllers · 1 symbol · generated 30 Sep 2026

class

DocPageController

DocPageController.php:33

Renders a generated documentation page as real html, instead of dropping its markdown into an <mmo-markdown>.

class MMO\doc\controllers\DocPageController extends MMO\core\classes\aController
Namespace
MMO\doc\controllers
Extends
aController
It reads the `.json` model the generator writes next to every `.md` page ([`DocPage`](https://mcp.mmoframework.fr/documentation/mmo.doc/php/models/DocPage.md#docpage)) and hands it to [`HtmlPrinter`](https://mcp.mmoframework.fr/documentation/mmo.doc/php/HtmlPrinter.md#htmlprinter), which paints it with mmo.client's own elements and the Simple CSS design system (`src/styles/documentation.scs`). Nothing is reflected, parsed or fetched at request time: the model already holds resolved types, resolved cross links and the call graph. ### How it takes over It claims `documentation*` at a lower `order` than `MMO\client\controllers\PageController`'s catch-all `**` (1000), so it runs first -- and only calls [`Route::stop`](https://mcp.mmoframework.fr/documentation/mmo.core/php/server/Route.md#route-stop) when it really has a model to render. A page without one (a hand-written `.md`, a pdf, anything else in a library's documentation folder) is left alone, and `PageController` handles it exactly as before -- under the top bar this controller puts at the top of every documentation page (the way back to the index, and the search box). `documentation` itself is the index of everything documented ([`renderIndex`](https://mcp.mmoframework.fr/documentation/mmo.doc/php/controllers/DocPageController.md#docpagecontroller-renderindex)).

Index

ROOT
cssClass
indexTemplate
template
decorate($document, $content, $page, $trail)Give the document the chrome a page of the site is expected to have: a title, a description, the sibling navigation and the breadcrumbs -- the same things PageController would have added had it h…
findContent($route, $trail)Walk the page tree the way PageController does, and return the content the url points at -- but only when it is a documentation page carrying a model (includeDocumentation, which re…
IndexUrl() static
onRoute($route)Never claims the route: this listener runs before PageController's (-10 vs -9), and claiming would make PageController drop out of the route -- leaving nobody to render the pages this controlle…
relpath($route)
renderIndex($route)The index of the whole documentation: every namespace, class, interface, trait, enum, exception, function, element… of every installed library (DocIndex::Sections).
routeDocumentation($route)
TopbarOptions() staticThe top bar has no search box of its own: the documentation is searched from the application's command palette (addSearchSource), the one search box of the application.

Constants1

ROOT

const ROOT = 'documentation'

Properties3

cssClass

string $cssClass = 'doc'
Type
string

indexTemplate

string $indexTemplate = 'doc/index.phtml'
Type
string

template

string $template = 'doc/page.phtml'
Type
string

Methods8

decorate($document, $content, $page, $trail)

DocPageController.php:202

Give the document the chrome a page of the site is expected to have: a title, a description, the sibling navigation and the breadcrumbs -- the same things PageController would have added had it handled the route itself.

protected function decorate( MMO\core\documents\HtmlDocument $document, MMO\client\entities\File $content, MMO\doc\models\DocPage $page, array $trail ): void
$documentHtmlDocument
$contentFile
$pageDocPage
$trailarraythe label => url trail leading to the page, page included
returnsvoid

findContent($route, $trail)

DocPageController.php:169

Walk the page tree the way PageController does, and return the content the url points at -- but only when it is a documentation page carrying a model (includeDocumentation, which records it as data.model). Anything else returns null, so the normal page controller keeps the route.

protected function findContent(MMO\core\server\Route $route, ?array &$trail = null): ?MMO\client\entities\File
$routeRoute
$trail = nullnull | arrayfilled with the label => url trail leading to the page, page included
returnsnull | File

onRoute($route)

DocPageController.php:54

Never claims the route: this listener runs before PageController's (-10 vs -9), and claiming would make PageController drop out of the route -- leaving nobody to render the pages this controller passes on (a library's index, a hand-written .md...). It only takes over, in routeDocumentation, when it really has a model to render.

function onRoute(MMO\core\server\Route $route): bool
$routeRoute
returnsbool

relpath($route)

DocPageController.php:157
protected function relpath(MMO\core\server\Route $route): string
$routeRoute
returnsstringthe path of the page asked for, from the site's root: documentation/mmo.core/php/Route.md

renderIndex($route)

DocPageController.php:122

The index of the whole documentation: every namespace, class, interface, trait, enum, exception, function, element… of every installed library (DocIndex::Sections). It is what documentation itself shows, and what the top bar of every other page links back to.

function renderIndex(MMO\core\server\Route $route): void
$routeRoute
returnsvoid

routeDocumentation($route)

DocPageController.php:65
#[MMO\core\attributes\APIRoute('documentation/**', 'Render a generated documentation page as html.', order: 900, mediaTypes: ['html'])] function routeDocumentation(MMO\core\server\Route $route): void
$routeRoute
returnsvoid
Inherited members (55)
ConstantsDeclared byDescription
ALERTiLogLevelAlert: Action must be taken immediately.
ALLiLogLevelMask for all
ALL_PLUSiLogLeveldebug everything
BACKTRACEiLogLevel
CRITICALiLogLevelCritical: Critical conditions.
DEBUGiLogLevelDebug: Detailed debug information.
DEEPiLogLeveldebug everything with arguments
EMERGENCYiLogLevelEmergency: System is unusable.
ERRORiLogLevelError: Runtime errors that do not require immediate action but should typically be logged and monitored.
ERROR_PLUSiLogLevelMask for all error
FATALiLogLevelMask for all fatal error
INFOiLogLevelInfo: Interesting events.
INFO_PLUSiLogLevelMask for all errors/warning/notices/info
MEMORYiLogLevelinclude backtrace object
NOTICEiLogLevelNotice: Normal but significant events.
NOTICE_PLUSiLogLevelMask for all errors/warning/notices/info
TRACEiLogLevelinclude backtrace as origins
WARNINGiLogLevelWarning: Exceptional occurrences that are not errors.
WARNING_PLUSiLogLevelMask for all errors and warnings
PropertiesDeclared byDescription
verbosityaModule
MethodsDeclared byDescription
alert($message, $context)aModuleAction must be taken immediately.
backtraces($message, $context)aModuleForce-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).
Configure($config)aModuleMerge $config into this module's configuration in the shared Configuration.
critical($message, $context)aModuleCritical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)aModuleDetailed debug information.
debugName()aModuleHuman-readable identifier used as the default {origin} in this instance's log messages.
DefaultConfig()aModuleThe config a module starts from before anything loaded via Configuration is merged in.
emergency($message, $context)aModuleSystem is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)aModuleRuntime errors that do not require immediate action but should typically be logged and monitored.
ExtractRoutes($config)aControllerExtract all the APIRoute from this class, regardless of the fact they are registered in the application
getVerbosity()aModule
HasRoutes()aControllerTells if any APIRoute are registered in the application
info($message, $context)aModuleInteresting events. No-op if INFO is currently filtered out by the verbosity mask.
Instantiate($config)aModule(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
IsShared()aModule
Link($method, $data)aControllerBuild a Link (URL + label/icon/description/title, taken from the route's APIRoute metadata) for a registered route.
log($level, $message, $context)aModuleLogs with an arbitrary level.
notice($message, $context)aModuleNormal but significant events.
offsetExists($key)aModule\ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access.
offsetGet($key)aModule\ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g.
offsetSet($key, $value)aModule\ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g.
offsetUnset($key)aModule\ArrayAccess::offsetUnset -- equivalent to $module[$key] = null.
Route($method)aControllerGet a registered APIRoute WARNING: if this class was not registered in the application, it will return null.
Routes()aControllerGet a list of registered APIRoutes (from this class) in the application WARNING: if this class was not registered in the application, it will return an empty array.
serialize($path, $serializer)aModule\MMO\core\interfaces\iSerializable::serialize -- exports every property (via
setVerbosity($verb)aModuleSet the current verbosity mask, replacing whatever it was before.
Shared()aModuleGet the shared instance, creating (and configuring) it on first call.
testVerbosity($level)aModuleTest whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
traitUnshare($serialize)aModuleRemove the shared instance, so the next Shared() call creates a fresh one.
unserialize($data, $path, $instances)aModule\MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via
Unshare($serialize)aModuleLike tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it.
Url($method, $data)aControllerBuild the URL for a registered route, filling in any {placeholder} from $data.
warning($message, $context)aModuleExceptional occurrences that are not errors.
__construct($config)aModuleprotected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data.
__wakeup()aControllerCalled automatically right after the controller's shared instance is built (aModule::unserialize): registers onRoute as a Route listener with a low priority (-10), so it…