Index

MarkdownPrinter

MMO\doc · 1 symbol · generated 30 Sep 2026

class

MarkdownPrinter

MarkdownPrinter.php:27

Renders a documentation page (DocPage) as markdown.

class MMO\doc\MarkdownPrinter extends MMO\core\printers\TextPrinter
Namespace
MMO\doc
Extends
TextPrinter
See
DocPageController, which reads the very same model.
The output is **portable** markdown: github-flavored tables, fenced code, `<details>` and plain anchors, and nothing else -- no custom element, no framework-specific html. A generated page therefore reads the same in the repository, on github, in an editor's preview and inside the app. Everything interactive (running an `@example`, the live call graph, the search box) belongs to the html renderer instead, The page is built to be *navigated*, not just read: - a **Contents** list at the top, when a page holds several symbols; - per symbol, a one-line signature, a relations table (extends/implements/uses/source) and a compact **member index** table, so the shape of a class is visible before scrolling through it; - members grouped by kind, each under a stable anchor ([`anchor`](https://mmoframework.fr/documentation/mmo.doc/php.md#anchor)); - inherited members folded into a `<details>`, present but never in the way; - a `↑` back-to-top link closing each section.
$markdown = \MMO\doc\MarkdownPrinter::Print($page);

Index

defaultLanguage
kindIcons
memberIcons
visibilityIcons
AnchorName($name) static
examples($examples, $language)
exportMember($member, $options)
exportPage($page, $options)
exportSymbol($symbol, $options)
firstSentence($text)
href($reference, $options)Resolve where a reference points from this page: another generated page is linked relatively (so the markdown works in a checkout, on github and in the app alike), anything else by its absolute…
icon($symbol)
index($sections, $options)The compact member index: one line per member, so the whole api is visible without scrolling through it.
inherited($symbol, $options)Inherited members, folded away: knowing they exist (and where they come from) matters, repeating their documentation on every subclass's page does not.
languageOf($symbol)
memberLabel($member)
memberLanguage($symbol, $member)
memberSees($member, $options)
PageFilename($page) staticThe file of a page path (Documentor::getPagePath): mmo.core/php/colors.md is php/colors.md in one of mmo.core's documentation folders -- the one holding it, or else the first, where the ge…
parameters($params, $return, $throws, $options)The parameters/return/throws table -- one table rather than three, because what a reader wants is the whole contract at a glance.
referenceLink($reference, $options)
relations($symbol, $options)The "what is this attached to" table: namespace, inheritance, and where the source lives.
SanitizeTableText($text) staticMake a text safe to drop inside a markdown table cell: a cell cannot contain a line break, and a literal | would end it.
see($text, $options)
sourceLink($file, $line, $options)
typeLink($type, $options)
usage($symbol, $options)The call graph slice, as two plain lists.
__construct($config)
__invoke($value, $options, $type)

Properties4

defaultLanguage

string $defaultLanguage = 'php'
Type
string

kindIcons

array $kindIcons = […10 items]
Type
array

memberIcons

array $memberIcons = […8 items]
Type
array

visibilityIcons

array $visibilityIcons = ['public' => '🔓', 'protected' => '🔐', 'private' => '🔑']
Type
array

Methods25

examples($examples, $language)

MarkdownPrinter.php:402
protected function examples(array $examples, string $language): string
$examplesarray
$languagestring
returnsstringeach @example as a fenced code block -- runnable only in the html renderer, readable everywhere

exportMember($member, $options)

MarkdownPrinter.php:330
function exportMember(MMO\doc\models\DocMember $member, array $options = []): string
$memberDocMember
$options = []arraylanguage: the fenced-code language for its signature
returnsstring

firstSentence($text)

MarkdownPrinter.php:565
protected function firstSentence(string $text): string
$textstring
returnsstringthe first sentence of a text -- what a one-line summary cell can hold.

href($reference, $options)

MarkdownPrinter.php:476

Resolve where a reference points from this page: another generated page is linked relatively (so the markdown works in a checkout, on github and in the app alike), anything else by its absolute url.

protected function href(array $reference, array $options): ?string
$referencearray
$optionsarray
returnsnull | string

index($sections, $options)

MarkdownPrinter.php:245

The compact member index: one line per member, so the whole api is visible without scrolling through it.

protected function index(array $sections, array $options = []): string
$sectionsarray
$options = []array
returnsstring

inherited($symbol, $options)

MarkdownPrinter.php:273

Inherited members, folded away: knowing they exist (and where they come from) matters, repeating their documentation on every subclass's page does not.

protected function inherited(MMO\doc\models\DocSymbol $symbol, array $options): string
$symbolDocSymbol
$optionsarray
returnsstring

languageOf($symbol)

MarkdownPrinter.php:545
protected function languageOf(MMO\doc\models\DocSymbol $symbol): string
$symbolDocSymbol
returnsstringthe fenced-code language a symbol's own declaration is highlighted as.

memberLabel($member)

MarkdownPrinter.php:534
protected function memberLabel(MMO\doc\models\DocMember $member): string
$memberDocMember
returnsstringhow a member is labelled everywhere it is referenced (index, heading, inherited table).

memberLanguage($symbol, $member)

MarkdownPrinter.php:557
protected function memberLanguage(MMO\doc\models\DocSymbol $symbol, MMO\doc\models\DocMember $member): string
$symbolDocSymbol
$memberDocMember
returnsstringthe language that member's signature is highlighted as -- markup for the parts that really are markup (an attribute, a slot, a css hook), the host language for everything else

memberSees($member, $options)

MarkdownPrinter.php:430
protected function memberSees(MMO\doc\models\DocMember $member, array $options): string
$memberDocMember
$optionsarray
returnsstringthe member's own @see tags, linked, comma separated

PageFilename($page)

staticMarkdownPrinter.php:501

The file of a page path (Documentor::getPagePath): mmo.core/php/colors.md is php/colors.md in one of mmo.core's documentation folders -- the one holding it, or else the first, where the generators write.

static function PageFilename(string $page): ?string
$pagestring
returnsnull | stringnull when the package is unknown
MarkdownPrinter::PageFilename('mmo.core/php/colors.md'); // '/…/libs/core/docs/php/colors.md'

parameters($params, $return, $throws, $options)

MarkdownPrinter.php:370

The parameters/return/throws table -- one table rather than three, because what a reader wants is the whole contract at a glance.

protected function parameters(array $params, ?array $return, array $throws, array $options): string
$paramsarray
$returnnull | array
$throwsarray
$optionsarray
returnsstring

relations($symbol, $options)

MarkdownPrinter.php:209

The "what is this attached to" table: namespace, inheritance, and where the source lives.

protected function relations(MMO\doc\models\DocSymbol $symbol, array $options): string
$symbolDocSymbol
$optionsarray
returnsstring

SanitizeTableText($text)

staticMarkdownPrinter.php:104

Make a text safe to drop inside a markdown table cell: a cell cannot contain a line break, and a literal | would end it.

static function SanitizeTableText(string $text): string
$textstring
returnsstring

see($text, $options)

MarkdownPrinter.php:421
protected function see(string $text, array $options): string
$textstring
$optionsarraysees: the @see references of the node the text belongs to
returnsstring$text, each of its @see references turned into a link (linkSees)
Inherited members (101)
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
functionsaConverter
globalOptionsTextPrinter
templatesTextPrinter
verbosityaModule
MethodsDeclared byDescription
addOptions($type, $options)aConverterMerge $options into $type's existing options (via merge), rather than replacing them wholesale like setOptions.
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).
call($type, $value, $options)aConverterCall the function associated to a type
clear()TextPrinterReset both the exporter state (aExporter::clear) and $templates.
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.
dump($values)TextPrinterEcho one or more values in dump mode (see idump), with a header naming the calling file/line and a footer.
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.
Export($value, $options, $type)aExporterExport any value, dispatching to the right converter based on its type (or the explicit $type).
exportArray($value, $options)aExporterBuilt-in 'array' converter (a list): recursively exports every value, in place.
exportBoolean($value, $options)TextPrinterTypecast to a boolean and return template 'true' or 'false'
exportClosure($value, $options)TextPrinterClosure
exportDateTime($value, $options)TextPrinterRender a DatimeInterface
exportDump($value, $options)TextPrinterThe 'dump' type exporter -- same as idump but registered for explicit dispatch via __invoke($v, [], 'dump').
exportEntity($value, $options)TextPrinterAn entity (any iArrayProperties) is printed as its toArray() -- what an API returns of it -- the same as
exportEnum($value, $options)TextPrinter
exportFilename($value, $options)TextPrinterRender a relative filename
exportInstance($value, $options)TextPrinterobject options: - {int} scope: binary combinaison of the class constants PROPERTY_*.
exportLog($value, $options)TextPrinterMMO\core\events\Log
exportNull($value, $options)TextPrinterReturn template 'null'
exportNumber($value, $options)TextPrinterFormat number
exportObject($value, $options)TextPrinterarray options: {HashList} hashes: the hash list {int|false} max-level: the max level to go to.
ExportProperties($value, $options)aExporterExport an object exportInstance method
exportRenderable($value, $options)TextPrinter
exportResource($value, $options)TextPrinterResource
exportSplObjectStorage($value, $options)TextPrinter
exportsProperty($prop, $value)TextPrinterSame as aExporter::exportsProperty, and a property marked #[NoDump] (a back-reference, such as a collection's repository) is not printed either: an object is printed without what its dump leav…
exportString($value, $options)TextPrinterTypecast to a string
exportThrowable($value, $options)TextPrinter
exportTraces($value, $options)TextPrinterMMO\core\messages\Log::traces
exportValidatorError($value, $options)TextPrinter
getClassFunction($class)aConverterFind which registered type (a class or interface name) applies to $class: itself if directly registered, else the closest registered ancestor class or implemented interface.
getFunction($type)aConverter
getFunctions()aConverter
getIndent($options)TextPrinter
getOptions($type)aConverter
getTemplate($name)TextPrinter
getTemplates()TextPrinter
getType($value, $allowClass)aConverterNormalize $value's type into one of this converter's type names.
getVerbosity()aModule
hash($value, $options)TextPrinter
hasTemplate($name)TextPrinter
hasType($type)aConverter
hiddenProperties($value)TextPrinterThe properties of $value whose value a dump does not show (exportInstance): for an iArrayProperties (an entity), those behind a hidden ArrayProperty (ArrayProper…
idump($value, $options)TextPrinter
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
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.
Print($value, $options, $type)TextPrinter
renderMaxLevel($value, $options)TextPrinter
renderPrintError($e)TextPrinterWhat a value whose exporter threw is printed as (__invoke): the exception's class and message, as text (renderText) -- never its stack trace.
renderTemplate($name, $data)TextPrinterRender a template
renderText($text)TextPrinterThe text a template holds that comes from the value printed: the keys and property names of a dump (a decoded request body's...), a resource's uri, a validation error's message, a log's message and…
resetHash($value, $options)aExporterForget that $value was already seen, within the given $options['hashes'] tracking map: the next time $value is encountered in this same export, it is exported in full again instead of collapsing to…
serialize($path, $serializer)aModule\MMO\core\interfaces\iSerializable::serialize -- exports every property (via
setFunction($type, $fn, $options)aConverterSet a coercer
setFunctions($fns)aConverterRegister many functions at once, e.g.
setOptions($type, $options)aConverterReplace $type's options wholesale.
setTemplate($name, $tpl)TextPrinterSet template
setTemplates($tpls)TextPrinter
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.
warning($message, $context)aModuleExceptional occurrences that are not errors.