Index

Documentor

MMO\doc · 1 symbol · generated 30 Sep 2026

class

Documentor

Documentor.php:18
class MMO\doc\Documentor extends MMO\core\classes\aModule
Namespace
MMO\doc
Extends
aModule

Index

REF_CLASSES
REF_CONSTANTS
REF_FUNCTIONS
REF_INTERFACES
REF_TRAITS
docFolders
links
namespace
Anchor($name) staticThe canonical in-page anchor for a symbol or member name, shared by every renderer so a link built by the markdown printer and one built by the html controller always agree: lowercased, every names…
buildIndex($reflections)Build (and persist) the search/usage index for the given reflections: one index.json file per library's doc root folder (merged with whatever that file already contains, so generating one library…
DefaultConfig() static
generate($flags, $namespaces)
getAnchor($ref)The in-page anchor a reflection is reachable at, shared by every renderer.
getDefinedConstants($namespaces)
getDefinedEntities($flags, $namespaces)Get reflections for all defined entities
getDefinedReflections($flags, $namespaces)
getFilename($ref)Get the documentation filename for a given class or function
getNamespaceFolder($namespace)Get the folder destination for a given namespace.
getPagePath($ref)Get the doc-browser page path for a reflection: {library}/{path of its page inside that library's documentation folder}, e.g.
getPageUrl($ref)The absolute app url of a reflection's documentation page (distinct from getUrl, which builds a link *relative to another generated markdown file*).
getRootNamespaceFolder($namespace, $rootNs)Get the root folder destination for a given namespace.
getUrl($ref, $basepath)Get a link url for a given reference
graphFromReflections($reflections, $filename, $options, $removeDotFile)Generate graph from reflections
indexEntryForClass($ref)
indexEntryForFunction($ref)
libraryOf($namespace)
loopDefinedReflections($flags, $namespaces)Get all defined functions,classes,interfaces,traits,constants for given namespaces.
markdownFromReflections($reflections, $index)Generate the documentation of the given reflections: one .md page per target file (getFilename), plus the .doc.json model of that same page next to it -- which is what the html renderer re…
pagePath($filename, $namespace)
pagesFromReflections($reflections, $index)Build the page model of every file the given reflections document.
PageUrl($page, $anchor) static
resolveExampleSource($tag)Resolve the runnable source of an @example tag: either the tag's own literal text (the common form used throughout this codebase, e.g.
usageLabel($name, $entry)
usageOf($name, $index)
__wakeup()Wires this package into the running app: connects its controllers as routes (connect) and, if mmo.client is loaded, hooks the documentation menu/content into it.

Constants5

REF_CLASSES

const REF_CLASSES = 2

REF_CONSTANTS

const REF_CONSTANTS = 16

REF_FUNCTIONS

const REF_FUNCTIONS = 1

REF_INTERFACES

const REF_INTERFACES = 8

REF_TRAITS

const REF_TRAITS = 4

Properties3

docFolders

array $docFolders = []
Type
array

namespace

string $namespace = 'MMO'
Type
string

Methods27

Anchor($name)

staticDocumentor.php:85

The canonical in-page anchor for a symbol or member name, shared by every renderer so a link built by the markdown printer and one built by the html controller always agree: lowercased, every namespace/path separator and sigil dropped, everything else that is not a letter, a digit or a - folded into a -.

static function Anchor(string $name): string
$namestringe.g. MMO\core\server\Route, MMO.core.Map, Route::getUri, mmo-progress
returnsstringe.g. mmocoreserverroute, mmo-core-map, route-geturi, mmo-progress
\MMO\doc\Documentor::Anchor('Route::getUri'); // 'route-geturi'

buildIndex($reflections)

Documentor.php:625

Build (and persist) the search/usage index for the given reflections: one index.json file per library's doc root folder (merged with whatever that file already contains, so generating one library at a time doesn't erase another's entries), keyed by fully-qualified symbol name, each holding {kind, namespace, shortName, url, summary, callees, callers} -- callees come from CallGraphAnalyzer, callers is recomputed as their inverse across the whole merged set.

function buildIndex(array $reflections): array
$reflectionsarray
returnsarrayfolder => merged index, for convenience (e.g. so MarkdownPrinter can read the just-built entries without re-reading the file)

generate($flags, $namespaces)

Documentor.php:472
function generate(int $flags = -1, string ...$namespaces): void
$flags = -1int
...$namespacesstring
returnsvoid

getDefinedEntities($flags, $namespaces)

Documentor.php:255

Get reflections for all defined entities

function getDefinedEntities(int $flags = -1, string ...$namespaces): array
$flags = -1int
...$namespacesstring
returnsarray
throws

getDefinedReflections($flags, $namespaces)

Documentor.php:225
function getDefinedReflections(int $flags = -1, string ...$namespaces): array
$flags = -1int
...$namespacesstring
returnsarray

getNamespaceFolder($namespace)

Documentor.php:133

Get the folder destination for a given namespace.

function getNamespaceFolder(string $namespace): stringIf it is not explicitely defined in `docFolders`, it uses the root folder of the root namespace and use [PSR4](https://www.php-fig.org/psr/psr-4/) to get the complete path for a namespace.
$namespacestring
returnsstring
`MMO\core\strings` => `libs/core/docs/php/strings`

getPagePath($ref)

Documentor.php:524

Get the doc-browser page path for a reflection: {library}/{path of its page inside that library's documentation folder}, e.g. mmo.core/php/server/Route.md.

function getPagePath(ReflectionFunctionAbstract|ReflectionClass $ref): ?stringThis -- and not a ready-made url -- is what gets stored in the generated model and index, on purpose: the generator often runs from a shell script, where `{siteurl}` is whatever that script's working directory happens to make it, and a url baked there would be wrong for every real request afterwards. The renderers turn it into a url at *render* time instead ([`getPageUrl`](https://mmoframework.fr/documentation/mmo.doc/php/Documentor.md#documentor-getpageurl), [`HtmlPrinter::reference`](https://mmoframework.fr/documentation/mmo.doc/php/HtmlPrinter.md#htmlprinter-reference)). It mirrors the path scheme built by [`includeDocumentation`](https://mmoframework.fr/documentation/mmo.doc/php.md#includedocumentation): the path is relative to the manifest-declared documentation folder ([`PackageManifest::getDocumentationFolders`](https://mmoframework.fr/documentation/mmo.core/php/helpers/PackageManifest.md#packagemanifest-getdocumentationfolders) -- NOT [`getRootNamespaceFolder`](https://mmoframework.fr/documentation/mmo.doc/php/Documentor.md#documentor-getrootnamespacefolder), which is one level deeper, so `php` shows up as an ordinary segment).
$refReflectionFunctionAbstract | ReflectionClass
returnsnull | stringnull when the owning package cannot be resolved, or the symbol has no page of its own

getRootNamespaceFolder($namespace, $rootNs)

Documentor.php:103

Get the root folder destination for a given namespace.

function getRootNamespaceFolder(string $namespace, ?string &$rootNs = null): stringIf it is not set in $docFolders, it reads the manifest of the root namespace (`MMO\xxx`) and use the first folder declared in `documentations` (`docs` by default) and append `php` to it.
$namespacestring
$rootNs = nullnull | stringa reference on the root namespace
returnsstringthe root folder
`MMO\core\strings` => the root folder is `MMO\core` and its associated folder is `libs/core/docs/php`

graphFromReflections($reflections, $filename, $options, $removeDotFile)

Documentor.php:445

Generate graph from reflections

function graphFromReflections( array $reflections, string $filename, array $options = [], bool $removeDotFile = false ): voidDot options: - graph: (null|entity) (default null) if entity, the entities attributes are printed instead of their properties/methods. - linkNamespaces: ?[string] namespaces to print links for. If null, print all links - linkInterfaces: bool if true show interfaces link. (default: false for entity, true for class) - linkTraits: bool if true show traits link. (default: false for entity, true for class) - linkVisible: bool (default true) if false, hide the links (links are also used to position the nodes. so it is important to have them, but sometimes hard to display)
$reflectionsarraythe list of reflections
$filenamestringthe filename to generate (extension is used to determine which format to use)
$options = []arrayoptions. output options: - layout: the layout to use to draw (dot|neato|fdp|sfdp|circo|twopi|nop|nop2|osage|patchwork)[https://graphviz.org/docs/layouts/] - title: string the graph title. (default the basename of the output file) - bgcolor: the background color in heaxdecimal. (default #ffffff) - splines: (line|polyline|curved|ortho|spline) the lines layout (default spline) https://graphviz.org/docs/attrs/splines/. - fontname: string the font name to use https://graphviz.org/docs/attrs/fontname/
$removeDotFile = falsebool
returnsvoid

indexEntryForClass($ref)

Documentor.php:598
protected function indexEntryForClass(ReflectionClass $ref): array
$refReflectionClass
returnsarraythe {kind,name,namespace,shortName,page,anchor,summary,exception,abstract} entry for one class/interface/trait/enum

indexEntryForFunction($ref)

Documentor.php:583
protected function indexEntryForFunction(ReflectionFunctionAbstract $ref): array
$refReflectionFunctionAbstract
returnsarraythe {kind,name,namespace,shortName,page,anchor,summary} entry for one reflection (function or method)

libraryOf($namespace)

Documentor.php:401
function libraryOf(string $namespace): string
$namespacestring
returnsstringthe package a namespace belongs to, or '' when it belongs to none.

loopDefinedReflections($flags, $namespaces)

Documentor.php:192

Get all defined functions,classes,interfaces,traits,constants for given namespaces.

function loopDefinedReflections(int $flags = -1, string ...$namespaces): Generator
$flags = -1intbinary combinaison of self::REF_*
...$namespacesstring
returnsGeneratoran array of reflection objects (or the constant's value if included)
throws

markdownFromReflections($reflections, $index)

Documentor.php:312

Generate the documentation of the given reflections: one .md page per target file (getFilename), plus the .doc.json model of that same page next to it -- which is what the html renderer reads, so that rendering a page never needs reflection again.

function markdownFromReflections(array $reflections, array $index = []): void
See
DocPage the model written next to each page, DocPageController the controller that renders it
$reflectionsarray
$index = []arraythe merged search index (buildIndex), used to fill each symbol's call graph
returnsvoid

pagePath($filename, $namespace)

Documentor.php:410
protected function pagePath(string $filename, string $namespace): string
$filenamestring
$namespacestring
returnsstringthe page's path relative to its library's documentation folder, extension dropped.

pagesFromReflections($reflections, $index)

Documentor.php:330

Build the page model of every file the given reflections document.

function pagesFromReflections(array $reflections, array $index = []): arraySeveral symbols can land on the same page -- every function of a namespace does ([`getFilename`](https://mmoframework.fr/documentation/mmo.doc/php/Documentor.md#documentor-getfilename)), and that is exactly what makes `strings.md` a page about `MMO\core\strings` rather than a hundred stubs.
$reflectionsarray
$index = []array
returnsarraypage model, keyed by the markdown filename it belongs in

PageUrl($page, $anchor)

staticDocumentor.php:577
static function PageUrl(?string $page, ?string $anchor = null): ?string
$pagenull | stringa page path, getPagePath
$anchor = nullnull | string
returnsnull | stringthe url that page is served at, resolved now, in the context of the current request
\MMO\doc\Documentor::PageUrl('mmo.core/php/server/Route.md', 'route');

resolveExampleSource($tag)

Documentor.php:489

Resolve the runnable source of an @example tag: either the tag's own literal text (the common form used throughout this codebase, e.g. @example\n * $p = new Process(...); $p->run();), or, for the inline `

function resolveExampleSource(MMO\doc\helpers\DocTag $tag): string{@example url}` form, the referenced file sliced to `[start, start+count)` lines (both optional; `url` also accepts the `php://path#line` form used for source links elsewhere in this class).
$tagDocTag
returnsstring

usageLabel($name, $entry)

Documentor.php:393
protected function usageLabel(string $name, array $entry): string
$namestring
$entryarray
returnsstringhow one call-graph entry is labelled: Class::method for a method, the short name otherwise.

usageOf($name, $index)

Documentor.php:369
function usageOf(string $name, array $index): ?array
$namestringa fully qualified symbol name
$indexarray
returnsnull | array{uses, usedBy}, each entry {name, label, kind, url}, or null when the symbol is not in the index or calls nothing and is called by nothing

__wakeup()

Documentor.php:70

Wires this package into the running app: connects its controllers as routes (connect) and, if mmo.client is loaded, hooks the documentation menu/content into it. This needs to run once, eagerly, *before* the first request is routed -- routing itself happens per-request, so a deferred Application job (this package's 'jobs' config, tried first) runs too late (jobs only fire once routing has already started). The proven-working pattern for "run once, early" in this framework is a module's own __wakeup() (called once, the first time its singleton is constructed) plus the consuming app calling Shared() on it early -- exactly how MMO\client\Theme registers its own build jobs. So: call \MMO\doc\Documentor::Shared(); once, right after \MMO\app([...]), in every consuming app.

function __wakeup(): void
returnsvoid
Inherited members (47)
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.
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.
getVerbosity()aModule
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.
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.
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.